motion.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. /* $Header: /Commando/Code/Tools/max2w3d/motion.h 13 10/30/00 6:56p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando Tools - W3D export *
  24. * *
  25. * $Archive:: /Commando/Code/Tools/max2w3d/motion.h $*
  26. * *
  27. * $Author:: Greg_h $*
  28. * *
  29. * $Modtime:: 10/30/00 5:25p $*
  30. * *
  31. * $Revision:: 13 $*
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef MOTION_H
  37. #define MOTION_H
  38. #ifndef ALWAYS_H
  39. #include "always.h"
  40. #endif
  41. #include <Max.h>
  42. #ifndef HIERSAVE_H
  43. #include "hiersave.h"
  44. #endif
  45. #ifndef PROGRESS_H
  46. #include "progress.h"
  47. #endif
  48. #ifndef CHUNKIO_H
  49. #include "chunkio.h"
  50. #endif
  51. #ifndef VECTOR_H
  52. #include "vector.h"
  53. #endif
  54. #ifndef LOGDLG_H
  55. #include "logdlg.h"
  56. #endif
  57. struct W3dExportOptionsStruct;
  58. class MotionClass
  59. {
  60. public:
  61. MotionClass (
  62. IScene * scene,
  63. INode * rootnode,
  64. HierarchySaveClass * basepose,
  65. W3dExportOptionsStruct & options,
  66. int framerate,
  67. Progress_Meter_Class * meter,
  68. HWND MaxHwnd,
  69. char * name,
  70. Matrix3 & offset = Matrix3(1) // matrix to bring current object space into
  71. // base object space (for damage animations)
  72. );
  73. MotionClass (
  74. IScene * scene,
  75. INodeListClass * rootlist,
  76. HierarchySaveClass * basepose,
  77. W3dExportOptionsStruct & options,
  78. int framerate,
  79. Progress_Meter_Class * meter,
  80. HWND MaxHwnd,
  81. char * name,
  82. Matrix3 & offset = Matrix3(1) // matrix to bring current object space into
  83. // base object space (for damage animations)
  84. );
  85. ~MotionClass(void);
  86. bool Save(ChunkSaveClass & csave);
  87. private:
  88. IScene * Scene;
  89. INode * RootNode;
  90. INodeListClass * RootList;
  91. HierarchySaveClass * BasePose;
  92. int StartFrame;
  93. int EndFrame;
  94. int NumFrames;
  95. int FrameRate;
  96. bool ReduceAnimation;
  97. int ReduceAnimationPercent;
  98. bool CompressAnimation;
  99. int CompressAnimationFlavor;
  100. float CompressAnimationTranslationError;
  101. float CompressAnimationRotationError;
  102. Progress_Meter_Class * Meter;
  103. char Name[W3D_NAME_LEN];
  104. Matrix3 Offset;
  105. // 2D array of matrices, one per node per frame
  106. Matrix3 * * MotionMatrix;
  107. // 2D array of euler angles, one per node per frame
  108. Point3 * * EulerDelta;
  109. // Visibility bits, one bit per node per frame
  110. BooleanVectorClass * VisData;
  111. // Movement bits, one bit per node per frame, to designate a movement as interpolated, or not
  112. BooleanVectorClass * BinMoveData;
  113. // flag for each node in the base pose, indicating
  114. // whether the node actually appeard in the max scene
  115. // being exported.
  116. BooleanVectorClass NodeValidFlags;
  117. void compute_frame_motion(int frame);
  118. void set_motion_matrix(int node,int frame,const Matrix3 & motion);
  119. Matrix3 get_motion_matrix(int node,int frame);
  120. void set_eulers(int node,int frame,float x,float y,float z);
  121. Point3 get_eulers(int node,int frame);
  122. void set_visibility(int node,int frame,bool visible);
  123. bool get_visibility(int node,int frame);
  124. void set_binary_movement(int node,int frame,bool visible);
  125. bool get_binary_movement(int node,int frame);
  126. bool save_header(ChunkSaveClass & csave);
  127. bool save_channels(ChunkSaveClass & csave);
  128. void init(void);
  129. };
  130. #endif /*MOTION_H*/