Skip to content

Commit d5e5424

Browse files
authored
Merge branch 'master' into 25_06_modify_proximity
2 parents 9b47c63 + f37305c commit d5e5424

7 files changed

Lines changed: 125 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
target-branch: devel
6+
schedule:
7+
interval: monthly

Sofa/Component/Constraint/Lagrangian/Model/src/sofa/component/constraint/lagrangian/model/BilateralLagrangianConstraint.inl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ void BilateralLagrangianConstraint<DataTypes>::getConstraintResolution(const Con
277277
std::vector<ConstraintResolution*>& resTab,
278278
unsigned int& offset)
279279
{
280+
if (!d_activate.getValue()) return;
281+
280282
SOFA_UNUSED(cParams);
281283
const unsigned minp=std::min(d_m1.getValue().size(), d_m2.getValue().size());
282284

Sofa/Component/Visual/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ set(HEADER_FILES
1515
${SOFACOMPONENTVISUAL_SOURCE_DIR}/TrailRenderer.h
1616
${SOFACOMPONENTVISUAL_SOURCE_DIR}/TrailRenderer.inl
1717
${SOFACOMPONENTVISUAL_SOURCE_DIR}/Visual3DText.h
18+
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualBoundingBox.h
1819
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualGrid.h
1920
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualModelImpl.h
2021
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualStyle.h
@@ -31,6 +32,7 @@ set(SOURCE_FILES
3132
${SOFACOMPONENTVISUAL_SOURCE_DIR}/RecordedCamera.cpp
3233
${SOFACOMPONENTVISUAL_SOURCE_DIR}/TrailRenderer.cpp
3334
${SOFACOMPONENTVISUAL_SOURCE_DIR}/Visual3DText.cpp
35+
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualBoundingBox.cpp
3436
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualGrid.cpp
3537
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualModelImpl.cpp
3638
${SOFACOMPONENTVISUAL_SOURCE_DIR}/VisualStyle.cpp
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/******************************************************************************
2+
* SOFA, Simulation Open-Framework Architecture *
3+
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
4+
* *
5+
* This program is free software; you can redistribute it and/or modify it *
6+
* under the terms of the GNU Lesser General Public License as published by *
7+
* the Free Software Foundation; either version 2.1 of the License, or (at *
8+
* your option) any later version. *
9+
* *
10+
* This program is distributed in the hope that it will be useful, but WITHOUT *
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
13+
* for more details. *
14+
* *
15+
* You should have received a copy of the GNU Lesser General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
*******************************************************************************
18+
* Authors: The SOFA Team and external contributors (see Authors.txt) *
19+
* *
20+
* Contact information: contact@sofa-framework.org *
21+
******************************************************************************/
22+
23+
#include <sofa/component/visual/VisualBoundingBox.h>
24+
#include <sofa/core/visual/VisualParams.h>
25+
#include <sofa/core/ObjectFactory.h>
26+
#include <sofa/defaulttype/VecTypes.h>
27+
28+
namespace sofa::component::visual
29+
{
30+
31+
void registerVisualBoundingBox(sofa::core::ObjectFactory* factory)
32+
{
33+
factory->registerObjects(core::ObjectRegistrationData("Display an Axis Aligned Bounding Box (AABB).")
34+
.add< VisualBoundingBox >());
35+
}
36+
37+
VisualBoundingBox::VisualBoundingBox()
38+
: d_color(initData(&d_color, sofa::type::RGBAColor::yellow(), "color", "Color of the lines of the box."))
39+
, d_thickness(initData(&d_thickness, 1.0f, "thickness", "Thickness of the lines of the box."))
40+
{
41+
42+
}
43+
44+
void VisualBoundingBox::doDrawVisual(const core::visual::VisualParams* vparams)
45+
{
46+
47+
const auto& bbox = f_bbox.getValue();
48+
vparams->drawTool()->disableLighting();
49+
vparams->drawTool()->setMaterial(d_color.getValue());
50+
vparams->drawTool()->drawBoundingBox(bbox.minBBox(), bbox.maxBBox(), d_thickness.getValue());
51+
}
52+
53+
} // namespace sofa::component::visual
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/******************************************************************************
2+
* SOFA, Simulation Open-Framework Architecture *
3+
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
4+
* *
5+
* This program is free software; you can redistribute it and/or modify it *
6+
* under the terms of the GNU Lesser General Public License as published by *
7+
* the Free Software Foundation; either version 2.1 of the License, or (at *
8+
* your option) any later version. *
9+
* *
10+
* This program is distributed in the hope that it will be useful, but WITHOUT *
11+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
12+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
13+
* for more details. *
14+
* *
15+
* You should have received a copy of the GNU Lesser General Public License *
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17+
*******************************************************************************
18+
* Authors: The SOFA Team and external contributors (see Authors.txt) *
19+
* *
20+
* Contact information: contact@sofa-framework.org *
21+
******************************************************************************/
22+
#pragma once
23+
#include <sofa/component/visual/config.h>
24+
25+
#include <sofa/core/visual/VisualModel.h>
26+
#include <sofa/type/RGBAColor.h>
27+
28+
namespace sofa::component::visual
29+
{
30+
/*
31+
* Display an Axis Orientated Bounding Box.
32+
*/
33+
class SOFA_COMPONENT_VISUAL_API VisualBoundingBox : public core::visual::VisualModel
34+
{
35+
public:
36+
SOFA_CLASS(VisualBoundingBox, core::visual::VisualModel);
37+
38+
VisualBoundingBox();
39+
~VisualBoundingBox() override = default;
40+
41+
Data<sofa::type::RGBAColor> d_color; ///< Color of the lines in the grid. default=yellow
42+
Data<float> d_thickness; ///< Thickness of the lines in the grid
43+
44+
private:
45+
void doDrawVisual(const core::visual::VisualParams*) override;
46+
47+
};
48+
49+
} // namespace sofa::component::visual

Sofa/Component/Visual/src/sofa/component/visual/init.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ extern void registerLineAxis(sofa::core::ObjectFactory* factory);
3333
extern void registerRecordedCamera(sofa::core::ObjectFactory* factory);
3434
extern void registerTrailRenderer(sofa::core::ObjectFactory* factory);
3535
extern void registerVisual3DText(sofa::core::ObjectFactory* factory);
36+
extern void registerVisualBoundingBox(sofa::core::ObjectFactory* factory);
3637
extern void registerVisualGrid(sofa::core::ObjectFactory* factory);
3738
extern void registerVisualModelImpl(sofa::core::ObjectFactory* factory);
3839
extern void registerVisualStyle(sofa::core::ObjectFactory* factory);
@@ -69,6 +70,7 @@ void registerObjects(sofa::core::ObjectFactory* factory)
6970
registerRecordedCamera(factory);
7071
registerTrailRenderer(factory);
7172
registerVisual3DText(factory);
73+
registerVisualBoundingBox(factory);
7274
registerVisualGrid(factory);
7375
registerVisualModelImpl(factory);
7476
registerVisualStyle(factory);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Node name="root" dt="0.01">
2+
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
3+
<RequiredPlugin name="Sofa.Component.Visual"/> <!-- Needed to use components [VisualBoundingBox] -->
4+
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
5+
<DefaultAnimationLoop/>
6+
7+
<MeshOBJLoader name="meshLoader_0" filename="mesh/liver-smooth.obj" handleSeams="1" />
8+
<OglModel name="VisualModel" src="@meshLoader_0" color="red" />
9+
<VisualBoundingBox color="green" thickness="20" bbox="@VisualModel.bbox"/>
10+
</Node>

0 commit comments

Comments
 (0)