hrawanim.cpp 31 KB

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