heightfieldeditor.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 : leveledit *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/LevelEdit/heightfieldeditor.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 3/05/02 11:32a $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __HEIGHTFIELDEDITOR_H
  39. #define __HEIGHTFIELDEDITOR_H
  40. #include "vector.h"
  41. //////////////////////////////////////////////////////////////////////
  42. // Forward declarations
  43. //////////////////////////////////////////////////////////////////////
  44. class TerrainMaterialClass;
  45. class EditableHeightfieldClass;
  46. class TextureClass;
  47. //////////////////////////////////////////////////////////////////////
  48. //
  49. // HeightfieldEditorClass
  50. //
  51. //////////////////////////////////////////////////////////////////////
  52. class HeightfieldEditorClass
  53. {
  54. public:
  55. ///////////////////////////////////////////////////////////////////
  56. // Public data types
  57. ///////////////////////////////////////////////////////////////////
  58. typedef enum
  59. {
  60. MODE_DEFORM = 0,
  61. MODE_DEFORM_SMOOTH,
  62. MODE_DEFORM_SMOOTH_FOUNDATION,
  63. MODE_DEFORM_NOISE,
  64. MODE_QUAD_CUTOUT,
  65. MODE_TEXTURING,
  66. } EDITING_MODE;
  67. ///////////////////////////////////////////////////////////////////
  68. // Public methods
  69. ///////////////////////////////////////////////////////////////////
  70. //
  71. // Initialization
  72. //
  73. static void Initialize (void);
  74. static void Shutdown (void);
  75. //
  76. // Mode support
  77. //
  78. static void Set_Mode (EDITING_MODE mode);
  79. static EDITING_MODE Get_Mode (void) { return Mode; }
  80. //
  81. // Frame updating support
  82. //
  83. static void On_Frame_Update (void);
  84. static void Render (void);
  85. //
  86. // Current heightfield information
  87. //
  88. static EditableHeightfieldClass * Get_Current_Heightfield (void) { return CurrentHeightfield; }
  89. static void Set_Current_Heightfield (EditableHeightfieldClass *heightfield);
  90. //
  91. // Current brush configuration
  92. //
  93. static void Set_Brush_Radii (float inner_radius, float outter_radius);
  94. static void Set_Brush_Amount (float amount) { BrushAmount = amount; }
  95. static void Get_Brush_Radii (float &inner_radius, float &outter_radius);
  96. static float Get_Brush_Inner_Radius (void) { return BrushInnerRadius; }
  97. static float Get_Brush_Outter_Radius (void) { return BrushOutterRadius; }
  98. static float Get_Brush_Amount (void) { return BrushAmount; }
  99. //
  100. // Texture configuation
  101. //
  102. static void Set_Current_Texture (int index) { CurrentTextureIndex = index; }
  103. static int Get_Current_Texture (void) { return CurrentTextureIndex; }
  104. //
  105. // Material configuration
  106. //
  107. static TerrainMaterialClass * Get_Material (int index);
  108. static TerrainMaterialClass * Peek_Material (int index);
  109. static void Set_Material (int index, TerrainMaterialClass *material);
  110. static void Load_Materials (EditableHeightfieldClass *heightfield);
  111. static void On_Material_Changed (int material_index);
  112. //
  113. // UI support
  114. //
  115. static HBITMAP Create_Texture_Thumbnail (const char *texture_name, int width, int height);
  116. static HBITMAP Create_Texture_Thumbnail (TextureClass *texture, int width, int height);
  117. private:
  118. ///////////////////////////////////////////////////////////////////
  119. // Private methods
  120. ///////////////////////////////////////////////////////////////////
  121. ///////////////////////////////////////////////////////////////////
  122. // Private member data
  123. ///////////////////////////////////////////////////////////////////
  124. static float BrushInnerRadius;
  125. static float BrushOutterRadius;
  126. static float BrushAmount;
  127. static EDITING_MODE Mode;
  128. static int CurrentTextureIndex;
  129. static EditableHeightfieldClass * CurrentHeightfield;
  130. static DynamicVectorClass<TerrainMaterialClass *> MaterialList;
  131. };
  132. #endif //__HEIGHTFIELDEDITOR_H