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
41 #ifndef vtkAnimationCue_h
42 #define vtkAnimationCue_h
43 
44 #include "vtkCommonCoreModule.h" // For export macro
45 #include "vtkObject.h"
46 
47 VTK_ABI_NAMESPACE_BEGIN
48 class VTKCOMMONCORE_EXPORT vtkAnimationCue : public vtkObject
49 {
50 public:
51  vtkTypeMacro(vtkAnimationCue, vtkObject);
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
54  static vtkAnimationCue* New();
55 
56  // Structure passed on every event invocation.
57  // Depending upon the cue time mode, these times are either
58  // normalized [0,1] or relative to the scene that contains the cue.
59  // All this information is also available by asking the cue
60  // directly for it within the handler. Thus, this information can
61  // be accessed in wrapped languages.
63  {
64  public:
65  double StartTime;
66  double EndTime;
67  double AnimationTime; // valid only in AnimationCueTickEvent handler
68  double DeltaTime; // valid only in AnimationCueTickEvent handler
69  double ClockTime; // valid only in AnimationCueTickEvent handler
70  };
71 
73 
80  virtual void SetTimeMode(int mode);
81  vtkGetMacro(TimeMode, int);
82  void SetTimeModeToRelative() { this->SetTimeMode(TIMEMODE_RELATIVE); }
83  void SetTimeModeToNormalized() { this->SetTimeMode(TIMEMODE_NORMALIZED); }
85 
87 
97  vtkSetMacro(StartTime, double);
98  vtkGetMacro(StartTime, double);
100 
102 
111  vtkSetMacro(EndTime, double);
112  vtkGetMacro(EndTime, double);
114 
133  virtual void Tick(double currenttime, double deltatime, double clocktime);
134 
139  virtual void Initialize();
140 
146  virtual void Finalize();
147 
149 
154  vtkGetMacro(AnimationTime, double);
156 
158 
163  vtkGetMacro(DeltaTime, double);
165 
167 
173  vtkGetMacro(ClockTime, double);
175 
177  {
178  TIMEMODE_NORMALIZED = 0,
179  TIMEMODE_RELATIVE = 1
180  };
181 
182  enum class PlayDirection
183  {
184  BACKWARD,
185  FORWARD,
186  };
187 
189 
195 
196 protected:
198  ~vtkAnimationCue() override;
199 
200  enum
201  {
202  UNINITIALIZED = 0,
204  ACTIVE
205  };
206 
207  double StartTime;
208  double EndTime;
209  int TimeMode;
210  PlayDirection Direction = PlayDirection::FORWARD;
211 
212  // These are set when the AnimationCueTickEvent event
213  // is fired. Thus giving access to the information in
214  // the AnimationCueInfo struct in wrapped languages.
216  double DeltaTime;
217  double ClockTime;
218 
222  int CueState;
223 
225 
230  virtual void StartCueInternal();
231  virtual void TickInternal(double currenttime, double deltatime, double clocktime);
232  virtual void EndCueInternal();
234 
236 
240  virtual bool CheckStartCue(double currenttime);
241  virtual bool CheckEndCue(double currenttime);
243 
244 private:
245  vtkAnimationCue(const vtkAnimationCue&) = delete;
246  void operator=(const vtkAnimationCue&) = delete;
247 };
248 
249 VTK_ABI_NAMESPACE_END
250 #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:38
abstract base class for most VTK objects
Definition: vtkObject.h:61
@ mode
Definition: vtkX3D.h:247