hrawanim.cpp 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WW3D *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/hrawanim.cpp $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Jani_p $*
  29. * *
  30. * $Modtime:: 11/25/01 6:06p $*
  31. * *
  32. * $Revision:: 5 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * HRawAnimClass::HRawAnimClass -- constructor *
  37. * HRawAnimClass::~HRawAnimClass -- Destructor *
  38. * HRawAnimClass::Free -- De-allocates all memory in use *
  39. * HRawAnimClass::Load -- Loads hierarchy animation from a file *
  40. * HRawAnimClass::read_channel -- Reads in a single channel of motion *
  41. * HRawAnimClass::add_channel -- Adds a motion channel to the animation *
  42. * HRawAnimClass::Get_Translation -- returns the translation vector for the given frame *
  43. * HRawAnimClass::Get_Orientation -- returns a quaternion for the orientation of the pivot *
  44. * HRawAnimClass::Get_XRotation -- Returns the X euler angle for the given pivot, frame *
  45. * HRawAnimClass::Get_YRotation -- returns the Y Euler angle for the given pivot, frame *
  46. * HRawAnimClass::Get_ZRotation -- returns the Z Euler angle for the given pivot, frame *
  47. * HRawAnimClass::read_bit_channel -- read a bit channel from the file *
  48. * HRawAnimClass::add_bit_channel -- install a bit channel into the animation *
  49. * HRawAnimClass::Get_Visibility -- return visibility state for given pivot/frame *
  50. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  51. #include "hrawanim.h"
  52. #include "motchan.h"
  53. #include "chunkio.h"
  54. #include "assetmgr.h"
  55. #include "htree.h"
  56. /***********************************************************************************************
  57. * NodeMotionStruct::NodeMotionStruct -- constructor *
  58. * *
  59. * INPUT: *
  60. * *
  61. * OUTPUT: *
  62. * *
  63. * WARNINGS: *
  64. * *
  65. * HISTORY: *
  66. *=============================================================================================*/
  67. NodeMotionStruct::NodeMotionStruct() :
  68. X(NULL),
  69. Y(NULL),
  70. Z(NULL),
  71. XR(NULL),
  72. YR(NULL),
  73. ZR(NULL),
  74. Q(NULL),
  75. Vis(NULL)
  76. {
  77. }
  78. /***********************************************************************************************
  79. * NodeMotionStruct::~NodeMotionStruct -- destructor *
  80. * *
  81. * INPUT: *
  82. * *
  83. * OUTPUT: *
  84. * *
  85. * WARNINGS: *
  86. * *
  87. * HISTORY: *
  88. * 10/23/98 GTH : Created. *
  89. *=============================================================================================*/
  90. NodeMotionStruct::~NodeMotionStruct()
  91. {
  92. if (X != NULL) {
  93. delete X;
  94. }
  95. if (Y != NULL) {
  96. delete Y;
  97. }
  98. if (Z != NULL) {
  99. delete Z;
  100. }
  101. if (XR != NULL) {
  102. delete XR;
  103. }
  104. if (YR != NULL) {
  105. delete YR;
  106. }
  107. if (ZR != NULL) {
  108. delete ZR;
  109. }
  110. if (Q != NULL) {
  111. delete Q;
  112. }
  113. if (Vis != NULL) {
  114. delete Vis;
  115. }
  116. }
  117. /***********************************************************************************************
  118. * HRawAnimClass::HRawAnimClass -- constructor *
  119. * *
  120. * INPUT: *
  121. * *
  122. * OUTPUT: *
  123. * *
  124. * WARNINGS: *
  125. * *
  126. * HISTORY: *
  127. * 08/11/1997 GH : Created. *
  128. *=============================================================================================*/
  129. HRawAnimClass::HRawAnimClass(void) :
  130. NumFrames(0),
  131. NumNodes(0),
  132. FrameRate(0),
  133. NodeMotion(NULL)
  134. {
  135. memset(Name,0,W3D_NAME_LEN);
  136. memset(HierarchyName,0,W3D_NAME_LEN);
  137. }
  138. /***********************************************************************************************
  139. * HRawAnimClass::~HRawAnimClass -- Destructor *
  140. * *
  141. * INPUT: *
  142. * *
  143. * OUTPUT: *
  144. * *
  145. * WARNINGS: *
  146. * *
  147. * HISTORY: *
  148. * 08/11/1997 GH : Created. *
  149. *=============================================================================================*/
  150. HRawAnimClass::~HRawAnimClass(void)
  151. {
  152. Free();
  153. }
  154. /***********************************************************************************************
  155. * HRawAnimClass::Free -- De-allocates all memory in use *
  156. * *
  157. * INPUT: *
  158. * *
  159. * OUTPUT: *
  160. * *
  161. * WARNINGS: *
  162. * *
  163. * HISTORY: *
  164. * 08/11/1997 GH : Created. *
  165. *=============================================================================================*/
  166. void HRawAnimClass::Free(void)
  167. {
  168. if (NodeMotion != NULL) {
  169. delete[] NodeMotion;
  170. NodeMotion = NULL;
  171. }
  172. }
  173. /***********************************************************************************************
  174. * HRawAnimClass::Load -- Loads hierarchy animation from a file *
  175. * *
  176. * INPUT: *
  177. * *
  178. * OUTPUT: *
  179. * *
  180. * WARNINGS: *
  181. * *
  182. * HISTORY: *
  183. * 08/11/1997 GH : Created. *
  184. *=============================================================================================*/
  185. int HRawAnimClass::Load_W3D(ChunkLoadClass & cload)
  186. {
  187. bool pre30 = false;
  188. /*
  189. ** First make sure we release any memory in use
  190. */
  191. Free();
  192. /*
  193. ** Open the first chunk, it should be the animation header
  194. */
  195. if (!cload.Open_Chunk()) return LOAD_ERROR;
  196. if (cload.Cur_Chunk_ID() != W3D_CHUNK_ANIMATION_HEADER) {
  197. // ERROR: Expected Animation Header!
  198. return LOAD_ERROR;
  199. }
  200. W3dAnimHeaderStruct aheader;
  201. if (cload.Read(&aheader,sizeof(W3dAnimHeaderStruct)) != sizeof(W3dAnimHeaderStruct)) {
  202. return LOAD_ERROR;
  203. }
  204. cload.Close_Chunk();
  205. /*
  206. ** Check if the animation version is pre-3.0. If so, we need to add 1 to all of the
  207. ** bone indexes. In version 3.0 onward, all htree's use bone 0 as the root node.
  208. */
  209. if (aheader.Version < W3D_MAKE_VERSION(3,0)) {
  210. pre30 = true;
  211. }
  212. strcpy(Name,aheader.HierarchyName);
  213. strcat(Name,".");
  214. strcat(Name,aheader.Name);
  215. // TSS chasing crash bug 05/26/99
  216. WWASSERT(HierarchyName != NULL);
  217. WWASSERT(aheader.HierarchyName != NULL);
  218. WWASSERT(sizeof(HierarchyName) >= W3D_NAME_LEN);
  219. strncpy(HierarchyName,aheader.HierarchyName,W3D_NAME_LEN);
  220. HTreeClass * base_pose = WW3DAssetManager::Get_Instance()->Get_HTree(HierarchyName);
  221. if (base_pose == NULL) {
  222. goto Error;
  223. }
  224. NumNodes = base_pose->Num_Pivots();
  225. NumFrames = aheader.NumFrames;
  226. FrameRate = aheader.FrameRate;
  227. NodeMotion = W3DNEWARRAY NodeMotionStruct[ NumNodes ];
  228. if (NodeMotion == NULL) {
  229. goto Error;
  230. }
  231. /*
  232. ** Now, read in all of the other chunks (motion channels).
  233. */
  234. MotionChannelClass * newchan;
  235. BitChannelClass * newbitchan;
  236. while (cload.Open_Chunk()) {
  237. switch (cload.Cur_Chunk_ID()) {
  238. case W3D_CHUNK_ANIMATION_CHANNEL:
  239. if (!read_channel(cload,&newchan,pre30)) {
  240. goto Error;
  241. }
  242. // (gth) if the channel is referring to a node which is outside the range,
  243. // just throw away the channel. This probably means the animation must
  244. // be re-exported
  245. if (newchan->Get_Pivot() < NumNodes) {
  246. add_channel(newchan);
  247. } else {
  248. WWDEBUG_SAY(("Animation %s referring to missing Bone! Please re-export.\n",Name));
  249. delete newchan;
  250. }
  251. break;
  252. case W3D_CHUNK_BIT_CHANNEL:
  253. if (!read_bit_channel(cload,&newbitchan,pre30)) {
  254. goto Error;
  255. }
  256. // (gth) if the channel is referring to a node which is outside the range,
  257. // just throw away the channel. This probably means the animation must
  258. // be re-exported
  259. if (newbitchan->Get_Pivot() < NumNodes) {
  260. add_bit_channel(newbitchan);
  261. } else {
  262. WWDEBUG_SAY(("Animation %s referring to missing Bone! Please re-export.\n",Name));
  263. delete newbitchan;
  264. }
  265. break;
  266. default:
  267. break;
  268. }
  269. cload.Close_Chunk();
  270. }
  271. return OK;
  272. Error:
  273. Free();
  274. return LOAD_ERROR;
  275. }
  276. /***********************************************************************************************
  277. * HRawAnimClass::read_channel -- Reads in a single channel of motion *
  278. * *
  279. * INPUT: *
  280. * *
  281. * OUTPUT: *
  282. * *
  283. * WARNINGS: *
  284. * *
  285. * HISTORY: *
  286. * 08/11/1997 GH : Created. *
  287. *=============================================================================================*/
  288. bool HRawAnimClass::read_channel(ChunkLoadClass & cload,MotionChannelClass * * newchan,bool pre30)
  289. {
  290. *newchan = W3DNEW MotionChannelClass;
  291. bool result = (*newchan)->Load_W3D(cload);
  292. if (result && pre30) {
  293. // (*newchan)->PivotIdx += 1;
  294. (*newchan)->Set_Pivot((*newchan)->Get_Pivot()+1);
  295. }
  296. return result;
  297. }
  298. /***********************************************************************************************
  299. * HRawAnimClass::add_channel -- Adds a motion channel to the animation *
  300. * *
  301. * INPUT: *
  302. * *
  303. * OUTPUT: *
  304. * *
  305. * WARNINGS: *
  306. * *
  307. * HISTORY: *
  308. * 08/11/1997 GH : Created. *
  309. *=============================================================================================*/
  310. void HRawAnimClass::add_channel(MotionChannelClass * newchan)
  311. {
  312. int idx = newchan->Get_Pivot();
  313. switch (newchan->Get_Type())
  314. {
  315. case ANIM_CHANNEL_X:
  316. NodeMotion[idx].X = newchan;
  317. break;
  318. case ANIM_CHANNEL_Y:
  319. NodeMotion[idx].Y = newchan;
  320. break;
  321. case ANIM_CHANNEL_Z:
  322. NodeMotion[idx].Z = newchan;
  323. break;
  324. case ANIM_CHANNEL_XR:
  325. NodeMotion[idx].XR = newchan;
  326. break;
  327. case ANIM_CHANNEL_YR:
  328. NodeMotion[idx].YR = newchan;
  329. break;
  330. case ANIM_CHANNEL_ZR:
  331. NodeMotion[idx].ZR = newchan;
  332. break;
  333. case ANIM_CHANNEL_Q:
  334. NodeMotion[idx].Q = newchan;
  335. break;
  336. }
  337. }
  338. /***********************************************************************************************
  339. * HRawAnimClass::read_bit_channel -- read a bit channel from the file *
  340. * *
  341. * INPUT: *
  342. * *
  343. * OUTPUT: *
  344. * *
  345. * WARNINGS: *
  346. * *
  347. * HISTORY: *
  348. * 1/19/98 GTH : Created. *
  349. *=============================================================================================*/
  350. bool HRawAnimClass::read_bit_channel(ChunkLoadClass & cload,BitChannelClass * * newchan,bool pre30)
  351. {
  352. *newchan = W3DNEW BitChannelClass;
  353. bool result = (*newchan)->Load_W3D(cload);
  354. if (result && pre30) {
  355. (*newchan)->PivotIdx += 1;
  356. }
  357. return result;
  358. }
  359. /***********************************************************************************************
  360. * HRawAnimClass::add_bit_channel -- install a bit channel into the animation *
  361. * *
  362. * INPUT: *
  363. * *
  364. * OUTPUT: *
  365. * *
  366. * WARNINGS: *
  367. * *
  368. * HISTORY: *
  369. * 1/19/98 GTH : Created. *
  370. *=============================================================================================*/
  371. void HRawAnimClass::add_bit_channel(BitChannelClass * newchan)
  372. {
  373. int idx = newchan->Get_Pivot();
  374. switch (newchan->Get_Type())
  375. {
  376. case BIT_CHANNEL_VIS:
  377. NodeMotion[idx].Vis = newchan;
  378. break;
  379. }
  380. }
  381. /***********************************************************************************************
  382. * HRawAnimClass::Get_Translation -- returns the translation vector for the given fr *
  383. * *
  384. * INPUT: *
  385. * *
  386. * OUTPUT: *
  387. * *
  388. * WARNINGS: *
  389. * *
  390. * HISTORY: *
  391. * 08/11/1997 GH : Created. *
  392. *=============================================================================================*/
  393. void HRawAnimClass::Get_Translation(Vector3& trans, int pividx, float frame ) const
  394. {
  395. struct NodeMotionStruct * motion = &NodeMotion[pividx];
  396. if ( (motion->X == NULL) && (motion->Y == NULL) && (motion->Z == NULL) ) {
  397. trans.Set(0.0f,0.0f,0.0f);
  398. return;
  399. }
  400. // int frame0 = (int)frame;
  401. int frame0=WWMath::Float_To_Long(frame-0.499999f);
  402. int frame1 = frame0 + 1;
  403. float ratio = frame - (float)frame0;
  404. WWASSERT( (ratio >= -WWMATH_EPSILON) && (ratio < 1.0f + WWMATH_EPSILON) );
  405. if ( frame1 >= NumFrames ) {
  406. frame1 = 0;
  407. }
  408. Vector3 trans0(0.0f,0.0f,0.0f);
  409. if (motion->X != NULL) {
  410. motion->X->Get_Vector((int)frame0,&(trans0[0]));
  411. }
  412. if (motion->Y != NULL) {
  413. motion->Y->Get_Vector((int)frame0,&(trans0[1]));
  414. }
  415. if (motion->Z != NULL) {
  416. motion->Z->Get_Vector((int)frame0,&(trans0[2]));
  417. }
  418. if ( ratio == 0.0f ) {
  419. trans=trans0;
  420. return;
  421. }
  422. Vector3 trans1(0.0f,0.0f,0.0f);
  423. if (motion->X != NULL) {
  424. motion->X->Get_Vector((int)frame1,&(trans1[0]));
  425. }
  426. if (motion->Y != NULL) {
  427. motion->Y->Get_Vector((int)frame1,&(trans1[1]));
  428. }
  429. if (motion->Z != NULL) {
  430. motion->Z->Get_Vector((int)frame1,&(trans1[2]));
  431. }
  432. Vector3::Lerp( trans0, trans1, ratio, &trans );
  433. }
  434. /***********************************************************************************************
  435. * HRawAnimClass::Get_Orientation -- returns a quaternion for the orientation of the *
  436. * *
  437. * INPUT: *
  438. * *
  439. * OUTPUT: *
  440. * *
  441. * WARNINGS: *
  442. * *
  443. * HISTORY: *
  444. * 08/11/1997 GH : Created. *
  445. *=============================================================================================*/
  446. void HRawAnimClass::Get_Orientation(Quaternion& q, int pividx,float frame) const
  447. {
  448. // int frame0 = (int)frame;
  449. int frame0 = WWMath::Float_To_Long(frame-0.499999f);
  450. int frame1 = frame0 + 1;
  451. float ratio = frame - (float)frame0;
  452. WWASSERT( (ratio >= -WWMATH_EPSILON) && (ratio < 1.0f + WWMATH_EPSILON) );
  453. if ( frame1 >= NumFrames )
  454. {
  455. frame1 = 0;
  456. }
  457. #ifdef SPECIAL_GETVEC_AS_QUAT
  458. Quaternion q0, q1;
  459. MotionChannelClass* mc = NodeMotion[pividx].Q;
  460. if (mc != NULL)
  461. {
  462. mc->Get_Vector_As_Quat((int)frame0, q0);
  463. mc->Get_Vector_As_Quat((int)frame1, q1);
  464. }
  465. else
  466. {
  467. q0.Set();
  468. q1.Set();
  469. }
  470. if ( ratio == 0.0f )
  471. {
  472. q = q0;
  473. }
  474. else if ( ratio == 1.0f )
  475. {
  476. q = q1;
  477. }
  478. else
  479. {
  480. Fast_Slerp(q, q0, q1, ratio);
  481. }
  482. #else
  483. float vals[4];
  484. Quaternion q0(1);
  485. if (NodeMotion[pividx].Q != NULL) {
  486. NodeMotion[pividx].Q->Get_Vector((int)frame0,vals);
  487. q0.Set(vals[0],vals[1],vals[2],vals[3]);
  488. }
  489. if ( ratio == 0.0f ) {
  490. q=q0;
  491. return;
  492. }
  493. Quaternion q1(1);
  494. if (NodeMotion[pividx].Q != NULL) {
  495. NodeMotion[pividx].Q->Get_Vector((int)frame1,vals);
  496. q1.Set(vals[0],vals[1],vals[2],vals[3]);
  497. }
  498. Fast_Slerp(q, q0, q1, ratio );
  499. #endif
  500. }
  501. /***********************************************************************************************
  502. * HRawAnimClass::Get_Transform -- returns the transform matrix for the given frame *
  503. * *
  504. * INPUT: *
  505. * *
  506. * OUTPUT: *
  507. * *
  508. * WARNINGS: *
  509. * *
  510. * HISTORY: *
  511. * 08/11/1997 GH : Created. *
  512. *=============================================================================================*/
  513. void HRawAnimClass::Get_Transform(Matrix3D& mtx, int pividx, float frame ) const
  514. {
  515. struct NodeMotionStruct * motion = &NodeMotion[pividx];
  516. // if ( (motion->X == NULL) && (motion->Y == NULL) && (motion->Z == NULL) ) {
  517. // trans.Set(0.0f,0.0f,0.0f);
  518. // return;
  519. // }
  520. int frame0=WWMath::Float_To_Long(frame-0.499999f);
  521. int frame1 = frame0 + 1;
  522. float ratio = frame - (float)frame0;
  523. WWASSERT( (ratio >= -WWMATH_EPSILON) && (ratio < 1.0f + WWMATH_EPSILON) );
  524. if ( frame1 >= NumFrames ) {
  525. frame1 = 0;
  526. }
  527. float vals[4];
  528. Quaternion q0(1);
  529. if (NodeMotion[pividx].Q != NULL) {
  530. NodeMotion[pividx].Q->Get_Vector((int)frame0,vals);
  531. q0.Set(vals[0],vals[1],vals[2],vals[3]);
  532. }
  533. if ( ratio == 0.0f ) {
  534. ::Build_Matrix3D(q0,mtx);
  535. if (motion->X != NULL) motion->X->Get_Vector((int)frame0,&(mtx[0][3]));
  536. if (motion->Y != NULL) motion->Y->Get_Vector((int)frame0,&(mtx[1][3]));
  537. if (motion->Z != NULL) motion->Z->Get_Vector((int)frame0,&(mtx[2][3]));
  538. return;
  539. }
  540. Quaternion q1(1);
  541. if (NodeMotion[pividx].Q != NULL) {
  542. NodeMotion[pividx].Q->Get_Vector((int)frame1,vals);
  543. q1.Set(vals[0],vals[1],vals[2],vals[3]);
  544. }
  545. Quaternion q;
  546. Fast_Slerp(q, q0, q1, ratio );
  547. ::Build_Matrix3D(q,mtx);
  548. Vector3 trans0(0.0f,0.0f,0.0f);
  549. if (motion->X != NULL) motion->X->Get_Vector((int)frame0,&(trans0[0]));
  550. if (motion->Y != NULL) motion->Y->Get_Vector((int)frame0,&(trans0[1]));
  551. if (motion->Z != NULL) motion->Z->Get_Vector((int)frame0,&(trans0[2]));
  552. Vector3 trans1(0.0f,0.0f,0.0f);
  553. if (motion->X != NULL) motion->X->Get_Vector((int)frame1,&(trans1[0]));
  554. if (motion->Y != NULL) motion->Y->Get_Vector((int)frame1,&(trans1[1]));
  555. if (motion->Z != NULL) motion->Z->Get_Vector((int)frame1,&(trans1[2]));
  556. Vector3 trans;
  557. Vector3::Lerp( trans0, trans1, ratio, &trans );
  558. mtx.Set_Translation(trans);
  559. }
  560. /***********************************************************************************************
  561. * HRawAnimClass::Get_Visibility -- return visibility state for given pivot/frame *
  562. * *
  563. * INPUT: *
  564. * *
  565. * OUTPUT: *
  566. * *
  567. * WARNINGS: *
  568. * *
  569. * HISTORY: *
  570. * 1/19/98 GTH : Created. *
  571. *=============================================================================================*/
  572. bool HRawAnimClass::Get_Visibility(int pividx,float frame)
  573. {
  574. if (NodeMotion[pividx].Vis != NULL) {
  575. return (NodeMotion[pividx].Vis->Get_Bit((int)frame) == 1);
  576. }
  577. // default to always visible...
  578. return 1;
  579. }
  580. /***********************************************************************************************
  581. * HRawAnimClass::Is_Node_Motion_Present -- return true if there is motion defined for this frame *
  582. * *
  583. * INPUT: *
  584. * *
  585. * OUTPUT: *
  586. * *
  587. * WARNINGS: *
  588. * *
  589. * HISTORY: *
  590. * 3/23/99 EHC : Created. *
  591. *=============================================================================================*/
  592. bool HRawAnimClass::Is_Node_Motion_Present(int pividx)
  593. {
  594. WWASSERT((pividx >= 0) && (pividx < NumNodes));
  595. if (NodeMotion[pividx].X != NULL) return true;
  596. if (NodeMotion[pividx].Y != NULL) return true;
  597. if (NodeMotion[pividx].Z != NULL) return true;
  598. if (NodeMotion[pividx].XR != NULL) return true;
  599. if (NodeMotion[pividx].YR != NULL) return true;
  600. if (NodeMotion[pividx].ZR != NULL) return true;
  601. if (NodeMotion[pividx].Q != NULL) return true;
  602. if (NodeMotion[pividx].Vis != NULL) return true;
  603. return false;
  604. }
  605. bool HRawAnimClass::Has_X_Translation (int pividx)
  606. {
  607. WWASSERT((pividx >= 0) && (pividx < NumNodes));
  608. return NodeMotion[pividx].X != NULL;
  609. }
  610. bool HRawAnimClass::Has_Y_Translation (int pividx)
  611. {
  612. WWASSERT((pividx >= 0) && (pividx < NumNodes));
  613. return NodeMotion[pividx].Y != NULL;
  614. }
  615. bool HRawAnimClass::Has_Z_Translation (int pividx)
  616. {
  617. WWASSERT((pividx >= 0) && (pividx < NumNodes));
  618. return NodeMotion[pividx].Z != NULL;
  619. }
  620. bool HRawAnimClass::Has_Rotation (int pividx)
  621. {
  622. WWASSERT((pividx >= 0) && (pividx < NumNodes));
  623. return NodeMotion[pividx].Q != NULL;
  624. }
  625. bool HRawAnimClass::Has_Visibility (int pividx)
  626. {
  627. WWASSERT((pividx >= 0) && (pividx < NumNodes));
  628. return NodeMotion[pividx].Vis != NULL;
  629. }