ParticleEffect.pkg 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. $#include "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. void SetMaterial(Material* material);
  27. void SetNumParticles(unsigned num);
  28. void SetUpdateInvisible(bool enable);
  29. void SetRelative(bool enable);
  30. void SetScaled(bool enable);
  31. void SetSorted(bool enable);
  32. void SetAnimationLodBias(float lodBias);
  33. void SetEmitterType(EmitterType type);
  34. void SetEmitterSize(const Vector3& size);
  35. void SetMinDirection(const Vector3& direction);
  36. void SetMaxDirection(const Vector3& direction);
  37. void SetConstantForce(const Vector3& force);
  38. void SetDampingForce(float force);
  39. void SetActiveTime(float time);
  40. void SetInactiveTime(float time);
  41. void SetMinEmissionRate(float rate);
  42. void SetMaxEmissionRate(float rate);
  43. void SetMinParticleSize(const Vector2& size);
  44. void SetMaxParticleSize(const Vector2& size);
  45. void SetMinTimeToLive(float time);
  46. void SetMaxTimeToLive(float time);
  47. void SetMinVelocity(float velocity);
  48. void SetMaxVelocity(float velocity);
  49. void SetMinRotation(float rotation);
  50. void SetMaxRotation(float rotation);
  51. void SetMinRotationSpeed(float speed);
  52. void SetMaxRotationSpeed(float speed);
  53. void SetSizeAdd(float sizeAdd);
  54. void SetSizeMul(float sizeMul);
  55. void SetColorFrame(unsigned index, const ColorFrame& colorFrame);
  56. void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
  57. Material* GetMaterial() const;
  58. unsigned GetNumParticles() const;
  59. bool GetUpdateInvisible() const;
  60. bool IsRelative() const;
  61. bool IsScaled() const;
  62. bool IsSorted() const;
  63. float GetAnimationLodBias() const;
  64. EmitterType GetEmitterType() const;
  65. const Vector3& GetEmitterSize() const;
  66. const Vector3& GetMinDirection() const;
  67. const Vector3& GetMaxDirection() const;
  68. const Vector3& GetConstantForce() const;
  69. float GetDampingForce() const;
  70. float GetActiveTime() const;
  71. float GetInactiveTime() const;
  72. float GetMinEmissionRate() const;
  73. float GetMaxEmissionRate() const;
  74. const Vector2& GetMinParticleSize() const;
  75. const Vector2& GetMaxParticleSize() const;
  76. float GetMinTimeToLive() const;
  77. float GetMaxTimeToLive() const;
  78. float GetMinVelocity() const;
  79. float GetMaxVelocity() const;
  80. float GetMinRotation() const;
  81. float GetMaxRotation() const;
  82. float GetMinRotationSpeed() const;
  83. float GetMaxRotationSpeed() const;
  84. float GetSizeAdd() const;
  85. float GetSizeMul() const;
  86. unsigned GetNumColorFrames() const;
  87. const ColorFrame* GetColorFrame(unsigned index) const;
  88. unsigned GetNumTextureFrames() const;
  89. const TextureFrame* GetTextureFrame(unsigned index) const;
  90. tolua_property__get_set Material* material;
  91. tolua_property__get_set unsigned numParticles;
  92. tolua_property__get_set bool updateInvisible;
  93. tolua_property__is_set bool relative;
  94. tolua_property__is_set bool scaled;
  95. tolua_property__is_set bool sorted;
  96. tolua_property__get_set float animationLodBias;
  97. tolua_property__get_set EmitterType emitterType;
  98. tolua_property__get_set const Vector3& emitterSize;
  99. tolua_property__get_set const Vector3& minDirection;
  100. tolua_property__get_set const Vector3& maxDirection;
  101. tolua_property__get_set const Vector3& constantForce;
  102. tolua_property__get_set float dampingForce;
  103. tolua_property__get_set float activeTime;
  104. tolua_property__get_set float inactiveTime;
  105. tolua_property__get_set float minEmissionRate;
  106. tolua_property__get_set float maxEmissionRate;
  107. tolua_property__get_set const Vector2& minParticleSize;
  108. tolua_property__get_set const Vector2& maxParticleSize;
  109. tolua_property__get_set float minTimeToLive;
  110. tolua_property__get_set float maxTimeToLive;
  111. tolua_property__get_set float minVelocity;
  112. tolua_property__get_set float maxVelocity;
  113. tolua_property__get_set float minRotation;
  114. tolua_property__get_set float maxRotation;
  115. tolua_property__get_set float minRotationSpeed;
  116. tolua_property__get_set float maxRotationSpeed;
  117. tolua_property__get_set float sizeAdd;
  118. tolua_property__get_set float sizeMul;
  119. tolua_property__get_set unsigned numColorFrames;
  120. tolua_property__get_set unsigned numTextureFrames;
  121. };