LevelFeature.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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/LevelFeature.h $Modtime:: 5/27/00 4:10p $*
  25. * *
  26. * $Revision:: 3 $*
  27. * *
  28. *---------------------------------------------------------------------------------------------*
  29. * Functions: *
  30. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  31. #if defined(_MSC_VER)
  32. #pragma once
  33. #endif
  34. #ifndef __LEVELFEATURE_H
  35. #define __LEVELFEATURE_H
  36. #include "cullsys.h"
  37. #include "obbox.h"
  38. #include "aabox.h"
  39. //////////////////////////////////////////////////////////////////////////
  40. //
  41. // LevelFeatureClass
  42. //
  43. //////////////////////////////////////////////////////////////////////////
  44. class LevelFeatureClass : public CullableClass
  45. {
  46. public:
  47. ////////////////////////////////////////////////////////////////////
  48. // Public data types
  49. ////////////////////////////////////////////////////////////////////
  50. typedef enum
  51. {
  52. TYPE_UNKNOWN = 0,
  53. TYPE_LADDER_BOTTOM,
  54. TYPE_LADDER_TOP,
  55. TYPE_DOOR,
  56. TYPE_ELEVATOR,
  57. } TYPE;
  58. ////////////////////////////////////////////////////////////////////
  59. // Public constructors/destructors
  60. ////////////////////////////////////////////////////////////////////
  61. LevelFeatureClass (void)
  62. : Type (TYPE_UNKNOWN),
  63. MechanismID (0),
  64. EndTM (1),
  65. StartZone (Vector3 (0, 0, 0), Vector3 (0, 0, 0)),
  66. EndZone (Vector3 (0, 0, 0), Vector3 (0, 0, 0)) { }
  67. ////////////////////////////////////////////////////////////////////
  68. // Public methods
  69. ////////////////////////////////////////////////////////////////////
  70. TYPE Get_Type (void) const { return Type; }
  71. void Set_Type (TYPE type) { Type = type; }
  72. uint32 Get_Mechanism_ID (void) const { return MechanismID; }
  73. void Set_Mechanism_ID (uint32 id) { MechanismID = id; }
  74. const OBBoxClass & Get_Start (void) const { return StartZone; }
  75. void Set_Start (const OBBoxClass &zone);
  76. const OBBoxClass & Get_End (void) const { return EndZone; }
  77. void Set_End (const OBBoxClass &zone) { EndZone = zone; }
  78. const Matrix3D & Get_End_TM (void) const { return EndTM; }
  79. void Set_End_TM (const Matrix3D &tm) { EndTM = tm; }
  80. const AABoxClass & Get_Teleport_Zone (void) const { return TeleportZone; }
  81. void Set_Teleport_Zone (const AABoxClass &zone) { TeleportZone = zone; }
  82. //
  83. // Conversion
  84. //
  85. void Get_Start_AABox (AABoxClass &box);
  86. void Get_End_AABox (AABoxClass &box);
  87. private:
  88. ////////////////////////////////////////////////////////////////////
  89. // Private member data
  90. ////////////////////////////////////////////////////////////////////
  91. TYPE Type;
  92. OBBoxClass StartZone;
  93. OBBoxClass EndZone;
  94. AABoxClass TeleportZone;
  95. Matrix3D EndTM;
  96. uint32 MechanismID;
  97. };
  98. ////////////////////////////////////////////////////////////////////
  99. // Get_Start_AABox
  100. ////////////////////////////////////////////////////////////////////
  101. inline void
  102. LevelFeatureClass::Get_Start_AABox (AABoxClass &box)
  103. {
  104. box.Center = StartZone.Center;
  105. StartZone.Compute_Axis_Aligned_Extent (&box.Extent);
  106. return ;
  107. }
  108. ////////////////////////////////////////////////////////////////////
  109. // Get_End_AABox
  110. ////////////////////////////////////////////////////////////////////
  111. inline void
  112. LevelFeatureClass::Get_End_AABox (AABoxClass &box)
  113. {
  114. box.Center = EndZone.Center;
  115. EndZone.Compute_Axis_Aligned_Extent (&box.Extent);
  116. return ;
  117. }
  118. ////////////////////////////////////////////////////////////////////
  119. // Set_Start
  120. ////////////////////////////////////////////////////////////////////
  121. inline void
  122. LevelFeatureClass::Set_Start (const OBBoxClass &zone)
  123. {
  124. StartZone = zone;
  125. //
  126. // Update the bounding-box we use for culling
  127. //
  128. AABoxClass cull_box;
  129. Get_Start_AABox (cull_box);
  130. Set_Cull_Box (cull_box);
  131. return ;
  132. }
  133. #endif //__LEVELFEATURE_H