Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
CGoGN
Commits
cce1e8d4
Commit
cce1e8d4
authored
Aug 10, 2011
by
Maire Nicolas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rajout d'une option zigzag dans un des presets animés.
parent
c208a805
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
9 deletions
+35
-9
Apps/Examples/clipping.cpp
Apps/Examples/clipping.cpp
+5
-3
include/Utils/clippingPresetsAnimated.h
include/Utils/clippingPresetsAnimated.h
+5
-1
src/Utils/clippingPresetsAnimated.cpp
src/Utils/clippingPresetsAnimated.cpp
+25
-5
No files found.
Apps/Examples/clipping.cpp
View file @
cce1e8d4
...
...
@@ -447,6 +447,7 @@ void Clipping::slot_pushButton_applyAnimatedClippingPreset()
double size = (double)m_bb.maxSize()*0.1;
int axis = 0;
bool facing = false;
bool zigzag = false;
if (inputValues(VarDbl(centerStartX - 100.0, centerStartX + 100.0, centerStartX, "Center Start X",
VarDbl(centerStartY - 100.0, centerStartY + 100.0, centerStartY, "Center Start Y",
VarDbl(centerStartZ - 100.0, centerStartZ + 100.0, centerStartZ, "Center Start Z",
...
...
@@ -455,11 +456,12 @@ void Clipping::slot_pushButton_applyAnimatedClippingPreset()
VarDbl(centerEndZ - 100.0, centerEndZ + 100.0, centerEndZ, "Center End Z",
VarDbl(size - 100.0, size + 100.0, size, "Size",
VarSlider(0, 2, axis, "Axis",
VarBool(facing, "Facing"
))))))))), "Preset Setup"))
VarBool(facing, "Facing",
VarBool(zigzag, "Zigzag"
)))))))))), "Preset Setup"))
preset = new Utils::ClippingPresetAnimatedDualPlanes(
Geom::Vec3f((float)centerStartX, (float)centerStartY, (float)centerStartZ), Geom::Vec3f((float)centerEndX, (float)centerEndY, (float)centerEndZ),
(float)size, axis, facing);
(float)size, axis, facing
, zigzag
);
animatedPreset = preset;
}
...
...
include/Utils/clippingPresetsAnimated.h
View file @
cce1e8d4
...
...
@@ -127,9 +127,10 @@ public :
* @param size distance between planes
* @param axis axis on which planes are aligned (0 for x, 1 for y, 2 for z)
* @param facing true means having facing planes
* @param zigzag true to enable zigzag mode
*/
ClippingPresetAnimatedDualPlanes
(
Geom
::
Vec3f
centerStart
,
Geom
::
Vec3f
centerEnd
,
float
size
,
int
axis
,
bool
facing
);
Geom
::
Vec3f
centerStart
,
Geom
::
Vec3f
centerEnd
,
float
size
,
int
axis
,
bool
facing
,
bool
zigzag
);
/**
* runs the animation some steps further
...
...
@@ -148,6 +149,9 @@ private :
/// end point of the animation
Geom
::
Vec3f
m_endPoint
;
/// zigzag mode ?
bool
m_zigzag
;
};
...
...
src/Utils/clippingPresetsAnimated.cpp
View file @
cce1e8d4
...
...
@@ -65,13 +65,14 @@ void ClippingPresetAnimated::apply(ClippingShader* clipShader, std::vector<unsig
ClippingPresetAnimatedDualPlanes
::
ClippingPresetAnimatedDualPlanes
(
Geom
::
Vec3f
centerStart
,
Geom
::
Vec3f
centerEnd
,
float
size
,
int
axis
,
bool
facing
)
Geom
::
Vec3f
centerStart
,
Geom
::
Vec3f
centerEnd
,
float
size
,
int
axis
,
bool
facing
,
bool
zigzag
)
{
// Store the animation settings
m_dirVec
=
centerEnd
-
centerStart
;
m_dirVec
.
normalize
();
m_startPoint
=
centerStart
;
m_endPoint
=
centerEnd
;
m_zigzag
=
zigzag
;
// Correct axis if necessary
if
((
axis
<
0
)
||
(
axis
>
2
))
...
...
@@ -123,10 +124,29 @@ void ClippingPresetAnimatedDualPlanes::step(unsigned int amount)
// Update animation parameter value
m_animParam
+=
(
float
)
amount
*
m_animationOneStepIncrement
*
m_animationSpeedFactor
;
while
(
m_animParam
<
0.0
f
)
m_animParam
+=
1.0
f
;
while
(
m_animParam
>
1.0
f
)
m_animParam
-=
1.0
f
;
if
(
!
m_zigzag
)
{
while
(
m_animParam
<
0.0
f
)
m_animParam
+=
1.0
f
;
while
(
m_animParam
>
1.0
f
)
m_animParam
-=
1.0
f
;
}
else
{
while
(
(
m_animParam
<
0.0
f
)
||
(
m_animParam
>
1.0
f
)
)
{
if
(
m_animParam
<
0.0
f
)
{
m_animParam
=
-
m_animParam
;
m_animationOneStepIncrement
=
-
m_animationOneStepIncrement
;
}
else
if
(
m_animParam
>
1.0
f
)
{
m_animParam
=
1.0
f
-
(
m_animParam
-
1.0
f
);
m_animationOneStepIncrement
=
-
m_animationOneStepIncrement
;
}
}
}
// Calculate new center
Geom
::
Vec3f
newCenter
=
(
1.0
f
-
m_animParam
)
*
m_startPoint
+
m_animParam
*
m_endPoint
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment