177void HRawAnimClass::Free(
void)
179 if (NodeMotion !=
NULL) {
234 strcat(Name,aheader.
Name);
243 if (base_pose ==
NULL) {
252 if (NodeMotion ==
NULL) {
267 if (!read_channel(cload,&newchan,pre30)) {
275 add_channel(newchan);
277 WWDEBUG_SAY((
"Animation %s referring to missing Bone! Please re-export.\n",Name));
283 if (!read_bit_channel(cload,&newbitchan,pre30)) {
290 if (newbitchan->
Get_Pivot() < NumNodes) {
291 add_bit_channel(newbitchan);
293 WWDEBUG_SAY((
"Animation %s referring to missing Bone! Please re-export.\n",Name));
328 bool result = (*newchan)->
Load_W3D(cload);
330 if (result && pre30) {
332 (*newchan)->Set_Pivot((*newchan)->Get_Pivot()+1);
357 NodeMotion[idx].X = newchan;
361 NodeMotion[idx].Y = newchan;
365 NodeMotion[idx].Z = newchan;
369 NodeMotion[idx].XR = newchan;
373 NodeMotion[idx].YR = newchan;
377 NodeMotion[idx].ZR = newchan;
381 NodeMotion[idx].Q = newchan;
402 *newchan =
W3DNEW BitChannelClass;
403 bool result = (*newchan)->
Load_W3D(cload);
405 if (result && pre30) {
406 (*newchan)->PivotIdx += 1;
432 NodeMotion[idx].Vis = newchan;
453 if ( (motion->
X ==
NULL) && (motion->
Y ==
NULL) && (motion->
Z ==
NULL) ) {
454 trans.
Set(0.0f,0.0f,0.0f);
461 int frame1 = frame0 + 1;
463 float ratio = frame - (float)frame0;
466 if ( frame1 >= NumFrames ) {
470 Vector3 trans0(0.0f,0.0f,0.0f);
472 if (motion->
X !=
NULL) {
475 if (motion->
Y !=
NULL) {
478 if (motion->
Z !=
NULL) {
482 if ( ratio == 0.0f ) {
487 Vector3 trans1(0.0f,0.0f,0.0f);
489 if (motion->
X !=
NULL) {
492 if (motion->
Y !=
NULL) {
495 if (motion->
Z !=
NULL) {
518 int frame1 = frame0 + 1;
520 float ratio = frame - (float)frame0;
523 if ( frame1 >= NumFrames )
528#ifdef SPECIAL_GETVEC_AS_QUAT
548 else if ( ratio == 1.0f )
561 if (NodeMotion[pividx].Q !=
NULL) {
562 NodeMotion[pividx].Q->Get_Vector((
int)frame0,vals);
563 q0.
Set(vals[0],vals[1],vals[2],vals[3]);
566 if ( ratio == 0.0f ) {
572 if (NodeMotion[pividx].Q !=
NULL) {
573 NodeMotion[pividx].Q->Get_Vector((
int)frame1,vals);
574 q1.
Set(vals[0],vals[1],vals[2],vals[3]);
604 int frame1 = frame0 + 1;
606 float ratio = frame - (float)frame0;
609 if ( frame1 >= NumFrames ) {
615 if (NodeMotion[pividx].Q !=
NULL) {
616 NodeMotion[pividx].Q->Get_Vector((
int)frame0,vals);
617 q0.
Set(vals[0],vals[1],vals[2],vals[3]);
620 if ( ratio == 0.0f ) {
629 if (NodeMotion[pividx].Q !=
NULL) {
630 NodeMotion[pividx].Q->Get_Vector((
int)frame1,vals);
631 q1.
Set(vals[0],vals[1],vals[2],vals[3]);
638 Vector3 trans0(0.0f,0.0f,0.0f);
643 Vector3 trans1(0.0f,0.0f,0.0f);
668 if (NodeMotion[pividx].Vis !=
NULL) {
669 return (NodeMotion[pividx].Vis->Get_Bit((
int)frame) == 1);
691 WWASSERT((pividx >= 0) && (pividx < NumNodes));
693 if (NodeMotion[pividx].X !=
NULL)
return true;
694 if (NodeMotion[pividx].Y !=
NULL)
return true;
695 if (NodeMotion[pividx].Z !=
NULL)
return true;
696 if (NodeMotion[pividx].XR !=
NULL)
return true;
697 if (NodeMotion[pividx].YR !=
NULL)
return true;
698 if (NodeMotion[pividx].ZR !=
NULL)
return true;
699 if (NodeMotion[pividx].Q !=
NULL)
return true;
700 if (NodeMotion[pividx].Vis !=
NULL)
return true;
707 WWASSERT((pividx >= 0) && (pividx < NumNodes));
708 return NodeMotion[pividx].X !=
NULL;
713 WWASSERT((pividx >= 0) && (pividx < NumNodes));
714 return NodeMotion[pividx].Y !=
NULL;
719 WWASSERT((pividx >= 0) && (pividx < NumNodes));
720 return NodeMotion[pividx].Z !=
NULL;
725 WWASSERT((pividx >= 0) && (pividx < NumNodes));
726 return NodeMotion[pividx].Q !=
NULL;
731 WWASSERT((pividx >= 0) && (pividx < NumNodes));
732 return NodeMotion[pividx].Vis !=
NULL;
@ W3D_CHUNK_ANIMATION_HEADER
@ W3D_CHUNK_ANIMATION_CHANNEL
#define W3D_MAKE_VERSION(major, minor)
bool Load_W3D(ChunkLoadClass &cload)
WWINLINE int Get_Type(void) const
WWINLINE int Get_Pivot(void) const
uint32 Read(void *buf, uint32 nbytes)
bool Has_Y_Translation(int pividx)
bool Is_Node_Motion_Present(int pividx)
bool Has_X_Translation(int pividx)
bool Has_Z_Translation(int pividx)
void Get_Transform(Matrix3D &transform, int pividx, float frame) const
void Get_Orientation(Quaternion &orientation, int pividx, float frame) const
bool Has_Rotation(int pividx)
int Load_W3D(ChunkLoadClass &cload)
void Get_Translation(Vector3 &translation, int pividx, float frame) const
bool Has_Visibility(int pividx)
bool Get_Visibility(int pividx, float frame)
WWINLINE int Num_Pivots(void) const
WWINLINE void Set_Translation(const Vector3 &t)
WWINLINE int Get_Type(void) const
bool Load_W3D(ChunkLoadClass &cload)
WWINLINE void Get_Vector_As_Quat(int frame, Quaternion &quat) const
WWINLINE int Get_Pivot(void) const
void Get_Vector(int frame, float *setvec) const
WWINLINE void Set(float a=0.0, float b=0.0, float c=0.0, float d=1.0)
WWINLINE void Set(float x, float y, float z)
static void Lerp(const Vector3 &a, const Vector3 &b, float alpha, Vector3 *set_result)
static WW3DAssetManager * Get_Instance(void)
virtual HTreeClass * Get_HTree(const char *name)
static long Float_To_Long(float f)
void __cdecl Fast_Slerp(Quaternion &res, const Quaternion &p, const Quaternion &q, float alpha)
Matrix3D & Build_Matrix3D(const Quaternion &q, Matrix3D &out)