EffectCloud.hpp 3.6 KB

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