ParticleEffect.pkg 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. $#include "Graphics/ParticleEffect.h"
  2. enum EmitterType
  3. {
  4. EMITTER_SPHERE,
  5. EMITTER_BOX
  6. };
  7. struct ColorFrame
  8. {
  9. ColorFrame();
  10. ColorFrame(const Color& color);
  11. ColorFrame(const Color& color, float time);
  12. ~ColorFrame();
  13. Color Interpolate(const ColorFrame& next, float time);
  14. Color color_ @ color;
  15. float time_ @ time;
  16. };
  17. struct TextureFrame
  18. {
  19. TextureFrame();
  20. ~TextureFrame();
  21. Rect uv_ @ uv;
  22. float time_ @ time;
  23. };
  24. class ParticleEffect : public Resource
  25. {
  26. ParticleEffect();
  27. ~ParticleEffect();
  28. void SetMaterial(Material* material);
  29. void SetNumParticles(unsigned num);
  30. void SetUpdateInvisible(bool enable);
  31. void SetRelative(bool enable);
  32. void SetScaled(bool enable);
  33. void SetSorted(bool enable);
  34. void SetAnimationLodBias(float lodBias);
  35. void SetEmitterType(EmitterType type);
  36. void SetEmitterSize(const Vector3& size);
  37. void SetMinDirection(const Vector3& direction);
  38. void SetMaxDirection(const Vector3& direction);
  39. void SetConstantForce(const Vector3& force);
  40. void SetDampingForce(float force);
  41. void SetActiveTime(float time);
  42. void SetInactiveTime(float time);
  43. void SetMinEmissionRate(float rate);
  44. void SetMaxEmissionRate(float rate);
  45. void SetMinParticleSize(const Vector2& size);
  46. void SetMaxParticleSize(const Vector2& size);
  47. void SetMinTimeToLive(float time);
  48. void SetMaxTimeToLive(float time);
  49. void SetMinVelocity(float velocity);
  50. void SetMaxVelocity(float velocity);
  51. void SetMinRotation(float rotation);
  52. void SetMaxRotation(float rotation);
  53. void SetMinRotationSpeed(float speed);
  54. void SetMaxRotationSpeed(float speed);
  55. void SetSizeAdd(float sizeAdd);
  56. void SetSizeMul(float sizeMul);
  57. void AddColorTime(const Color& color, const float time);
  58. void AddColorFrame(const ColorFrame& colorFrame);
  59. void RemoveColorFrame(unsigned index);
  60. void SetColorFrame(unsigned index, const ColorFrame& colorFrame);
  61. void SetNumColorFrames(unsigned number);
  62. void SortColorFrames();
  63. void AddTextureTime(const Rect& uv, const float time);
  64. void AddTextureFrame(const TextureFrame& textureFrame);
  65. void RemoveTextureFrame(unsigned index);
  66. void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
  67. void SetNumTextureFrames(unsigned number);
  68. void SortTextureFrames();
  69. Material* GetMaterial() const;
  70. unsigned GetNumParticles() const;
  71. bool GetUpdateInvisible() const;
  72. bool IsRelative() const;
  73. bool IsScaled() const;
  74. bool IsSorted() const;
  75. float GetAnimationLodBias() const;
  76. EmitterType GetEmitterType() const;
  77. const Vector3& GetEmitterSize() const;
  78. const Vector3& GetMinDirection() const;
  79. const Vector3& GetMaxDirection() const;
  80. const Vector3& GetConstantForce() const;
  81. float GetDampingForce() const;
  82. float GetActiveTime() const;
  83. float GetInactiveTime() const;
  84. float GetMinEmissionRate() const;
  85. float GetMaxEmissionRate() const;
  86. const Vector2& GetMinParticleSize() const;
  87. const Vector2& GetMaxParticleSize() const;
  88. float GetMinTimeToLive() const;
  89. float GetMaxTimeToLive() const;
  90. float GetMinVelocity() const;
  91. float GetMaxVelocity() const;
  92. float GetMinRotation() const;
  93. float GetMaxRotation() const;
  94. float GetMinRotationSpeed() const;
  95. float GetMaxRotationSpeed() const;
  96. float GetSizeAdd() const;
  97. float GetSizeMul() const;
  98. unsigned GetNumColorFrames() const;
  99. const ColorFrame* GetColorFrame(unsigned index) const;
  100. unsigned GetNumTextureFrames() const;
  101. const TextureFrame* GetTextureFrame(unsigned index) const;
  102. tolua_property__get_set Material* material;
  103. tolua_property__get_set unsigned numParticles;
  104. tolua_property__get_set bool updateInvisible;
  105. tolua_property__is_set bool relative;
  106. tolua_property__is_set bool scaled;
  107. tolua_property__is_set bool sorted;
  108. tolua_property__get_set float animationLodBias;
  109. tolua_property__get_set EmitterType emitterType;
  110. tolua_property__get_set const Vector3& emitterSize;
  111. tolua_property__get_set const Vector3& minDirection;
  112. tolua_property__get_set const Vector3& maxDirection;
  113. tolua_property__get_set const Vector3& constantForce;
  114. tolua_property__get_set float dampingForce;
  115. tolua_property__get_set float activeTime;
  116. tolua_property__get_set float inactiveTime;
  117. tolua_property__get_set float minEmissionRate;
  118. tolua_property__get_set float maxEmissionRate;
  119. tolua_property__get_set const Vector2& minParticleSize;
  120. tolua_property__get_set const Vector2& maxParticleSize;
  121. tolua_property__get_set float minTimeToLive;
  122. tolua_property__get_set float maxTimeToLive;
  123. tolua_property__get_set float minVelocity;
  124. tolua_property__get_set float maxVelocity;
  125. tolua_property__get_set float minRotation;
  126. tolua_property__get_set float maxRotation;
  127. tolua_property__get_set float minRotationSpeed;
  128. tolua_property__get_set float maxRotationSpeed;
  129. tolua_property__get_set float sizeAdd;
  130. tolua_property__get_set float sizeMul;
  131. tolua_property__get_set unsigned numColorFrames;
  132. tolua_property__get_set unsigned numTextureFrames;
  133. };
  134. ${
  135. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_ParticleEffect_new00
  136. static int tolua_GraphicsLuaAPI_ParticleEffect_new00(lua_State* tolua_S)
  137. {
  138. return ToluaNewObject<ParticleEffect>(tolua_S);
  139. }
  140. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_ParticleEffect_new00_local
  141. static int tolua_GraphicsLuaAPI_ParticleEffect_new00_local(lua_State* tolua_S)
  142. {
  143. return ToluaNewObjectGC<ParticleEffect>(tolua_S);
  144. }
  145. $}