Skip to content

Commit 9bcacb0

Browse files
committed
Add clipping plane state
1 parent 4ddb6cb commit 9bcacb0

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-7
lines changed

src/Core/Algorithms/Base/Variable.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ namespace Algorithms {
124124
return vars;
125125
}
126126

127+
template <typename T>
128+
Variable::List makeHomogeneousVariableListFill(const T& value, size_t num)
129+
{
130+
return makeHomogeneousVariableList([value](size_t) { return value; }, num);
131+
}
132+
127133
template <typename T>
128134
std::vector<T> toTypedVector(const Variable::List& list, std::function<T(const Variable&)> convert)
129135
{

src/Core/Datatypes/Feedback.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ enum WidgetMovement
5858
SCALE_AXIS_UNIDIRECTIONAL,
5959
};
6060

61+
struct SCISHARE ClippingPlane
62+
{
63+
static constexpr int MaxCount = 6;
64+
bool visible, showFrame, reverseNormal;
65+
double x, y, z, d;
66+
};
67+
6168
struct EnumClassHash
6269
{
6370
template <typename T> std::size_t operator()(T t) const

src/Interface/Modules/Render/ES/RendererInterfaceCollaborators.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,6 @@ namespace SCIRun
5454
FOG_START,
5555
FOG_END
5656
};
57-
58-
struct SCISHARE ClippingPlane
59-
{
60-
bool visible, showFrame, reverseNormal;
61-
double x, y, z, d;
62-
};
6357
}
6458
}
6559

src/Interface/Modules/Render/ES/SRInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ namespace SCIRun
244244

245245
ESCore mCore {}; // Entity system core.
246246

247-
std::vector<ClippingPlane> clippingPlanes_ {};
247+
std::vector<Core::Datatypes::ClippingPlane> clippingPlanes_ {};
248248
int clippingPlaneIndex_ {0};
249249

250250
ren::ShaderVBOAttribs<5> mArrowAttribs {}; // Pre-applied shader / VBO attributes.

src/Modules/Render/ViewScene.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ ALGORITHM_PARAMETER_DEF(Render, CameraRotation);
129129
ALGORITHM_PARAMETER_DEF(Render, IsExecuting);
130130
ALGORITHM_PARAMETER_DEF(Render, TimeExecutionFinished);
131131
ALGORITHM_PARAMETER_DEF(Render, HasNewGeometry);
132+
ALGORITHM_PARAMETER_DEF(Render, ClippingPlaneEnabled);
133+
ALGORITHM_PARAMETER_DEF(Render, ClippingPlaneNormalReversed);
134+
ALGORITHM_PARAMETER_DEF(Render, ClippingPlaneX);
135+
ALGORITHM_PARAMETER_DEF(Render, ClippingPlaneY);
136+
ALGORITHM_PARAMETER_DEF(Render, ClippingPlaneZ);
137+
ALGORITHM_PARAMETER_DEF(Render, ClippingPlaneD);
132138

133139
ViewScene::ViewScene() : ModuleWithAsyncDynamicPorts(staticInfo_, true)
134140
{
@@ -209,6 +215,13 @@ void ViewScene::setStateDefaults()
209215
state->setValue(Parameters::CameraRotation, makeAnonymousVariableList(1.0, 0.0, 0.0, 0.0));
210216
state->setValue(Parameters::HasNewGeometry, false);
211217

218+
state->setValue(Parameters::ClippingPlaneEnabled, makeHomogeneousVariableListFill(false, ClippingPlane::MaxCount));
219+
state->setValue(Parameters::ClippingPlaneNormalReversed, makeHomogeneousVariableListFill(false, ClippingPlane::MaxCount));
220+
state->setValue(Parameters::ClippingPlaneX, makeHomogeneousVariableListFill(0.0, ClippingPlane::MaxCount));
221+
state->setValue(Parameters::ClippingPlaneY, makeHomogeneousVariableListFill(0.0, ClippingPlane::MaxCount));
222+
state->setValue(Parameters::ClippingPlaneZ, makeHomogeneousVariableListFill(0.0, ClippingPlane::MaxCount));
223+
state->setValue(Parameters::ClippingPlaneD, makeHomogeneousVariableListFill(0.0, ClippingPlane::MaxCount));
224+
212225
get_state()->connectSpecificStateChanged(Parameters::GeometryFeedbackInfo, [this]() { processViewSceneObjectFeedback(); });
213226
get_state()->connectSpecificStateChanged(Parameters::MeshComponentSelection, [this]() { processMeshComponentSelection(); });
214227
}

src/Modules/Render/ViewScene.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ namespace SCIRun
7979
ALGORITHM_PARAMETER_DECL(ScaleBarNumTicks);
8080
ALGORITHM_PARAMETER_DECL(ScaleBarLineWidth);
8181
ALGORITHM_PARAMETER_DECL(ScaleBarFontSize);
82+
ALGORITHM_PARAMETER_DECL(ClippingPlaneEnabled);
83+
ALGORITHM_PARAMETER_DECL(ClippingPlaneNormalReversed);
84+
ALGORITHM_PARAMETER_DECL(ClippingPlaneX);
85+
ALGORITHM_PARAMETER_DECL(ClippingPlaneY);
86+
ALGORITHM_PARAMETER_DECL(ClippingPlaneZ);
87+
ALGORITHM_PARAMETER_DECL(ClippingPlaneD);
8288

8389

8490
// save/load confirmed, uses standard widget managers.

0 commit comments

Comments
 (0)