PointLight.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //==========================================================================//
  2. // File: gosFX_PointLight.hpp //
  3. // Contents: Base PointLight Particle //
  4. //---------------------------------------------------------------------------//
  5. // Copyright (C) Microsoft Corporation. All rights reserved. //
  6. //===========================================================================//
  7. //
  8. #pragma once
  9. #include "gosFX.hpp"
  10. #include "Effect.hpp"
  11. namespace gosFX
  12. {
  13. //############################################################################
  14. //############################ LightManager ################################
  15. //############################################################################
  16. class Light;
  17. class LightManager
  18. #if defined(_ARMOR)
  19. : public Stuff::Signature
  20. #endif
  21. {
  22. public:
  23. static LightManager* Instance;
  24. virtual Light*
  25. MakePointLight(const char* light_map=NULL);
  26. struct Info {
  27. Stuff::RGBColor
  28. m_color;
  29. Stuff::LinearMatrix4D
  30. m_origin;
  31. Stuff::Scalar
  32. m_intensity,
  33. m_inner,
  34. m_outer;
  35. Stuff::Radian
  36. m_spread;
  37. };
  38. virtual void
  39. ChangeLight(
  40. Light *light,
  41. Info *info
  42. );
  43. virtual void
  44. DeleteLight(Light *light);
  45. void
  46. TestInstance() const
  47. {}
  48. };
  49. //############################################################################
  50. //#################### PointLight__Specification #########################
  51. //############################################################################
  52. class PointLight__Specification:
  53. public Effect__Specification
  54. {
  55. //----------------------------------------------------------------------
  56. // Constructors/Destructors
  57. //
  58. protected:
  59. PointLight__Specification(
  60. Stuff::MemoryStream *stream,
  61. int gfx_version
  62. );
  63. public:
  64. PointLight__Specification();
  65. void
  66. Copy(PointLight__Specification *spec);
  67. void
  68. Save(Stuff::MemoryStream *stream);
  69. void
  70. BuildDefaults();
  71. bool
  72. IsDataValid(bool fix_data=false);
  73. static PointLight__Specification*
  74. Make(
  75. Stuff::MemoryStream *stream,
  76. int gfx_version
  77. );
  78. //-------------------------------------------------------------------------
  79. // FCurves
  80. //
  81. public:
  82. ComplexCurve
  83. m_red,
  84. m_green,
  85. m_blue,
  86. m_intensity;
  87. SplineCurve
  88. m_innerRadius,
  89. m_outerRadius;
  90. bool
  91. m_twoSided;
  92. Stuff::MString
  93. m_lightMap;
  94. };
  95. //############################################################################
  96. //############################## PointLight #############################
  97. //############################################################################
  98. class PointLight:
  99. public Effect
  100. {
  101. public:
  102. static void
  103. InitializeClass();
  104. static void
  105. TerminateClass();
  106. static ClassData
  107. *DefaultData;
  108. typedef PointLight__Specification Specification;
  109. static PointLight*
  110. Make(
  111. Specification *spec,
  112. unsigned flags
  113. );
  114. ~PointLight();
  115. protected:
  116. PointLight(
  117. Specification *spec,
  118. unsigned flags
  119. );
  120. Light
  121. *m_light;
  122. //----------------------------------------------------------------------------
  123. // Class Data Support
  124. //
  125. public:
  126. Specification*
  127. GetSpecification()
  128. {
  129. Check_Object(this);
  130. return
  131. Cast_Object(Specification*, m_specification);
  132. }
  133. //----------------------------------------------------------------------------
  134. // API
  135. //
  136. public:
  137. void
  138. Start(ExecuteInfo *info);
  139. bool
  140. Execute(ExecuteInfo *info);
  141. void
  142. Kill();
  143. //----------------------------------------------------------------------------
  144. // Testing
  145. //
  146. public:
  147. void
  148. TestInstance() const;
  149. };
  150. }