CardCloud.hpp 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. #pragma once
  5. #include "gosFX.hpp"
  6. #include "SpinningCloud.hpp"
  7. #include <MLR\MLR.hpp>
  8. namespace MidLevelRenderer {class MLRCardCloud;}
  9. namespace gosFX
  10. {
  11. //############################################################################
  12. //######################## CardCloud__Specification #############################
  13. //############################################################################
  14. class CardCloud__Specification:
  15. public SpinningCloud__Specification
  16. {
  17. //----------------------------------------------------------------------
  18. // Constructors/Destructors
  19. //
  20. protected:
  21. CardCloud__Specification(
  22. Stuff::MemoryStream *stream,
  23. int gfx_version
  24. );
  25. public:
  26. CardCloud__Specification();
  27. static CardCloud__Specification*
  28. Make(
  29. Stuff::MemoryStream *stream,
  30. int gfx_version
  31. );
  32. void
  33. Copy(CardCloud__Specification *spec);
  34. void
  35. Save(Stuff::MemoryStream *stream);
  36. void
  37. BuildDefaults();
  38. virtual bool
  39. IsDataValid(bool fix_data=false);
  40. //-------------------------------------------------------------------------
  41. // FCurves
  42. //
  43. public:
  44. SeededCurveOf<ComplexCurve, ComplexCurve,Curve::e_ComplexComplexType>
  45. m_halfHeight,
  46. m_aspectRatio;
  47. SeededCurveOf<ComplexCurve, SplineCurve,Curve::e_ComplexSplineType>
  48. m_pIndex;
  49. ConstantCurve
  50. m_UOffset,
  51. m_VOffset,
  52. m_USize,
  53. m_VSize;
  54. bool
  55. m_animated;
  56. BYTE
  57. m_width;
  58. void
  59. SetWidth();
  60. };
  61. //############################################################################
  62. //######################## SpinningCloud__Particle #############################
  63. //############################################################################
  64. class CardCloud__Particle:
  65. public SpinningCloud__Particle
  66. {
  67. public:
  68. Stuff::Scalar
  69. m_halfX,
  70. m_halfY;
  71. };
  72. //############################################################################
  73. //############################# CardCloud #################################
  74. //############################################################################
  75. class CardCloud : public SpinningCloud
  76. {
  77. //----------------------------------------------------------------------------
  78. // Class Registration Support
  79. //
  80. public:
  81. static void InitializeClass();
  82. static void TerminateClass();
  83. typedef CardCloud__Specification Specification;
  84. typedef CardCloud__Particle Particle;
  85. public:
  86. enum {
  87. ParticleSize =
  88. sizeof(Particle)
  89. + 4*sizeof(Stuff::Point3D)
  90. + sizeof(Stuff::RGBAColor)
  91. + 4*sizeof(Stuff::Vector2DOf<Stuff::Scalar>)
  92. };
  93. protected:
  94. MidLevelRenderer::MLRCardCloud * m_cloudImplementation; // point to an MLR triangle cloud by Michael
  95. Stuff::Point3D *m_P_vertices;
  96. Stuff::RGBAColor *m_P_color;
  97. Stuff::Vector2DOf<Stuff::Scalar> *m_P_uvs;
  98. //----------------------------------------------------------------------------
  99. // Class Data Support
  100. //
  101. protected:
  102. CardCloud(
  103. Specification *spec,
  104. unsigned flags
  105. );
  106. public:
  107. ~CardCloud();
  108. static CardCloud*
  109. Make(
  110. Specification *spec,
  111. unsigned flags
  112. );
  113. Specification*
  114. GetSpecification()
  115. {
  116. Check_Object(this);
  117. return
  118. Cast_Object(Specification*, m_specification);
  119. }
  120. Particle*
  121. GetParticle(unsigned index)
  122. {
  123. Check_Object(this); Check_Object(GetSpecification());
  124. return
  125. Cast_Pointer(
  126. Particle*,
  127. &m_data[index*GetSpecification()->m_particleClassSize]
  128. );
  129. }
  130. static ClassData
  131. *DefaultData;
  132. //----------------------------------------------------------------------------
  133. // Testing
  134. //
  135. public:
  136. void
  137. TestInstance() const;
  138. //----------------------------------------------------------------------------
  139. // API
  140. //
  141. protected:
  142. bool
  143. AnimateParticle(
  144. unsigned index,
  145. const Stuff::LinearMatrix4D *world_to_new_local,
  146. Stuff::Time till
  147. );
  148. void
  149. CreateNewParticle(
  150. unsigned index,
  151. Stuff::Point3D *translation
  152. );
  153. void
  154. DestroyParticle(unsigned index);
  155. public:
  156. void
  157. Draw(DrawInfo *info);
  158. };
  159. }