22 #ifndef ANIMATIONPARAMS_H
23 #define ANIMATIONPARAMS_H
27 #include <vapor/common.h>
56 if (keyframingEnabled()&&getLoadedViewpoints().size() > 0){
57 return currentInterpolatedFrame;
59 return currentTimestep;
65 if (keyframingEnabled()&&getLoadedViewpoints().size() > 0){
66 return loadedTimesteps[currentInterpolatedFrame];
68 return currentTimestep;
74 if (keyframingEnabled())
return startKeyframeFrame;
81 if (keyframingEnabled())
return endKeyframeFrame;
96 if (keyframingEnabled())
return 0;
103 if (keyframingEnabled())
return (loadedViewpoints.size()-1);
121 void deleteAnyKeyframe(
int index);
123 void deleteEditableKeyframe(
int editableIndex);
124 void rescaleKeyframes(
const float ratio[3]);
126 void insertEditableKeyframe(
int editableIndex,
Keyframe* keyframe);
128 void insertHiddenKeyframe(
int index,
Keyframe* keyframe);
130 assert(mapEditableIndex[0] == 0);
131 return mapEditableIndex[editableIndex];
134 int getEditableIndex(
int index);
138 void enableKeyframing(
bool onoff);
143 #ifndef DOXYGEN_SKIP_THIS
146 void buildViewsAndTimes();
147 const vector<Viewpoint*> getLoadedViewpoints() {
return loadedViewpoints;}
148 void clearLoadedViewpoints();
149 int getNumLoadedViewpoints(){
return loadedViewpoints.size();}
151 const Viewpoint* getLoadedViewpoint(
int framenum){
152 return (loadedViewpoints[framenum%loadedViewpoints.size()]);
154 vector<size_t> getLoadedTimesteps() {
return loadedTimesteps;}
156 static ParamsBase* CreateDefaultInstance() {
return new AnimationParams(-1);}
157 const std::string& getShortName() {
return _shortName;}
158 virtual Params* deepCopy(ParamNode* n = 0);
160 virtual void restart();
161 static void setDefaultPrefs();
162 virtual bool reinit(
bool doOverride);
164 bool isPlaying() {
return (playDirection != 0);}
167 int getMinTimeToRender() {
return ((
int)(1000.f/maxFrameRate) );}
170 int getPlayDirection() {
return playDirection;}
171 int getFrameStepSize() {
return frameStepSize;}
172 float getMaxFrameRate() {
return maxFrameRate;}
173 void setCurrentInterpolatedFrame(
int val){
174 currentInterpolatedFrame=val;
176 int getCurrentInterpolatedFrame(){
177 return currentInterpolatedFrame;
179 int getFrameIndex(
int keyframeIndex);
180 void setCurrentFrameNumber(
int val) {
181 if (keyframingEnabled())
182 currentInterpolatedFrame = val;
184 currentTimestep = val;
186 void setStartFrameNumber(
int val) {
187 if (keyframingEnabled()){
188 startKeyframeFrame=val;
193 void setEndFrameNumber(
int val) {
194 if (keyframingEnabled()){
195 endKeyframeFrame=val;
196 if (val == getLoadedViewpoints().size()-1) endFrameIsDefault =
true;
197 else endFrameIsDefault=
false;
204 bool isRepeating() {
return repeatPlay;}
205 void setRepeating(
bool onOff){repeatPlay = onOff;}
206 void setFrameStepSize(
int sz){ frameStepSize = sz;}
207 void setMaxFrameRate(
float val) {maxFrameRate = val;}
208 void setPlayDirection(
int val){stateChanged =
true; playDirection = val;}
209 bool isStateChanged() {
return stateChanged;}
211 void setStateChanged(
bool state) {stateChanged = state;}
213 static float getDefaultMaxFPS() {
return defaultMaxFPS;}
215 static void setDefaultMaxFPS(
float val) {defaultMaxFPS = val;}
222 bool checkLastFrame();
223 int getNextFrame(
int dir);
224 bool usingTimestepList() {
return useTimestepSampleList;}
225 void setTimestepSampleList(
bool on) {useTimestepSampleList = on;}
226 std::vector<int>& getTimestepList() {
return timestepList;}
228 ParamNode* buildNode();
229 bool elementStartHandler(ExpatParseMgr*,
int , std::string& ,
const char ** );
230 bool elementEndHandler(ExpatParseMgr*,
int , std::string& );
233 vector<Viewpoint*>loadedViewpoints;
234 vector<size_t>loadedTimesteps;
236 static const string _shortName;
237 static const string _repeatAttr;
238 static const string _maxRateAttr;
239 static const string _stepSizeAttr;
240 static const string _startFrameAttr;
241 static const string _endFrameAttr;
242 static const string _startKeyframeFrameAttr;
243 static const string _endKeyframeFrameAttr;
244 static const string _currentFrameAttr;
245 static const string _currentInterpFrameAttr;
246 static const string _maxWaitAttr;
247 static const string _keyframesEnabledAttr;
248 static const string _keyframeTag;
249 static const string _keySpeedAttr;
250 static const string _keyTimestepAttr;
251 static const string _keyNumFramesAttr;
252 static const string _keySynchToTimestepsAttr;
253 static const string _keyTimestepsPerFrameAttr;
254 static const string _editableKeyMapTag;
264 int startKeyframeFrame;
265 int endKeyframeFrame;
266 bool endFrameIsDefault;
267 int maxTimestep, minTimestep;
268 int currentInterpolatedFrame;
270 bool useTimestepSampleList;
271 std::vector<int> timestepList;
275 static float defaultMaxFPS;
279 std::vector<Keyframe*> keyframes;
281 std::vector<long> mapEditableIndex;
289 Keyframe(Viewpoint* vp,
float spd,
int ts,
int fnum){
303 #endif //ANIMATIONPARAMS_H
A pure virtual class for managing parameters used in visualization.
int getNumEditableKeyframes()
void setMaxTimestep(int maxF)
void setMinTimestep(int minF)
Keyframe * getAnyKeyframe(int index)
int getCurrentFrameNumber()
A class that specifies parameters used in animation.
Keyframe(Viewpoint *vp, float spd, int ts, int fnum)
int getTotalNumKeyframes()
Keyframe * getEditableKeyframe(int editableIndex)
void setAnyKeyframe(int index, Keyframe *k)
int getStartFrameNumber()
int getTotalKeyframeIndex(int editableIndex)
vector< Keyframe * > & getAllKeyframes()