hrawanim.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Jani_p $*
  29. * *
  30. * $Modtime:: 6/27/01 7:50p $*
  31. * *
  32. * $Revision:: 2 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #if defined(_MSC_VER)
  38. #pragma once
  39. #endif
  40. #ifndef HRAWANIM_H
  41. #define HRAWANIM_H
  42. #include "always.h"
  43. #include "hanim.h"
  44. /**********************************************************************************
  45. HRawAnimClass
  46. Stores motion data to be applied to a HierarchyTree. Each frame
  47. of the motion contains deltas from the HierarchyTree's base position
  48. to the desired position.
  49. **********************************************************************************/
  50. class HRawAnimClass : public HAnimClass
  51. {
  52. public:
  53. enum
  54. {
  55. OK,
  56. LOAD_ERROR
  57. };
  58. HRawAnimClass(void);
  59. ~HRawAnimClass(void);
  60. int Load_W3D(ChunkLoadClass & cload);
  61. const char * Get_Name(void) const { return Name; }
  62. const char * Get_HName(void) const { return HierarchyName; }
  63. int Get_Num_Frames(void) { return NumFrames; }
  64. float Get_Frame_Rate() { return FrameRate; }
  65. float Get_Total_Time() { return (float)NumFrames / FrameRate; }
  66. // Vector3 Get_Translation(int pividx,float frame);
  67. // Quaternion Get_Orientation(int pividx,float frame);
  68. void Get_Translation(Vector3& translation, int pividx,float frame) const;
  69. void Get_Orientation(Quaternion& orientation, int pividx,float frame) const;
  70. void Get_Transform(Matrix3D& transform, int pividx,float frame) const;
  71. bool Get_Visibility(int pividx,float frame);
  72. bool Is_Node_Motion_Present(int pividx);
  73. int Get_Num_Pivots(void) const { return NumNodes; }
  74. // Methods that test the presence of a certain motion channel.
  75. bool Has_X_Translation (int pividx);
  76. bool Has_Y_Translation (int pividx);
  77. bool Has_Z_Translation (int pividx);
  78. bool Has_Rotation (int pividx);
  79. bool Has_Visibility (int pividx);
  80. private:
  81. char Name[2*W3D_NAME_LEN];
  82. char HierarchyName[W3D_NAME_LEN];
  83. int NumFrames;
  84. int NumNodes;
  85. float FrameRate;
  86. NodeMotionStruct * NodeMotion;
  87. void Free(void);
  88. bool read_channel(ChunkLoadClass & cload,MotionChannelClass * * newchan,bool pre30);
  89. void add_channel(MotionChannelClass * newchan);
  90. bool read_bit_channel(ChunkLoadClass & cload,BitChannelClass * * newchan,bool pre30);
  91. void add_bit_channel(BitChannelClass * newchan);
  92. };
  93. #endif