PertCloud.hpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. //==========================================================================//
  2. // File: gosFX_PertCloud.hpp //
  3. // Contents: PertCloud 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 MLRNGonCloud;}
  13. namespace gosFX
  14. {
  15. //############################################################################
  16. //######################## PertCloud__Specification #############################
  17. //############################################################################
  18. class PertCloud__Specification:
  19. public SpinningCloud__Specification
  20. {
  21. //----------------------------------------------------------------------
  22. // Constructors/Destructors
  23. //
  24. protected:
  25. PertCloud__Specification(
  26. Stuff::MemoryStream *stream,
  27. int gfx_version
  28. );
  29. public:
  30. PertCloud__Specification(unsigned sides);
  31. static PertCloud__Specification*
  32. Make(
  33. Stuff::MemoryStream *stream,
  34. int gfx_version
  35. );
  36. void
  37. Copy(PertCloud__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_perturbation;
  52. SeededCurveOf<ComplexCurve, LinearCurve,Curve::e_ComplexLinearType>
  53. m_pCenterRed,
  54. m_pCenterGreen,
  55. m_pCenterBlue,
  56. m_pCenterAlpha;
  57. unsigned
  58. m_vertices;
  59. };
  60. //############################################################################
  61. //######################## SpinningCloud__Particle #############################
  62. //############################################################################
  63. class PertCloud__Particle:
  64. public SpinningCloud__Particle
  65. {
  66. public:
  67. Stuff::Point3D
  68. m_vertices[MidLevelRenderer::Limits::Max_Number_Of_NGon_Vertices];
  69. };
  70. //############################################################################
  71. //############################# PertCloud ##################################
  72. //############################################################################
  73. class PertCloud : public SpinningCloud
  74. {
  75. //----------------------------------------------------------------------------
  76. // Class Registration Support
  77. //
  78. public:
  79. static void InitializeClass();
  80. static void TerminateClass();
  81. typedef PertCloud__Specification Specification;
  82. typedef PertCloud__Particle Particle;
  83. protected:
  84. MidLevelRenderer::MLRNGonCloud * m_cloudImplementation; // Pert to an MLR Pert cloud by Jim
  85. Stuff::Point3D *m_P_vertices;
  86. Stuff::RGBAColor *m_P_color;
  87. //----------------------------------------------------------------------------
  88. // Class Data Support
  89. //
  90. protected:
  91. PertCloud(
  92. Specification *spec,
  93. unsigned flags
  94. );
  95. public:
  96. ~PertCloud();
  97. static PertCloud*
  98. Make(
  99. Specification *spec,
  100. unsigned flags
  101. );
  102. Specification*
  103. GetSpecification()
  104. {
  105. Check_Object(this);
  106. return
  107. Cast_Object(Specification*, m_specification);
  108. }
  109. Particle*
  110. GetParticle(unsigned index)
  111. {
  112. Check_Object(this); Check_Object(GetSpecification());
  113. return
  114. Cast_Pointer(
  115. Particle*,
  116. &m_data[index*GetSpecification()->m_particleClassSize]
  117. );
  118. }
  119. static ClassData
  120. *DefaultData;
  121. //----------------------------------------------------------------------------
  122. // Testing
  123. //
  124. public:
  125. void
  126. TestInstance() const;
  127. //----------------------------------------------------------------------------
  128. // API
  129. //
  130. protected:
  131. bool
  132. AnimateParticle(
  133. unsigned index,
  134. const Stuff::LinearMatrix4D *world_to_new_local,
  135. Stuff::Time till
  136. );
  137. void
  138. CreateNewParticle(
  139. unsigned index,
  140. Stuff::Point3D *translation
  141. );
  142. void
  143. DestroyParticle(unsigned index);
  144. public:
  145. void
  146. Draw(DrawInfo *info);
  147. };
  148. }