composite.h 4.5 KB

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