W3DViewDoc.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. // W3DViewDoc.h : interface of the CW3DViewDoc class
  19. //
  20. /////////////////////////////////////////////////////////////////////////////
  21. #if !defined(AFX_W3DVIEWDOC_H__2BB39E31_5D3A_11D2_9FC6_00104B791122__INCLUDED_)
  22. #define AFX_W3DVIEWDOC_H__2BB39E31_5D3A_11D2_9FC6_00104B791122__INCLUDED_
  23. #if _MSC_VER >= 1000
  24. #pragma once
  25. #endif // _MSC_VER >= 1000
  26. #include "scene.h"
  27. #include "Chunkio.h"
  28. #include "HAnim.H"
  29. #include "HCAnim.H"
  30. #include "dynamesh.h"
  31. #include "rendobj.h"
  32. #include "LODDefs.H"
  33. ///////////////////////////////////////////////////////////
  34. //
  35. // Constants
  36. //
  37. const DWORD SAVE_SETTINGS_LIGHT = 0x00000001;
  38. const DWORD SAVE_SETTINGS_BACK = 0x00000002;
  39. const DWORD SAVE_SETTINGS_CAMERA = 0x00000004;
  40. // Forward declarations
  41. class ParticleEmitterClass;
  42. class CameraClass;
  43. class SceneClass;
  44. class LightClass;
  45. class RenderObjClass;
  46. class HAnimClass;
  47. class CGraphicView;
  48. class CDataTreeView;
  49. class DistLODClass;
  50. class Bitmap2DObjClass;
  51. class AssetInfoClass;
  52. class HLodPrototypeClass;
  53. class HLodClass;
  54. class ViewerSceneClass;
  55. class EmitterInstanceListClass;
  56. class ScreenCursorClass;
  57. class DazzleLayerClass;
  58. /////////////////////////////////////////////////////////////////////
  59. //
  60. // CW3DViewDoc
  61. //
  62. /////////////////////////////////////////////////////////////////////
  63. class CW3DViewDoc : public CDocument
  64. {
  65. protected: // create from serialization only
  66. CW3DViewDoc();
  67. DECLARE_DYNCREATE(CW3DViewDoc)
  68. // Attributes
  69. public:
  70. // Operations
  71. public:
  72. // Overrides
  73. // ClassWizard generated virtual function overrides
  74. //{{AFX_VIRTUAL(CW3DViewDoc)
  75. public:
  76. virtual BOOL OnNewDocument();
  77. virtual void Serialize(CArchive& ar);
  78. virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  79. //}}AFX_VIRTUAL
  80. // Implementation
  81. public:
  82. virtual ~CW3DViewDoc();
  83. #ifdef _DEBUG
  84. virtual void AssertValid() const;
  85. virtual void Dump(CDumpContext& dc) const;
  86. #endif
  87. protected:
  88. // Generated message map functions
  89. protected:
  90. //{{AFX_MSG(CW3DViewDoc)
  91. // NOTE - the ClassWizard will add and remove member functions here.
  92. // DO NOT EDIT what you see in these blocks of generated code !
  93. //}}AFX_MSG
  94. DECLARE_MESSAGE_MAP()
  95. public:
  96. void SetChannelQCompression(bool bCompress){ m_bCompress_channel_Q = bCompress;}
  97. //
  98. // Accessors
  99. //
  100. CameraClass * Get2DCamera (void) const { return m_pC2DCamera; }
  101. CameraClass * GetBackObjectCamera (void) const { return m_pCBackObjectCamera; }
  102. SceneClass * Get2DScene (void) const { return m_pC2DScene; }
  103. SceneClass * GetCursorScene (void) const { return m_pCursorScene; }
  104. ViewerSceneClass * GetScene (void) const { return m_pCScene; }
  105. SceneClass * GetBackObjectScene (void) const { return m_pCBackObjectScene; }
  106. LightClass * GetSceneLight (void) const { return m_pCSceneLight; }
  107. RenderObjClass * GetDisplayedObject (void) const { return m_pCRenderObj; }
  108. HAnimClass * GetCurrentAnimation (void) const { return m_pCAnimation; }
  109. const HTreeClass * Get_Current_HTree (void) const;
  110. //
  111. // Creation/destruction methods
  112. //
  113. void InitScene (void);
  114. void LoadAssetsFromFile (LPCTSTR lpszPathName);
  115. HLodPrototypeClass *GenerateLOD (LPCTSTR pszLODBaseName, LOD_NAMING_TYPE type);
  116. void CleanupResources (void);
  117. bool Is_Initialized (void) { return m_IsInitialized; }
  118. void Reload_Displayed_Object (void);
  119. void Display_Emitter (ParticleEmitterClass *pemitter = NULL, bool use_global_reset_flag = true, bool allow_reset = true);
  120. void DisplayObject (RenderObjClass *pCModel = NULL, bool use_global_reset_flag = true, bool allow_reset = true, bool add_ghost = false);
  121. BOOL SaveSettings (LPCTSTR pszFilename, DWORD dwSettingsMask);
  122. BOOL LoadSettings (LPCTSTR pszFileName);
  123. CGraphicView * GetGraphicView (void);
  124. CDataTreeView * GetDataTreeView (void);
  125. void Build_Emitter_List (EmitterInstanceListClass *emitter_list, LPCTSTR emitter_name, RenderObjClass *render_obj = NULL);
  126. //
  127. // Animation methods
  128. //
  129. void Make_Movie (void);
  130. void ResetAnimation (void);
  131. void StepAnimation (int frame_inc = 1);
  132. void PlayAnimation (RenderObjClass *pobj, LPCTSTR panim_name = NULL, bool use_global_reset_flag = true, bool allow_reset = true);
  133. void PlayAnimation (RenderObjClass *pobj, HAnimComboClass *pcombo, bool use_global_reset_flag = true, bool allow_reset = true);
  134. void UpdateFrame (float time_slice);
  135. void SetAnimationBlend (BOOL bBlend) { m_bAnimBlend = bBlend; }
  136. bool GetChannelQCompression(){ return m_bCompress_channel_Q;}
  137. int GetChannelQnBytes(){return m_nChannelQnBytes;}
  138. void SetChannelQnBytes(int n_bytes){m_nChannelQnBytes = n_bytes;}
  139. BOOL GetAnimationBlend (void) const { return m_bAnimBlend; }
  140. bool Is_Camera_Animated (void) const { return m_bAnimateCamera; }
  141. void Animate_Camera (bool banimate);
  142. void Import_Facial_Animation (const CString &hierarchy_name, const CString &filename);
  143. void Play_Animation_Sound (void);
  144. //
  145. // Camera methods
  146. //
  147. bool Is_Camera_Auto_Reset_On (void) const { return m_bAutoCameraReset; }
  148. void Turn_Camera_Auto_Reset_On (bool onoff) { m_bAutoCameraReset = onoff; }
  149. //
  150. // Background color methods
  151. //
  152. const Vector3 & GetBackgroundColor (void) const { return m_backgroundColor; }
  153. void SetBackgroundColor (const Vector3 &backgroundColor);
  154. //
  155. // Background BMP methods
  156. //
  157. const CString & GetBackgroundBMP (void) const { return m_stringBackgroundBMP; }
  158. void SetBackgroundBMP (LPCTSTR pszBackgroundBMP);
  159. //
  160. // Background Object methods
  161. //
  162. const CString & GetBackgroundObjectName (void) const { return m_stringBackgroundObject; }
  163. void SetBackgroundObject (LPCTSTR pszBackgroundObjectName);
  164. //
  165. // Fogging methods
  166. //
  167. bool IsFogEnabled (void) const { return m_bFogEnabled; }
  168. void EnableFog (bool enable=true);
  169. //
  170. // Scene methods
  171. //
  172. void Remove_Object_From_Scene (RenderObjClass *prender_obj = NULL);
  173. //
  174. // Emitter serialization methods
  175. //
  176. bool Save_Selected_Emitter (void);
  177. bool Save_Current_Emitter (const CString &filename);
  178. //
  179. // Primitive serialization methods
  180. //
  181. bool Save_Selected_Primitive (void);
  182. bool Save_Current_Sphere (const CString &filename);
  183. bool Save_Current_Ring (const CString &filename);
  184. //
  185. // Aggregate methods
  186. //
  187. void Auto_Assign_Bones (void);
  188. bool Save_Selected_Aggregate (void);
  189. bool Save_Current_Aggregate (const CString &filename);
  190. //
  191. // Sound object methods
  192. //
  193. bool Save_Selected_Sound_Object (void);
  194. bool Save_Current_Sound_Object (const CString &filename);
  195. //
  196. // LOD methods
  197. //
  198. bool Save_Current_LOD (const CString &filename);
  199. bool Save_Selected_LOD (void);
  200. void Switch_LOD (int increment = 1, RenderObjClass *render_obj = NULL);
  201. //
  202. // Alternate Material interface.
  203. //
  204. void Toggle_Alternate_Materials(RenderObjClass * obj = NULL);
  205. //
  206. // Prototype methods
  207. //
  208. void Update_Aggregate_Prototype (RenderObjClass &render_obj);
  209. void Update_LOD_Prototype (HLodClass &hlod);
  210. //
  211. // Cursor managment
  212. //
  213. void Show_Cursor (bool onoff);
  214. void Set_Cursor (LPCTSTR resource_name);
  215. bool Is_Cursor_Shown (void) const;
  216. void Create_Cursor (void);
  217. //
  218. // Particle methods
  219. //
  220. int Count_Particles (RenderObjClass *render_obj = NULL);
  221. void Update_Particle_Count (void);
  222. //
  223. // Manual settings
  224. //
  225. void Set_Manual_FOV (bool manual) { m_ManualFOV = manual; }
  226. void Set_Manul_Clip_Planes (bool manual){ m_ManualClipPlanes = manual; }
  227. bool Is_FOV_Manual (void) const { return m_ManualFOV; }
  228. bool Are_Clip_Planes_Manual (void) const { return m_ManualClipPlanes; }
  229. void Update_Camera (void);
  230. void Save_Camera_Settings (void);
  231. void Load_Camera_Settings (void);
  232. //
  233. // File methods
  234. //
  235. void Copy_Assets_To_Dir (LPCTSTR directory);
  236. bool Lookup_Path (LPCTSTR asset_name, CString &path);
  237. const char * Get_Last_Path (void) const { return (m_LastPath.IsEmpty () ? NULL : (const char *)m_LastPath); }
  238. //
  239. // Texture search paths
  240. //
  241. const CString & Get_Texture_Path1 (void) const { return m_TexturePath1; }
  242. const CString & Get_Texture_Path2 (void) const { return m_TexturePath2; }
  243. void Set_Texture_Path1 (LPCTSTR path);
  244. void Set_Texture_Path2 (LPCTSTR path);
  245. //
  246. // Dazzle rendering support
  247. //
  248. void Render_Dazzles(CameraClass * camera);
  249. private:
  250. //////////////////////////////////////////////////////////////////
  251. // Private member data
  252. //////////////////////////////////////////////////////////////////
  253. ViewerSceneClass * m_pCScene;
  254. SceneClass * m_pC2DScene;
  255. SceneClass * m_pCursorScene;
  256. SceneClass * m_pCBackObjectScene;
  257. DazzleLayerClass * m_pDazzleLayer;
  258. RenderObjClass * m_pCRenderObj;
  259. RenderObjClass * m_pCBackgroundObject;
  260. HAnimClass * m_pCAnimation;
  261. HAnimComboClass * m_pCAnimCombo;
  262. LightClass * m_pCSceneLight;
  263. Bitmap2DObjClass * m_pCBackgroundBMP;
  264. CameraClass * m_pC2DCamera;
  265. CameraClass * m_pCBackObjectCamera;
  266. ScreenCursorClass * m_pCursor;
  267. Vector3 m_backgroundColor;
  268. CString m_stringBackgroundBMP;
  269. CString m_stringBackgroundObject;
  270. bool m_bCompress_channel_Q;
  271. int m_nChannelQnBytes;
  272. float m_CurrentFrame;
  273. float m_animTime;
  274. BOOL m_bAnimBlend;
  275. bool m_bAnimateCamera;
  276. bool m_bAutoCameraReset;
  277. bool m_bOneTimeReset;
  278. bool m_ManualFOV;
  279. bool m_ManualClipPlanes;
  280. bool m_IsInitialized;
  281. bool m_bFogEnabled;
  282. CString m_TexturePath1;
  283. CString m_TexturePath2;
  284. CString m_LastPath;
  285. DynamicVectorClass<CString> m_LoadList;
  286. };
  287. /////////////////////////////////////////////////////////////////////////////
  288. //{{AFX_INSERT_LOCATION}}
  289. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  290. #endif // !defined(AFX_W3DVIEWDOC_H__2BB39E31_5D3A_11D2_9FC6_00104B791122__INCLUDED_)