VTK  9.3.0
vtkAnimationCue.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
32 #ifndef vtkAnimationCue_h
33 #define vtkAnimationCue_h
34 
35 #include "vtkCommonCoreModule.h" // For export macro
36 #include "vtkObject.h"
37 
38 VTK_ABI_NAMESPACE_BEGIN
39 class VTKCOMMONCORE_EXPORT vtkAnimationCue : public vtkObject
40 {
41 public:
42  vtkTypeMacro(vtkAnimationCue, vtkObject);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
45  static vtkAnimationCue* New();
46 
47  // Structure passed on every event invocation.
48  // Depending upon the cue time mode, these times are either
49  // normalized [0,1] or relative to the scene that contains the cue.
50  // All this information is also available by asking the cue
51  // directly for it within the handler. Thus, this information can
52  // be accessed in wrapped languages.
54  {
55  public:
56  double StartTime;
57  double EndTime;
58  double AnimationTime; // valid only in AnimationCueTickEvent handler
59  double DeltaTime; // valid only in AnimationCueTickEvent handler
60  double ClockTime; // valid only in AnimationCueTickEvent handler
61  };
62 
64 
71  virtual void SetTimeMode(int mode);
72  vtkGetMacro(TimeMode, int);
73  void SetTimeModeToRelative() { this->SetTimeMode(TIMEMODE_RELATIVE); }
74  void SetTimeModeToNormalized() { this->SetTimeMode(TIMEMODE_NORMALIZED); }
76 
78 
88  vtkSetMacro(StartTime, double);
89  vtkGetMacro(StartTime, double);
91 
93 
102  vtkSetMacro(EndTime, double);
103  vtkGetMacro(EndTime, double);
105 
124  virtual void Tick(double currenttime, double deltatime, double clocktime);
125 
130  virtual void Initialize();
131 
137  virtual void Finalize();
138 
140 
145  vtkGetMacro(AnimationTime, double);
147 
149 
154  vtkGetMacro(DeltaTime, double);
156 
158 
164  vtkGetMacro(ClockTime, double);
166 
168  {
169  TIMEMODE_NORMALIZED = 0,
170  TIMEMODE_RELATIVE = 1
171  };
172 
173  enum class PlayDirection
174  {
175  BACKWARD,
176  FORWARD,
177  };
178 
180 
186 
187 protected:
189  ~vtkAnimationCue() override;
190 
191  enum
192  {
193  UNINITIALIZED = 0,
195  ACTIVE
196  };
197 
198  double StartTime;
199  double EndTime;
200  int TimeMode;
201  PlayDirection Direction = PlayDirection::FORWARD;
202 
203  // These are set when the AnimationCueTickEvent event
204  // is fired. Thus giving access to the information in
205  // the AnimationCueInfo struct in wrapped languages.
207  double DeltaTime;
208  double ClockTime;
209 
213  int CueState;
214 
216 
221  virtual void StartCueInternal();
222  virtual void TickInternal(double currenttime, double deltatime, double clocktime);
223  virtual void EndCueInternal();
225 
227 
231  virtual bool CheckStartCue(double currenttime);
232  virtual bool CheckEndCue(double currenttime);
234 
235 private:
236  vtkAnimationCue(const vtkAnimationCue&) = delete;
237  void operator=(const vtkAnimationCue&) = delete;
238 };
239 
240 VTK_ABI_NAMESPACE_END
241 #endif
a seqin an animation.
static vtkAnimationCue * New()
~vtkAnimationCue() override
void SetTimeModeToRelative()
Get/Set the time mode.
void SetTimeModeToNormalized()
Get/Set the time mode.
virtual void StartCueInternal()
These are the internal methods that actually trigger they corresponding events.
virtual void EndCueInternal()
These are the internal methods that actually trigger they corresponding events.
virtual bool CheckEndCue(double currenttime)
These test the start, end time variables with current time to decide whether the animation can begin ...
virtual void Initialize()
Called when the playing of the scene begins.
virtual void Finalize()
Called when the scene reaches the end.
vtkSetEnumMacro(Direction, PlayDirection)
Set/get the direction of playback.
virtual bool CheckStartCue(double currenttime)
These test the start, end time variables with current time to decide whether the animation can begin ...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int CueState
Current state of the Cue.
virtual void TickInternal(double currenttime, double deltatime, double clocktime)
These are the internal methods that actually trigger they corresponding events.
virtual void SetTimeMode(int mode)
Get/Set the time mode.
virtual void Tick(double currenttime, double deltatime, double clocktime)
Indicates a tick or point in time in the animation.
vtkGetEnumMacro(Direction, PlayDirection)
Set/get the direction of playback.
a simple class to control print indentation
Definition: vtkIndent.h:29
abstract base class for most VTK objects
Definition: vtkObject.h:52
@ mode
Definition: vtkX3D.h:247