hcanim.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. /* $Header: /Commando/Code/ww3d2/hcanim.h 2 6/29/01 6:41p Jani_p $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando / G 3D Library *
  24. * *
  25. * $Archive:: /Commando/Code/ww3d2/hcanim.h $*
  26. * *
  27. * Author:: Greg_h *
  28. * *
  29. * $Modtime:: 6/27/01 7:35p $*
  30. * *
  31. * $Revision:: 2 $*
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #if defined(_MSC_VER)
  37. #pragma once
  38. #endif
  39. #ifndef HCANIM_H
  40. #define HCANIM_H
  41. #include "always.h"
  42. #include "quat.h"
  43. #include "refcount.h"
  44. #include "w3d_file.h"
  45. #include "slist.h"
  46. #include "vector.h"
  47. #include "hanim.h"
  48. struct NodeCompressedMotionStruct;
  49. class TimeCodedMotionChannelClass;
  50. class TimeCodedBitChannelClass;
  51. class AdaptiveDeltaMotionChannelClass;
  52. class HTreeClass;
  53. class ChunkLoadClass;
  54. class ChunkSaveClass;
  55. /**********************************************************************************
  56. Hierarchy Compressed Animation Class
  57. Stores motion data to be applied to a HierarchyTree. Each frame
  58. of the motion contains deltas from the HierarchyTree's base position
  59. to the desired position.
  60. **********************************************************************************/
  61. class HCompressedAnimClass : public HAnimClass
  62. {
  63. public:
  64. enum
  65. {
  66. OK,
  67. LOAD_ERROR
  68. };
  69. HCompressedAnimClass(void);
  70. ~HCompressedAnimClass(void);
  71. int Load_W3D(ChunkLoadClass & cload);
  72. const char * Get_Name(void) const { return Name; }
  73. const char * Get_HName(void) const { return HierarchyName; }
  74. int Get_Num_Frames(void) { return NumFrames; }
  75. float Get_Frame_Rate() { return FrameRate; }
  76. float Get_Total_Time() { return (float)NumFrames / FrameRate; }
  77. int Get_Flavor() { return Flavor; }
  78. // Vector3 Get_Translation(int pividx,float frame);
  79. // Quaternion Get_Orientation(int pividx,float frame);
  80. void Get_Translation(Vector3& translation, int pividx,float frame) const;
  81. void Get_Orientation(Quaternion& orientation, int pividx,float frame) const;
  82. void Get_Transform(Matrix3D& transform, int pividx,float frame) const;
  83. bool Get_Visibility(int pividx,float frame);
  84. bool Is_Node_Motion_Present(int pividx);
  85. int Get_Num_Pivots(void) const { return NumNodes; }
  86. // Methods that test the presence of a certain motion channel.
  87. bool Has_X_Translation (int pividx);
  88. bool Has_Y_Translation (int pividx);
  89. bool Has_Z_Translation (int pividx);
  90. bool Has_Rotation (int pividx);
  91. bool Has_Visibility (int pividx);
  92. private:
  93. char Name[2*W3D_NAME_LEN];
  94. char HierarchyName[W3D_NAME_LEN];
  95. int NumFrames;
  96. int NumNodes;
  97. int Flavor;
  98. float FrameRate;
  99. NodeCompressedMotionStruct * NodeMotion;
  100. void Free(void);
  101. bool read_channel(ChunkLoadClass & cload,TimeCodedMotionChannelClass * * newchan);
  102. bool read_channel(ChunkLoadClass & cload,AdaptiveDeltaMotionChannelClass * * newchan);
  103. void add_channel(TimeCodedMotionChannelClass * newchan);
  104. void add_channel(AdaptiveDeltaMotionChannelClass * newchan);
  105. bool read_bit_channel(ChunkLoadClass & cload,TimeCodedBitChannelClass * * newchan);
  106. void add_bit_channel(TimeCodedBitChannelClass * newchan);
  107. };
  108. #endif // hcanim.h