PointCloud.hpp 3.8 KB

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