composite.h 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. ** Command & Conquer Generals(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/composite.h $*
  25. * *
  26. * Author:: Greg Hjelstrom *
  27. * *
  28. * $Modtime:: 5/30/01 2:17p $*
  29. * *
  30. * $Revision:: 4 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef COMPOSITE_H
  39. #define COMPOSITE_H
  40. #include "rendobj.h"
  41. /*
  42. ** CompositeRenderObjClass
  43. ** The sole purpose of this class is to encapsulate some of the chores that all
  44. ** "composite" (contain sub objects) render objects have to do. Typically all
  45. ** of the functions are implemented through the existing sub-object interface
  46. ** so there is still no assumption on how you store/organize your sub-objects.
  47. */
  48. class CompositeRenderObjClass : public RenderObjClass
  49. {
  50. public:
  51. CompositeRenderObjClass(void);
  52. CompositeRenderObjClass(const CompositeRenderObjClass & that);
  53. virtual ~CompositeRenderObjClass(void);
  54. CompositeRenderObjClass & operator = (const CompositeRenderObjClass & that);
  55. virtual void Restart(void);
  56. virtual const char * Get_Name(void) const;
  57. virtual void Set_Name(const char * name);
  58. virtual const char * Get_Base_Model_Name (void) const { return BaseModelName; }
  59. virtual void Set_Base_Model_Name (const char *name);
  60. virtual int Get_Num_Polys(void) const;
  61. virtual void Notify_Added(SceneClass * scene);
  62. virtual void Notify_Removed(SceneClass * scene);
  63. virtual bool Cast_Ray(RayCollisionTestClass & raytest);
  64. virtual bool Cast_AABox(AABoxCollisionTestClass & boxtest);
  65. virtual bool Cast_OBBox(OBBoxCollisionTestClass & boxtest);
  66. virtual bool Intersect_AABox(AABoxIntersectionTestClass & boxtest);
  67. virtual bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest);
  68. virtual void Create_Decal(DecalGeneratorClass * generator);
  69. virtual void Delete_Decal(uint32 decal_id);
  70. virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const { sphere = ObjSphere; }
  71. virtual void Get_Obj_Space_Bounding_Box(AABoxClass & box) const { box = ObjBox; }
  72. virtual void Update_Obj_Space_Bounding_Volumes(void);
  73. virtual void Set_User_Data(void *value, bool recursive = false);
  74. protected:
  75. char * Name; // name of the render object
  76. char * BaseModelName; // name of the original render obj (before aggregation)
  77. SphereClass ObjSphere; // object-space bounding sphere
  78. AABoxClass ObjBox; // object-space bounding box
  79. };
  80. #endif