ShardCloud.hpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. //==========================================================================//
  2. // File: gosFX_ShardCloud.hpp //
  3. // Contents: ShardCloud 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 MLRTriangleCloud;}
  13. namespace gosFX
  14. {
  15. //############################################################################
  16. //######################## ShardCloud__Specification #############################
  17. //############################################################################
  18. class ShardCloud__Specification:
  19. public SpinningCloud__Specification
  20. {
  21. //----------------------------------------------------------------------
  22. // Constructors/Destructors
  23. //
  24. protected:
  25. ShardCloud__Specification(
  26. Stuff::MemoryStream *stream,
  27. int gfx_version
  28. );
  29. public:
  30. ShardCloud__Specification();
  31. static ShardCloud__Specification*
  32. Make(
  33. Stuff::MemoryStream *stream,
  34. int gfx_version
  35. );
  36. void
  37. Copy(ShardCloud__Specification *spec);
  38. void
  39. Save(Stuff::MemoryStream *stream);
  40. void
  41. BuildDefaults();
  42. bool
  43. IsDataValid(bool fix_data=false);
  44. //-------------------------------------------------------------------------
  45. // FCurves
  46. //
  47. public:
  48. SeededCurveOf<ComplexCurve, SplineCurve,Curve::e_ComplexSplineType>
  49. m_size;
  50. SeededCurveOf<ConstantCurve, SplineCurve,Curve::e_ConstantSplineType>
  51. m_angularity;
  52. };
  53. //############################################################################
  54. //######################## SpinningCloud__Particle #############################
  55. //############################################################################
  56. class ShardCloud__Particle:
  57. public SpinningCloud__Particle
  58. {
  59. public:
  60. Stuff::Scalar
  61. m_angle;
  62. };
  63. //############################################################################
  64. //############################# ShardCloud #################################
  65. //############################################################################
  66. class ShardCloud : public SpinningCloud
  67. {
  68. //----------------------------------------------------------------------------
  69. // Class Registration Support
  70. //
  71. public:
  72. static void InitializeClass();
  73. static void TerminateClass();
  74. typedef ShardCloud__Specification Specification;
  75. typedef ShardCloud__Particle Particle;
  76. enum {
  77. ParticleSize =
  78. sizeof(Particle)
  79. + 3*sizeof(Stuff::Point3D)
  80. + 3*sizeof(Stuff::RGBAColor)
  81. };
  82. protected:
  83. MidLevelRenderer::MLRTriangleCloud * m_cloudImplementation; // point to an MLR triangle cloud by Michael
  84. Stuff::Point3D *m_P_vertices;
  85. Stuff::RGBAColor *m_P_color;
  86. //----------------------------------------------------------------------------
  87. // Class Data Support
  88. //
  89. protected:
  90. ShardCloud(
  91. Specification *spec,
  92. unsigned flags
  93. );
  94. public:
  95. ~ShardCloud();
  96. static ShardCloud*
  97. Make(
  98. Specification *spec,
  99. unsigned flags
  100. );
  101. Specification*
  102. GetSpecification()
  103. {
  104. Check_Object(this);
  105. return
  106. Cast_Object(Specification*, m_specification);
  107. }
  108. Particle*
  109. GetParticle(unsigned index)
  110. {
  111. Check_Object(this); Check_Object(GetSpecification());
  112. return
  113. Cast_Pointer(
  114. Particle*,
  115. &m_data[index*GetSpecification()->m_particleClassSize]
  116. );
  117. }
  118. static ClassData
  119. *DefaultData;
  120. //----------------------------------------------------------------------------
  121. // Testing
  122. //
  123. public:
  124. void
  125. TestInstance() const;
  126. //----------------------------------------------------------------------------
  127. // API
  128. //
  129. protected:
  130. bool
  131. AnimateParticle(
  132. unsigned index,
  133. const Stuff::LinearMatrix4D *world_to_new_local,
  134. Stuff::Time till
  135. );
  136. void
  137. CreateNewParticle(
  138. unsigned index,
  139. Stuff::Point3D *translation
  140. );
  141. void
  142. DestroyParticle(unsigned index);
  143. public:
  144. void
  145. Draw(DrawInfo *info);
  146. };
  147. }