hrawanim.cpp 31 KB

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