ParticleEffect.pkg 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 SetFixedScreenSize(bool enable);
  35. void SetAnimationLodBias(float lodBias);
  36. void SetEmitterType(EmitterType type);
  37. void SetEmitterSize(const Vector3& size);
  38. void SetMinDirection(const Vector3& direction);
  39. void SetMaxDirection(const Vector3& direction);
  40. void SetConstantForce(const Vector3& force);
  41. void SetDampingForce(float force);
  42. void SetActiveTime(float time);
  43. void SetInactiveTime(float time);
  44. void SetMinEmissionRate(float rate);
  45. void SetMaxEmissionRate(float rate);
  46. void SetMinParticleSize(const Vector2& size);
  47. void SetMaxParticleSize(const Vector2& size);
  48. void SetMinTimeToLive(float time);
  49. void SetMaxTimeToLive(float time);
  50. void SetMinVelocity(float velocity);
  51. void SetMaxVelocity(float velocity);
  52. void SetMinRotation(float rotation);
  53. void SetMaxRotation(float rotation);
  54. void SetMinRotationSpeed(float speed);
  55. void SetMaxRotationSpeed(float speed);
  56. void SetSizeAdd(float sizeAdd);
  57. void SetSizeMul(float sizeMul);
  58. void AddColorTime(const Color& color, const float time);
  59. void AddColorFrame(const ColorFrame& colorFrame);
  60. void RemoveColorFrame(unsigned index);
  61. void SetColorFrame(unsigned index, const ColorFrame& colorFrame);
  62. void SetNumColorFrames(unsigned number);
  63. void SortColorFrames();
  64. void AddTextureTime(const Rect& uv, const float time);
  65. void AddTextureFrame(const TextureFrame& textureFrame);
  66. void RemoveTextureFrame(unsigned index);
  67. void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
  68. void SetNumTextureFrames(unsigned number);
  69. void SortTextureFrames();
  70. // SharedPtr<ParticleEffect> Clone(const String cloneName = String::EMPTY) const;
  71. tolua_outside ParticleEffect* ParticleEffectClone @ Clone(const String cloneName = String::EMPTY) const;
  72. Material* GetMaterial() const;
  73. unsigned GetNumParticles() const;
  74. bool GetUpdateInvisible() const;
  75. bool IsRelative() const;
  76. bool IsScaled() const;
  77. bool IsSorted() const;
  78. bool IsFixedScreenSize() const;
  79. float GetAnimationLodBias() const;
  80. EmitterType GetEmitterType() const;
  81. const Vector3& GetEmitterSize() const;
  82. const Vector3& GetMinDirection() const;
  83. const Vector3& GetMaxDirection() const;
  84. const Vector3& GetConstantForce() const;
  85. float GetDampingForce() const;
  86. float GetActiveTime() const;
  87. float GetInactiveTime() const;
  88. float GetMinEmissionRate() const;
  89. float GetMaxEmissionRate() const;
  90. const Vector2& GetMinParticleSize() const;
  91. const Vector2& GetMaxParticleSize() const;
  92. float GetMinTimeToLive() const;
  93. float GetMaxTimeToLive() const;
  94. float GetMinVelocity() const;
  95. float GetMaxVelocity() const;
  96. float GetMinRotation() const;
  97. float GetMaxRotation() const;
  98. float GetMinRotationSpeed() const;
  99. float GetMaxRotationSpeed() const;
  100. float GetSizeAdd() const;
  101. float GetSizeMul() const;
  102. unsigned GetNumColorFrames() const;
  103. const ColorFrame* GetColorFrame(unsigned index) const;
  104. unsigned GetNumTextureFrames() const;
  105. const TextureFrame* GetTextureFrame(unsigned index) const;
  106. tolua_property__get_set Material* material;
  107. tolua_property__get_set unsigned numParticles;
  108. tolua_property__get_set bool updateInvisible;
  109. tolua_property__is_set bool relative;
  110. tolua_property__is_set bool scaled;
  111. tolua_property__is_set bool sorted;
  112. tolua_property__is_set bool fixedScreenSize;
  113. tolua_property__get_set float animationLodBias;
  114. tolua_property__get_set EmitterType emitterType;
  115. tolua_property__get_set const Vector3& emitterSize;
  116. tolua_property__get_set const Vector3& minDirection;
  117. tolua_property__get_set const Vector3& maxDirection;
  118. tolua_property__get_set const Vector3& constantForce;
  119. tolua_property__get_set float dampingForce;
  120. tolua_property__get_set float activeTime;
  121. tolua_property__get_set float inactiveTime;
  122. tolua_property__get_set float minEmissionRate;
  123. tolua_property__get_set float maxEmissionRate;
  124. tolua_property__get_set const Vector2& minParticleSize;
  125. tolua_property__get_set const Vector2& maxParticleSize;
  126. tolua_property__get_set float minTimeToLive;
  127. tolua_property__get_set float maxTimeToLive;
  128. tolua_property__get_set float minVelocity;
  129. tolua_property__get_set float maxVelocity;
  130. tolua_property__get_set float minRotation;
  131. tolua_property__get_set float maxRotation;
  132. tolua_property__get_set float minRotationSpeed;
  133. tolua_property__get_set float maxRotationSpeed;
  134. tolua_property__get_set float sizeAdd;
  135. tolua_property__get_set float sizeMul;
  136. tolua_property__get_set unsigned numColorFrames;
  137. tolua_property__get_set unsigned numTextureFrames;
  138. };
  139. ${
  140. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_ParticleEffect_new00
  141. static int tolua_GraphicsLuaAPI_ParticleEffect_new00(lua_State* tolua_S)
  142. {
  143. return ToluaNewObject<ParticleEffect>(tolua_S);
  144. }
  145. #define TOLUA_DISABLE_tolua_GraphicsLuaAPI_ParticleEffect_new00_local
  146. static int tolua_GraphicsLuaAPI_ParticleEffect_new00_local(lua_State* tolua_S)
  147. {
  148. return ToluaNewObjectGC<ParticleEffect>(tolua_S);
  149. }
  150. static ParticleEffect* ParticleEffectClone(const ParticleEffect* effect, const String& cloneName = String::EMPTY)
  151. {
  152. if (!effect)
  153. return 0;
  154. return effect->Clone(cloneName).Detach();
  155. }
  156. $}