Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VTK Examples
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VTK
VTK Examples
Merge requests
!2
These are the updated files from the VTK Examples Hackathon
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
These are the updated files from the VTK Examples Hackathon
Add_updated_code
into
master
Overview
0
Commits
1
Pipelines
0
Changes
14
Merged
Andrew Maclean
requested to merge
Add_updated_code
into
master
4 years ago
Overview
0
Commits
1
Pipelines
0
Changes
14
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
998b181d
1 commit,
4 years ago
14 files
+
276
−
543
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
14
Search (e.g. *.vue) (Ctrl+P)
src/Cxx/Animation/AnimateActors.cxx
+
16
−
21
Options
@@ -6,42 +6,45 @@
#include
<vtkColor.h>
#include
<vtkCommand.h>
#include
<vtkConeSource.h>
#include
<vtkLogger.h>
#include
<vtkNamedColors.h>
#include
<vtkNew.h>
#include
<vtkPolyDataMapper.h>
#include
<vtkProperty.h>
#include
<vtkRenderer.h>
#include
<vtkRenderWindow.h>
#include
<vtkRenderWindowInteractor.h>
#include
<vtkRenderer.h>
#include
<vtkSmartPointer.h>
#include
<vtkSphereSource.h>
int
main
(
int
argc
,
char
*
argv
[])
{
vtkLogger
::
Init
(
argc
,
argv
);
// Colors
auto
colors
=
vtkSmartPointer
<
vtkNamedColors
>
::
New
()
;
vtkNew
<
vtkNamedColors
>
colors
;
vtkColor3d
coneColor
=
colors
->
GetColor3d
(
"Tomato"
);
vtkColor3d
sphereColor
=
colors
->
GetColor3d
(
"Banana"
);
vtkColor3d
backgroundColor
=
colors
->
GetColor3d
(
"Peacock"
);
// Create the graphics structure. The renderer renders into the
// render window.
auto
iren
=
vtkSmartPointer
<
vtkRenderWindowInteractor
>
::
New
()
;
auto
ren1
=
vtkSmartPointer
<
vtkRenderer
>
::
New
()
;
vtkNew
<
vtkRenderWindowInteractor
>
iren
;
vtkNew
<
vtkRenderer
>
ren1
;
ren1
->
SetBackground
(
backgroundColor
.
GetData
());
auto
renWin
=
vtkSmartPointer
<
vtkRenderWindow
>::
New
();
renWin
->
SetMultiSamples
(
0
);
vtkNew
<
vtkRenderWindow
>
renWin
;
iren
->
SetRenderWindow
(
renWin
);
renWin
->
AddRenderer
(
ren1
);
// Generate a sphere
auto
sphereSource
=
vtkSmartPointer
<
vtkS
phereSource
>::
New
()
;
vtkNew
<
vtkSphereSource
>
s
phereSource
;
sphereSource
->
SetPhiResolution
(
31
);
sphereSource
->
SetThetaResolution
(
31
);
auto
sphereMapper
=
vtkSmartPointer
<
vtkPolyDataMapper
>
::
New
()
;
vtkNew
<
vtkPolyDataMapper
>
sphereMapper
;
sphereMapper
->
SetInputConnection
(
sphereSource
->
GetOutputPort
());
auto
sphere
=
vtkSmartPointer
<
vtkActor
>
::
New
()
;
vtkNew
<
vtkActor
>
sphere
;
sphere
->
SetMapper
(
sphereMapper
);
sphere
->
GetProperty
()
->
SetDiffuseColor
(
sphereColor
.
GetData
());
sphere
->
GetProperty
()
->
SetDiffuse
(
.7
);
@@ -66,23 +69,19 @@ int main(int argc, char* argv[])
auto
scene
=
vtkSmartPointer
<
vtkAnimationScene
>::
New
();
if
(
argc
>=
2
&&
strcmp
(
argv
[
1
],
"-real"
)
==
0
)
{
cout
<<
"real-time mode"
<<
endl
;
vtkLogF
(
INFO
,
"real-time mode"
)
;
scene
->
SetModeToRealTime
();
}
else
{
cout
<<
"sequence mode"
<<
endl
;
vtkLogF
(
INFO
,
"sequence mode"
)
;
scene
->
SetModeToSequence
();
}
scene
->
SetLoop
(
0
);
scene
->
SetFrameRate
(
5
);
scene
->
SetStartTime
(
0
);
scene
->
SetEndTime
(
20
);
vtkSmartPointer
<
AnimationSceneObserver
>
sceneObserver
=
vtkSmartPointer
<
AnimationSceneObserver
>::
New
();
sceneObserver
->
SetRenderWindow
(
renWin
);
scene
->
AddObserver
(
vtkCommand
::
AnimationCueTickEvent
,
sceneObserver
);
scene
->
AddObserver
(
vtkCommand
::
AnimationCueTickEvent
,
renWin
.
GetPointer
(),
&
vtkWindow
::
Render
);
// Create an Animation Cue for each actor
auto
cue1
=
vtkSmartPointer
<
vtkAnimationCue
>::
New
();
@@ -101,11 +100,7 @@ int main(int argc, char* argv[])
animateSphere
.
AddObserversToCue
(
cue1
);
ActorAnimator
animateCone
;
std
::
vector
<
double
>
endCone
(
3
);
endCone
[
0
]
=
-
1
;
endCone
[
1
]
=
-
1
;
endCone
[
2
]
=
-
1
;
animateCone
.
SetEndPosition
(
endCone
);
animateCone
.
SetEndPosition
(
vtkVector3d
(
-
1
,
-
1
,
-
1
));
animateCone
.
SetActor
(
cone
);
animateCone
.
AddObserversToCue
(
cue2
);
Loading