ShapeCloud.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. //==========================================================================//
  2. // File: gosFX_ShapeCloud.hpp //
  3. // Contents: ShapeCloud Component //
  4. //---------------------------------------------------------------------------//
  5. // Copyright (C) Microsoft Corporation. All rights reserved. //
  6. //===========================================================================//
  7. //
  8. #pragma once
  9. #include "gosFX.hpp"
  10. #include "SpinningCloud.hpp"
  11. #include <MLR\MLR.hpp>
  12. namespace MidLevelRenderer {class MLRShape;}
  13. namespace gosFX
  14. {
  15. //############################################################################
  16. //######################## ShapeCloud__Specification #############################
  17. //############################################################################
  18. class ShapeCloud;
  19. class ShapeCloud__Specification:
  20. public SpinningCloud__Specification
  21. {
  22. friend class ShapeCloud;
  23. //----------------------------------------------------------------------
  24. // Constructors/Destructors
  25. //
  26. protected:
  27. ShapeCloud__Specification(
  28. Stuff::MemoryStream *stream,
  29. int gfx_version
  30. );
  31. public:
  32. ShapeCloud__Specification(MidLevelRenderer::MLRShape *shape);
  33. ~ShapeCloud__Specification();
  34. void
  35. Save(Stuff::MemoryStream *stream);
  36. static ShapeCloud__Specification*
  37. Make(
  38. Stuff::MemoryStream *stream,
  39. int gfx_version
  40. );
  41. void
  42. Copy(ShapeCloud__Specification *spec);
  43. void
  44. SetShape(MidLevelRenderer::MLRShape *shape);
  45. protected:
  46. MidLevelRenderer::MLRShape
  47. *m_shape;
  48. Stuff::Scalar
  49. m_radius;
  50. };
  51. //############################################################################
  52. //######################## SpinningCloud__Particle #############################
  53. //############################################################################
  54. class ShapeCloud__Particle:
  55. public SpinningCloud__Particle
  56. {
  57. public:
  58. Stuff::RGBAColor
  59. m_color;
  60. };
  61. //############################################################################
  62. //############################# ShapeCloud #################################
  63. //############################################################################
  64. class ShapeCloud : public SpinningCloud
  65. {
  66. //----------------------------------------------------------------------------
  67. // Class Registration Support
  68. //
  69. public:
  70. static void InitializeClass();
  71. static void TerminateClass();
  72. typedef ShapeCloud__Specification Specification;
  73. typedef ShapeCloud__Particle Particle;
  74. //----------------------------------------------------------------------------
  75. // Class Data Support
  76. //
  77. protected:
  78. ShapeCloud(
  79. Specification *spec,
  80. unsigned flags
  81. );
  82. public:
  83. static ShapeCloud*
  84. Make(
  85. Specification *spec,
  86. unsigned flags
  87. );
  88. Specification*
  89. GetSpecification()
  90. {
  91. Check_Object(this);
  92. return
  93. Cast_Object(Specification*, m_specification);
  94. }
  95. Particle*
  96. GetParticle(unsigned index)
  97. {
  98. Check_Object(this); Check_Object(GetSpecification());
  99. return
  100. Cast_Pointer(
  101. Particle*,
  102. &m_data[index*GetSpecification()->m_particleClassSize]
  103. );
  104. }
  105. static ClassData
  106. *DefaultData;
  107. //----------------------------------------------------------------------------
  108. // Testing
  109. //
  110. public:
  111. void
  112. TestInstance() const;
  113. //----------------------------------------------------------------------------
  114. // API
  115. //
  116. protected:
  117. bool
  118. AnimateParticle(
  119. unsigned index,
  120. const Stuff::LinearMatrix4D *world_to_new_local,
  121. Stuff::Time till
  122. );
  123. void
  124. CreateNewParticle(
  125. unsigned index,
  126. Stuff::Point3D *translation
  127. );
  128. public:
  129. void
  130. Draw(DrawInfo *info);
  131. };
  132. }