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);
118 void deleteKeyframe(
int index);
119 void rescaleKeyframes(
const float ratio[3]);
121 void insertKeyframe(
int index,
Keyframe* keyframe);
122 void insertViewpoint(
int index, Viewpoint* vp);
126 void enableKeyframing(
bool onoff);
130 #ifndef DOXYGEN_SKIP_THIS
133 void buildViewsAndTimes();
134 const vector<Viewpoint*> getLoadedViewpoints() {
return loadedViewpoints;}
135 void clearLoadedViewpoints();
136 int getNumLoadedViewpoints(){
return loadedViewpoints.size();}
137 void addViewpoint(Viewpoint* vp){loadedViewpoints.push_back(vp);}
138 void addTimestep(
size_t ts){loadedTimesteps.push_back(ts);}
139 const Viewpoint* getLoadedViewpoint(
int framenum){
140 return (loadedViewpoints[framenum%loadedViewpoints.size()]);
142 vector<size_t> getLoadedTimesteps() {
return loadedTimesteps;}
144 static ParamsBase* CreateDefaultInstance() {
return new AnimationParams(-1);}
145 const std::string& getShortName() {
return _shortName;}
146 virtual Params* deepCopy(ParamNode* n = 0);
148 virtual void restart();
149 static void setDefaultPrefs();
150 virtual bool reinit(
bool doOverride);
152 bool isPlaying() {
return (playDirection != 0);}
155 int getMinTimeToRender() {
return ((
int)(1000.f/maxFrameRate) );}
158 int getPlayDirection() {
return playDirection;}
159 int getFrameStepSize() {
return frameStepSize;}
160 float getMaxFrameRate() {
return maxFrameRate;}
161 void setCurrentInterpolatedFrame(
int val){
162 currentInterpolatedFrame=val;
164 int getCurrentInterpolatedFrame(){
165 return currentInterpolatedFrame;
167 int getFrameIndex(
int keyframeIndex);
168 void setCurrentFrameNumber(
int val) {
169 if (keyframingEnabled())
170 currentInterpolatedFrame = val;
172 currentTimestep = val;
174 void setStartFrameNumber(
int val) {
175 if (keyframingEnabled()){
176 startKeyframeFrame=val;
181 void setEndFrameNumber(
int val) {
182 if (keyframingEnabled()){
183 endKeyframeFrame=val;
184 if (val == getLoadedViewpoints().size()-1) endFrameIsDefault =
true;
185 else endFrameIsDefault=
false;
192 bool isRepeating() {
return repeatPlay;}
193 void setRepeating(
bool onOff){repeatPlay = onOff;}
194 void setFrameStepSize(
int sz){ frameStepSize = sz;}
195 void setMaxFrameRate(
float val) {maxFrameRate = val;}
196 void setPlayDirection(
int val){stateChanged =
true; playDirection = val;}
197 bool isStateChanged() {
return stateChanged;}
199 void setStateChanged(
bool state) {stateChanged = state;}
201 static float getDefaultMaxFPS() {
return defaultMaxFPS;}
203 static void setDefaultMaxFPS(
float val) {defaultMaxFPS = val;}
210 bool checkLastFrame();
211 int getNextFrame(
int dir);
212 bool usingTimestepList() {
return useTimestepSampleList;}
213 void setTimestepSampleList(
bool on) {useTimestepSampleList = on;}
214 std::vector<int>& getTimestepList() {
return timestepList;}
216 ParamNode* buildNode();
217 bool elementStartHandler(ExpatParseMgr*,
int , std::string& ,
const char ** );
218 bool elementEndHandler(ExpatParseMgr*,
int , std::string& );
221 vector<Viewpoint*>loadedViewpoints;
222 vector<size_t>loadedTimesteps;
224 static const string _shortName;
225 static const string _repeatAttr;
226 static const string _maxRateAttr;
227 static const string _stepSizeAttr;
228 static const string _startFrameAttr;
229 static const string _endFrameAttr;
230 static const string _startKeyframeFrameAttr;
231 static const string _endKeyframeFrameAttr;
232 static const string _currentFrameAttr;
233 static const string _currentInterpFrameAttr;
234 static const string _maxWaitAttr;
235 static const string _keyframesEnabledAttr;
236 static const string _keyframeTag;
237 static const string _keySpeedAttr;
238 static const string _keyTimestepAttr;
239 static const string _keyNumFramesAttr;
240 static const string _keySynchToTimestepsAttr;
241 static const string _keyTimestepsPerFrameAttr;
251 int startKeyframeFrame;
252 int endKeyframeFrame;
253 bool endFrameIsDefault;
254 int maxTimestep, minTimestep;
255 int currentInterpolatedFrame;
257 bool useTimestepSampleList;
258 std::vector<int> timestepList;
262 static float defaultMaxFPS;
266 std::vector<Keyframe*> keyframes;
274 Keyframe(Viewpoint* vp,
float spd,
int ts,
int fnum){
288 #endif //ANIMATIONPARAMS_H
A pure virtual class for managing parameters used in visualization.
void setMaxTimestep(int maxF)
void setMinTimestep(int minF)
int getCurrentFrameNumber()
A class that specifies parameters used in animation.
Keyframe(Viewpoint *vp, float spd, int ts, int fnum)
Keyframe * getKeyframe(int index)
vector< Keyframe * > & getKeyframes()
int getStartFrameNumber()