Files
vb01/keyframeChannel.h
T
2021-10-19 19:06:41 +03:00

50 lines
1.1 KiB
C++

#ifndef KEYFRAME_CHANNEL_H
#define KEYFRAME_CHANNEL_H
#include <vector>
#include <string>
namespace vb01{
class Animatable;
struct KeyframeChannel{
enum Type{
POS_X,
POS_Y,
POS_Z,
ROT_W,
ROT_X,
ROT_Y,
ROT_Z,
SCALE_X,
SCALE_Y,
SCALE_Z,
SHAPE_KEY_MIN,
SHAPE_KEY_VALUE,
SHAPE_KEY_MAX
};
struct Keyframe{
enum Interpolation{CONSTANT, LINEAR, BEZIER};
float value, leftHandleValue, rightHandleValue, frame, leftHandleFrame, rightHandleFrame;
Interpolation interpolation;
};
Type type;
Animatable *animatable = nullptr;
std::vector<Keyframe> keyframes;
static float interpolateBezier(std::vector<float>, float);
static KeyframeChannel::Type getKeyframeChannelType(std::string);
static float interpolate(Keyframe, Keyframe, float);
static Keyframe findKeyframe(float, KeyframeChannel, bool);
static void transform();
};
typedef KeyframeChannel::Type KeyframeChannelType;
typedef KeyframeChannel::Keyframe Keyframe;
typedef KeyframeChannel::Keyframe::Interpolation KeyframeInterpolation;
}
#endif