TDME2 1.9.121
AnimationSetup.cpp
Go to the documentation of this file.
2
3#include <tdme/tdme.h>
5
8
9AnimationSetup::AnimationSetup(Model* model, const string& id, int32_t startFrame, int32_t endFrame, bool loop, const string& overlayFromNodeId, float speed)
10{
11 this->model = model;
12 this->id = id;
13 this->startFrame = startFrame;
14 this->endFrame = endFrame;
15 this->frames = (endFrame - startFrame) + 1;
16 this->loop = loop;
17 this->overlayFromNodeId = overlayFromNodeId;
18 this->speed = speed;
19}
20
21void AnimationSetup::setStartFrame(int32_t startFrame) {
22 this->startFrame = startFrame;
23 this->frames = (endFrame - startFrame) + 1;
24 if (this->frames <= 0) this->frames = 1;
25}
26
27void AnimationSetup::setEndFrame(int32_t endFrame) {
28 this->endFrame = endFrame;
29 this->frames = (endFrame - startFrame) + 1;
30 if (this->frames <= 0) this->frames = 1;
31}
32
34{
36}
37
38int64_t AnimationSetup::computeDuration(int32_t startFrame, int32_t endFrame)
39{
40 return static_cast<int64_t>(
41 static_cast<float>(endFrame - startFrame + 1) / model->getFPS() * 1000.0f
42 );
43}
void setEndFrame(int32_t endFrame)
Set end frame.
void setStartFrame(int32_t startFrame)
Set start frame.
Representation of a 3d model.
Definition: Model.h:32