Singleton.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //==========================================================================//
  2. // File: gosFX_Singleton.hpp //
  3. // Contents: Base Singleton 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. //######################## Singleton__Specification #############################
  15. //############################################################################
  16. class Singleton__Specification:
  17. public Effect__Specification
  18. {
  19. //----------------------------------------------------------------------
  20. // Constructors/Destructors
  21. //
  22. protected:
  23. Singleton__Specification(
  24. Stuff::RegisteredClass::ClassID class_id,
  25. Stuff::MemoryStream *stream,
  26. int gfx_version
  27. );
  28. public:
  29. Singleton__Specification(Stuff::RegisteredClass::ClassID class_id);
  30. void
  31. Copy(Singleton__Specification *spec);
  32. void
  33. Save(Stuff::MemoryStream *stream);
  34. void
  35. BuildDefaults();
  36. bool
  37. IsDataValid(bool fix_data=false);
  38. //-------------------------------------------------------------------------
  39. // FCurves
  40. //
  41. public:
  42. SeededCurveOf<ComplexCurve, LinearCurve,Curve::e_ComplexLinearType>
  43. m_red,
  44. m_green,
  45. m_blue,
  46. m_alpha;
  47. SeededCurveOf<ComplexCurve, ComplexCurve,Curve::e_ComplexComplexType>
  48. m_scale;
  49. bool
  50. m_alignZUsingX,
  51. m_alignZUsingY;
  52. };
  53. //############################################################################
  54. //############################## Singleton #############################
  55. //############################################################################
  56. class _declspec(novtable) Singleton:
  57. public Effect
  58. {
  59. public:
  60. static void
  61. InitializeClass();
  62. static void
  63. TerminateClass();
  64. static ClassData
  65. *DefaultData;
  66. typedef Singleton__Specification Specification;
  67. protected:
  68. Stuff::DynamicArrayOf<char>
  69. m_data;
  70. Singleton(
  71. ClassData *class_data,
  72. Specification *spec,
  73. unsigned flags
  74. );
  75. //----------------------------------------------------------------------------
  76. // Class Data Support
  77. //
  78. public:
  79. Specification*
  80. GetSpecification()
  81. {
  82. Check_Object(this);
  83. return
  84. Cast_Object(Specification*, m_specification);
  85. }
  86. //----------------------------------------------------------------------------
  87. // API
  88. //
  89. public:
  90. bool
  91. Execute(ExecuteInfo *info);
  92. protected:
  93. Stuff::RGBAColor
  94. m_color;
  95. Stuff::Scalar
  96. m_radius,
  97. m_scale;
  98. //----------------------------------------------------------------------------
  99. // Testing
  100. //
  101. public:
  102. void
  103. TestInstance() const;
  104. };
  105. }