2
0

collect.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 : WW3D *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/collect.h $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 1/08/01 10:04a $*
  29. * *
  30. * $Revision:: 1 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef COLLECT_H
  39. #define COLLECT_H
  40. #include "rendobj.h"
  41. #include "composite.h"
  42. #include "vector.h"
  43. #include "proto.h"
  44. #include "w3d_file.h"
  45. #include "wwstring.h"
  46. #include "proxy.h"
  47. class CollectionDefClass;
  48. class SnapPointsClass;
  49. /*
  50. ** CollectionClass
  51. ** This is a render object which contains a collection of render objects.
  52. */
  53. class CollectionClass : public CompositeRenderObjClass
  54. {
  55. public:
  56. CollectionClass(void);
  57. CollectionClass(const CollectionDefClass & def);
  58. CollectionClass(const CollectionClass & src);
  59. CollectionClass & CollectionClass::operator = (const CollectionClass &);
  60. virtual ~CollectionClass(void);
  61. virtual RenderObjClass * Clone(void) const;
  62. virtual int Class_ID(void) const;
  63. virtual int Get_Num_Polys(void) const;
  64. /////////////////////////////////////////////////////////////////////////////
  65. // Proxy interface
  66. /////////////////////////////////////////////////////////////////////////////
  67. virtual int Get_Proxy_Count (void) const;
  68. virtual bool Get_Proxy (int index, ProxyClass &proxy) const;
  69. /////////////////////////////////////////////////////////////////////////////
  70. // Render Object Interface - Rendering
  71. /////////////////////////////////////////////////////////////////////////////
  72. virtual void Render(RenderInfoClass & rinfo);
  73. virtual void Special_Render(SpecialRenderInfoClass & rinfo);
  74. /////////////////////////////////////////////////////////////////////////////
  75. // Render Object Interface - "Scene Graph"
  76. /////////////////////////////////////////////////////////////////////////////
  77. virtual void Set_Transform(const Matrix3D &m);
  78. virtual void Set_Position(const Vector3 &v);
  79. virtual int Get_Num_Sub_Objects(void) const;
  80. virtual RenderObjClass * Get_Sub_Object(int index) const;
  81. virtual int Add_Sub_Object(RenderObjClass * subobj);
  82. virtual int Remove_Sub_Object(RenderObjClass * robj);
  83. /////////////////////////////////////////////////////////////////////////////
  84. // Render Object Interface - Collision Detection, Ray Tracing
  85. /////////////////////////////////////////////////////////////////////////////
  86. virtual bool Cast_Ray(RayCollisionTestClass & raytest);
  87. virtual bool Cast_AABox(AABoxCollisionTestClass & boxtest);
  88. virtual bool Cast_OBBox(OBBoxCollisionTestClass & boxtest);
  89. virtual bool Intersect_AABox(AABoxIntersectionTestClass & boxtest);
  90. virtual bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest);
  91. /////////////////////////////////////////////////////////////////////////////
  92. // Render Object Interface - Bounding Volumes
  93. /////////////////////////////////////////////////////////////////////////////
  94. virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const;
  95. virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const;
  96. /////////////////////////////////////////////////////////////////////////////
  97. // Render Object Interface - Attributes, Options, Properties, etc
  98. /////////////////////////////////////////////////////////////////////////////
  99. virtual int Snap_Point_Count(void);
  100. virtual void Get_Snap_Point(int index,Vector3 * set);
  101. virtual void Scale(float scale);
  102. virtual void Scale(float scalex, float scaley, float scalez);
  103. virtual void Update_Obj_Space_Bounding_Volumes(void);
  104. protected:
  105. void Free(void);
  106. void Update_Sub_Object_Transforms(void);
  107. DynamicVectorClass <ProxyClass> ProxyList;
  108. DynamicVectorClass <RenderObjClass *> SubObjects;
  109. SnapPointsClass * SnapPoints;
  110. SphereClass BoundSphere;
  111. AABoxClass BoundBox;
  112. };
  113. /*
  114. ** CollectionLoaderClass
  115. ** Loader for collection objects
  116. */
  117. class CollectionLoaderClass : public PrototypeLoaderClass
  118. {
  119. public:
  120. virtual int Chunk_Type(void) { return W3D_CHUNK_COLLECTION; }
  121. virtual PrototypeClass * Load_W3D(ChunkLoadClass & cload);
  122. };
  123. extern CollectionLoaderClass _CollectionLoader;
  124. #endif