10 #ifndef _H_HBhvInterpolator_H
11 #define _H_HBhvInterpolator_H
23 class HUtilityXMLGenerator;
27 template class MVO_API VArray< HKeyframe *>;
28 template class MVO_API VArray< void *>;
35 enum TrailInterpolatorType
43 #define REPLACE_VARRAY(c, pos) { if ((int)m_pArray.Count() > pos) \
45 HKeyframe *temp = m_pArray[pos];\
48 m_pArray.ReplaceAt(c, pos); }
50 #define REMOVE_VARRAY(pos) { HKeyframe *temp = m_pArray[pos];\
52 m_pArray.RemoveAt(pos); }
54 #define CURVE_ARRAY(pos) ((HKeyframeChannelCurve *)GetAt(pos))
76 virtual const char *
GetType() = 0;
117 void Remove(
int pos) { REMOVE_VARRAY(pos); }
143 void Duplicate(
int pos,
bool replace,
bool next);
151 void Copy(
int pos,
int adpos,
bool replace);
157 UNREFERENCED(xmlgen);
166 UNREFERENCED(keyframe);
167 UNREFERENCED(fraction);
170 virtual void Evaluate(
int keyframe,
float fraction,
bool &hasPos,
HPoint &pos,
bool &hasQuat,
HQuat &quat,
bool &hasScale,
HPoint &scale) {
171 UNREFERENCED(keyframe);
172 UNREFERENCED(fraction);
173 UNREFERENCED(hasPos);
175 UNREFERENCED(hasQuat);
177 UNREFERENCED(hasScale);
193 void GetTranslationFromMatrix(
HPoint &translation);
198 void GetRotationFromMatrix(
HQuat &rotation);
216 void AddPositionToMatrix(
HPoint &trans);
222 void AddRotationToMatrix(
float rot[16]);
228 void AddScaleToMatrix(
HPoint &scale);
274 linear->
m_cp = pos; m_pArray.InsertAt(linear, l); }
282 c->
m_cp = pos; REPLACE_VARRAY(c, l) }
290 linear->
m_cp = pos; m_pArray.InsertAt(linear, l); }
298 c->
m_cp = pos; REPLACE_VARRAY(c, l) }
307 d->
m_cp = pos; m_pArray.InsertAt(d, l); }
312 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
316 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
323 virtual void Interpolate(
int keyframe,
float fraction);
325 virtual void Evaluate(
int keyframe,
float fraction,
bool &hasPos,
HPoint &pos,
bool &hasQuat,
HQuat &quat,
bool &hasScale,
HPoint &scale);
330 virtual void Reset();
338 virtual void CalculatePos(
int keyframe,
float fraction,
HPoint &res);
345 virtual void InterpolateCamera(
HPoint &pos,
bool simulate =
false);
351 virtual void InterpolateCamera2(
HPoint &pos,
bool simulate =
false);
357 virtual void CalculateAllTangents();
390 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
394 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
401 virtual void Interpolate(
int keyframe,
float fraction);
405 virtual void Reset();
411 void SetTrailType(TrailInterpolatorType tt) { m_TrailType = tt; }
412 void SetTrailColor(
const char *color) { strcpy(m_Color, color); }
413 void SetTrailWeight(
int weight) { m_Weight = weight; }
414 void SetTrailStyle(
const char *style) { strcpy(m_Style, style); }
419 char m_Color[MVO_SMALL_BUFFER_SIZE];
421 char m_Style[MVO_SMALL_BUFFER_SIZE];
445 void SetAxis(
float x,
float y,
float z) {m_axis.x = x; m_axis.y = y; m_axis.z = z; }
470 linear->
m_angle = angle; m_pArray.InsertAt(linear, l); }
478 c->
m_angle = angle; REPLACE_VARRAY(c, l); }
483 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
488 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
496 virtual void Interpolate(
int keyframe,
float fraction);
497 virtual void Evaluate(
int keyframe,
float fraction,
bool &hasPos,
HPoint &pos,
bool &hasQuat,
HQuat &quat,
bool &hasScale,
HPoint &scale);
536 color->
m_cp = pos; m_pArray.InsertAt(color, l); }
545 c->
m_cp = pos; REPLACE_VARRAY(c, l); }
550 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
555 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
560 void SetGeomType (
const char *geomtype);
569 void SetColorComponent (
const char *ColorComponent);
579 virtual void Interpolate(
int keyframe,
float fraction);
582 char m_ColorComponent[MVO_BUFFER_SIZE];
583 char m_GeomType[MVO_BUFFER_SIZE];
633 virtual void CalculatePos(
int keyframe,
float fraction,
HPoint &res);
640 virtual void CalculateAllTangents();
645 virtual void Reset();
672 scale->
m_cp = pos; m_pArray.InsertAt(scale, l); }
680 c->
m_cp = pos; REPLACE_VARRAY(c, l) }
685 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
690 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
697 virtual void Interpolate(
int keyframe,
float fraction);
698 void Evaluate(
int keyframe,
float fraction,
bool &hasPos,
HPoint &pos,
bool &hasQuat,
HQuat &quat,
bool &hasScale,
HPoint &scale);
706 virtual void InterpolateCamera(
HPoint &Scale,
bool simulate =
false);
711 virtual void InterpolateCamera2(
HPoint &Scale,
bool simulate =
false);
747 rot->
m_quat = q; m_pArray.InsertAt(rot, l); }
765 c->
m_quat = q; REPLACE_VARRAY(c, l); }
778 void AdjustQuaternions();
783 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
788 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
795 virtual void Interpolate(
int keyframe,
float fraction);
796 virtual void Evaluate(
int keyframe,
float fraction,
bool &hasPos,
HPoint &pos,
bool &hasQuat,
HQuat &quat,
bool &hasScale,
HPoint &scale);
804 virtual void CalculateQuat(
int keyframe,
float fraction,
HQuat &res);
813 virtual void InterpolateCamera(
HQuat &quat,
bool simulate =
false);
819 virtual void InterpolateCamera2(
HQuat &quat,
bool simulate =
false);
858 AttSwitch->
SetTarget(t); m_pArray.InsertAt(AttSwitch, l); }
867 c->
SetTarget(spath); REPLACE_VARRAY(c, l) }
872 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
877 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
884 virtual void Interpolate(
int keyframe,
float fraction);
928 VertexMorph->
SetTarget(mident); m_pArray.InsertAt(VertexMorph, l); }
930 VertexMorph->
SetTarget(mident); VertexMorph->m_bDiscrete =
true; m_pArray.InsertAt(VertexMorph, l); }
947 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
952 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
959 virtual void Interpolate(
int keyframe,
float fraction);
970 virtual void AddMorphData(
HPoint *md,
int pnum,
HBaseModel *model,
int pos = -1);
979 void *GetUserInfo(
char *target);
980 void * GetMorphData(
int i);
982 VArray < void *> m_pMorphData;
984 int m_MorphDataLength;
1023 ColorMorph->
SetTarget(mident); m_pArray.InsertAt(ColorMorph, l); }
1025 ColorMorph->
SetTarget(mident); ColorMorph->m_bDiscrete =
true; m_pArray.InsertAt(ColorMorph, l); }
1041 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
1046 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
1053 virtual void Interpolate(
int keyframe,
float fraction);
1071 virtual void AddMorphData(
HPoint *md,
int pnum,
HBaseModel *model,
int pos = -1);
1078 virtual void SetUseFIndex(
bool tf);
1082 void *GetUserInfo(
char *target);
1083 void * GetMorphData(
int i);
1084 VArray < void *> m_pMorphData;
1086 int m_MorphDataLength;
1124 SegSwitch->
SetTarget(t); m_pArray.InsertAt(SegSwitch, l); }
1133 c->
SetTarget(spath); REPLACE_VARRAY(c, l) }
1138 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
1143 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
1150 virtual void Interpolate(
int keyframe,
float fraction);
1155 virtual void Reset();
1193 InstanceCreate->
SetTarget(t,t2,t3); m_pArray.InsertAt(InstanceCreate, l); }
1202 c->
SetTarget(t,t2,t3); REPLACE_VARRAY(c, l) }
1207 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
1212 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
1219 virtual void Interpolate(
int keyframe,
float fraction);
1224 virtual void Reset();
1264 SegMove->
SetTarget(t); m_pArray.InsertAt(SegMove, l); }
1273 c->
SetTarget(spath); REPLACE_VARRAY(c, l) }
1278 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
1283 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
1290 virtual void Interpolate(
int keyframe,
float fraction);
1295 virtual void Reset();
1332 for (
int i=0;i<16;i++) rot->
m_matrix[i] = mat[i]; m_pArray.InsertAt(rot, l); }
1343 for (
int i=0;i<16;i++) c->
m_matrix[i] = q[i]; REPLACE_VARRAY(c, l); }
1349 virtual void Serialize(HUtilityXMLGenerator *xmlgen);
1354 static void *
XMLCallback(HUtilityXMLTag *xt,
bool open,
void *m_pExtraData);
1361 virtual void Interpolate(
int keyframe,
float fraction);
void Append(HKeyframe *piece)
Definition: HBhvInterpolator.h:111
void Replace(const char *spath, int l)
Definition: HBhvInterpolator.h:866
VArray< void * > GetMorphData()
Definition: HBhvInterpolator.h:973
void ReplaceLinear(HQuat q, int l)
Definition: HBhvInterpolator.h:772
void Insert(char *mident, int l=0)
Definition: HBhvInterpolator.h:1022
int m_Weight
Definition: HBhvInterpolator.h:420
The HKeyframe class is the base class for all keyframe types.
Definition: HBhvUtility.h:257
The HKeyframeAxisRotation class is used for rotations around an arbitrary axis.
Definition: HBhvUtility.h:647
The HKeyframeQuatSquad class is used for non-linear quaternion based rotation.
Definition: HBhvUtility.h:721
char m_Name[BHV_MAX_NAME_LENGTH]
Definition: HBhvAnimation.h:276
The HBhvInterpolatorColor class controls color attribute changes.
Definition: HBhvInterpolator.h:507
void ReplaceCurve(HPoint pos, int l)
Definition: HBhvInterpolator.h:297
virtual void Serialize(HUtilityXMLGenerator *xmlgen)
Definition: HBhvInterpolator.h:156
The HQuat class defines the data type of a Quaternion.
Definition: HBhvUtility.h:83
void Insert(HPoint pos, int l=0)
Definition: HBhvInterpolator.h:671
virtual const char * GetType()
Definition: HBhvAnimation.h:57
void Insert(char *t, int l=0)
Definition: HBhvInterpolator.h:1263
HBhvAnimation * m_pAnimation
Definition: HBhvInterpolator.h:233
HC_KEY m_trailKey
Definition: HBhvInterpolator.h:422
HQuat m_quat
Definition: HBhvUtility.h:755
void Replace(float angle, int l)
Definition: HBhvInterpolator.h:477
void Insert(char *mident, int l=0)
Definition: HBhvInterpolator.h:927
void Duplicate(int newkeyframe, int oldkeyframe)
void Insert(char *t, int l=0)
Definition: HBhvInterpolator.h:1123
HBhvAnimation * GetAnimation()
Definition: HBhvInterpolator.h:182
void Insert(char *t, char *t2, char *t3, int l=0)
Definition: HBhvInterpolator.h:1192
void Insert(HKeyframe *piece, int pos=0)
Definition: HBhvInterpolator.h:105
void InsertLinear(HPoint pos, int l=0)
Definition: HBhvInterpolator.h:273
void Replace(char *t, char *t2, char *t3, int l)
Definition: HBhvInterpolator.h:1201
float m_angle
Definition: HBhvUtility.h:682
void Replace(HQuat q, int l)
Definition: HBhvInterpolator.h:764
The HBhvInterpolatorVertexMorph class performs interpolation by interpolating the individual vertex p...
Definition: HBhvInterpolator.h:895
int GetMorphDataLength()
Definition: HBhvInterpolator.h:976
virtual int GetArrayLength()
Definition: HBhvInterpolator.h:134
#define BHV_MAX_NAME_LENGTH
Maximum Length of "Names" in animations.
Definition: HBhvUtility.h:41
virtual HKeyframe * GetAt(int pos)
Definition: HBhvInterpolator.h:127
void GetAxis(HPoint &axis)
Definition: HBhvInterpolator.h:450
The HBhvInterpolatorScale class controls scaling. This class can be used for camera interpolation as ...
Definition: HBhvInterpolator.h:623
void SetAnimation(HBhvAnimation *animation)
Definition: HBhvInterpolator.h:187
The HBhvInterpolatorQuatSquad class controls quaternion based rotation. This class can be used for ca...
Definition: HBhvInterpolator.h:718
HBhvInterpolator * m_pInterpolatorInstance
Definition: HBhvInterpolator.h:234
void Replace(HPoint pos, int l)
Definition: HBhvInterpolator.h:679
HPoint m_cp
Definition: HBhvUtility.h:356
The HBhvInterpolatorPosition class controls positional interpolation.
Definition: HBhvInterpolator.h:245
The HBhvInterpolatorInstanceCreate creates a new instance of the target object at the location in the...
Definition: HBhvInterpolator.h:1163
void InsertCurve(HPoint pos, int l=0)
Definition: HBhvInterpolator.h:289
void Replace(char *t, int l)
Definition: HBhvInterpolator.h:1035
The HBhvInterpolatorSegSwitch performs animation by switching on and off the visibility of segments...
Definition: HBhvInterpolator.h:1094
The HKeyframeChannelDiscrete class is used for discrete interpolation of positional values...
Definition: HBhvUtility.h:411
The HBhvInterpolatorColorMorph class performs an interpolation on the face colors of your target obje...
Definition: HBhvInterpolator.h:990
void Insert(float angle, int l=0)
Definition: HBhvInterpolator.h:469
The HBhvInterpolatorTrail class draws a line trail from one keyframe position to the next...
Definition: HBhvInterpolator.h:364
The HBhvInterpolator class is the abstract base class for all interpolator types. ...
Definition: HBhvInterpolator.h:64
void Replace(char *spath, int l)
Definition: HBhvInterpolator.h:1272
const char * GetName()
Definition: HBhvInterpolator.h:120
The HKeyframeString class is used for any string related keyframes.
Definition: HBhvUtility.h:863
float m_matrix[16]
Definition: HBhvUtility.h:800
The HKeyframeChannelCurve class is used for spline based interpolation of positional values...
Definition: HBhvUtility.h:462
void Insert(const char *t, int l=0)
Definition: HBhvInterpolator.h:857
The HBaseModel class is used to store and manage model information.
Definition: HBaseModel.h:47
void InsertLinear(HQuat q, int l=0)
Definition: HBhvInterpolator.h:755
void Insert(float *mat, int l=0)
Definition: HBhvInterpolator.h:1331
void SetTarget(const char *t1, const char *t2, const char *t3)
The HPoint class is the data type of a three-dimensional point.
Definition: HGlobals.h:121
HKeyframe ** GetArray()
Definition: HBhvInterpolator.h:131
virtual void Reset()
Definition: HBhvInterpolator.h:203
The HKeyframeChannelLinear class is used for linear interpolation of positional values.
Definition: HBhvUtility.h:364
HBhvAnimation * CreateInstance()
void SetTarget(const char *target)
virtual void Serialize(HUtilityXMLGenerator *xmlgen, HUtilityXMLTag *xmlt)
The HBhvAnimation class defines an animation.
Definition: HBhvAnimation.h:43
VArray< void * > GetMorphData()
Definition: HBhvInterpolator.h:1056
bool m_bLinear
Definition: HBhvUtility.h:640
void Insert(HQuat q, int l=0)
Definition: HBhvInterpolator.h:746
void Replace(float *q, int l)
Definition: HBhvInterpolator.h:1342
void Insert(HPoint pos, int l=0)
Definition: HBhvInterpolator.h:535
VArray< HKeyframe * > m_pArray
Definition: HBhvInterpolator.h:232
int GetMorphDataLength()
Definition: HBhvInterpolator.h:1059
static void * XMLCallback(HUtilityXMLTag *xt, bool open, void *m_pExtraData)
char * GetGeomType()
Definition: HBhvInterpolator.h:563
The HKeyframeString class is used for any string related keyframes.
Definition: HBhvUtility.h:814
void Replace(HPoint pos, int l)
Definition: HBhvInterpolator.h:544
void SetAxis(float x, float y, float z)
Definition: HBhvInterpolator.h:445
void Replace(char *spath, int l)
Definition: HBhvInterpolator.h:1132
The HBhvInterpolatorAttSwitch class switches attributes on segments.
Definition: HBhvInterpolator.h:830
virtual void Interpolate(int keyframe, float fraction)
Definition: HBhvInterpolator.h:165
void SetTarget(HBhvTargetObject *target)
The HKeyframeQuatSquad class is used for non-linear quaternion based rotation.
Definition: HBhvUtility.h:762
void ReplaceLinear(HPoint pos, int l)
Definition: HBhvInterpolator.h:281
void Replace(HKeyframe *c, int pos)
Definition: HBhvInterpolator.h:98
The HBhvInterpolatorMatrix class controls quaternion based rotation. This class can be used for camer...
Definition: HBhvInterpolator.h:1303
void Remove(int pos)
Definition: HBhvInterpolator.h:117
char * GetColorComponent()
Definition: HBhvInterpolator.h:572
void Replace(char *t, int l)
Definition: HBhvInterpolator.h:941
void InsertDiscrete(HPoint pos, int l=0)
Definition: HBhvInterpolator.h:306
The HBhvInterpolatorSegMove performs animation by switching on and off the visibility of segments...
Definition: HBhvInterpolator.h:1234
TrailInterpolatorType m_TrailType
Definition: HBhvInterpolator.h:418
The HBhvInterpolatorAxisRotate class controls rotation around an arbitrary axis.
Definition: HBhvInterpolator.h:432
HPoint m_axis
Definition: HBhvInterpolator.h:500
HC_KEY m_pTarget
Definition: HBhvInterpolator.h:235