ParticleEmitter.lua 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. class "ParticleEmitter"
  2. CONTINUOUS_EMITTER = 0
  3. TRIGGERED_EMITTER = 1
  4. function ParticleEmitter:__index__(name)
  5. if name == "particleSpeedMod" then
  6. return Polycore.ParticleEmitter_get_particleSpeedMod(self.__ptr)
  7. elseif name == "brightnessDeviation" then
  8. return Polycore.ParticleEmitter_get_brightnessDeviation(self.__ptr)
  9. elseif name == "deviation" then
  10. retVal = Polycore.ParticleEmitter_get_deviation(self.__ptr)
  11. if Polycore.__ptr_lookup[retVal] ~= nil then
  12. return Polycore.__ptr_lookup[retVal]
  13. else
  14. Polycore.__ptr_lookup[retVal] = Vector3("__skip_ptr__")
  15. Polycore.__ptr_lookup[retVal].__ptr = retVal
  16. return Polycore.__ptr_lookup[retVal]
  17. end
  18. elseif name == "dirVector" then
  19. retVal = Polycore.ParticleEmitter_get_dirVector(self.__ptr)
  20. if Polycore.__ptr_lookup[retVal] ~= nil then
  21. return Polycore.__ptr_lookup[retVal]
  22. else
  23. Polycore.__ptr_lookup[retVal] = Vector3("__skip_ptr__")
  24. Polycore.__ptr_lookup[retVal].__ptr = retVal
  25. return Polycore.__ptr_lookup[retVal]
  26. end
  27. elseif name == "gravVector" then
  28. retVal = Polycore.ParticleEmitter_get_gravVector(self.__ptr)
  29. if Polycore.__ptr_lookup[retVal] ~= nil then
  30. return Polycore.__ptr_lookup[retVal]
  31. else
  32. Polycore.__ptr_lookup[retVal] = Vector3("__skip_ptr__")
  33. Polycore.__ptr_lookup[retVal].__ptr = retVal
  34. return Polycore.__ptr_lookup[retVal]
  35. end
  36. elseif name == "lifespan" then
  37. return Polycore.ParticleEmitter_get_lifespan(self.__ptr)
  38. elseif name == "rotationFollowsPath" then
  39. return Polycore.ParticleEmitter_get_rotationFollowsPath(self.__ptr)
  40. elseif name == "scaleCurve" then
  41. retVal = Polycore.ParticleEmitter_get_scaleCurve(self.__ptr)
  42. if Polycore.__ptr_lookup[retVal] ~= nil then
  43. return Polycore.__ptr_lookup[retVal]
  44. else
  45. Polycore.__ptr_lookup[retVal] = BezierCurve("__skip_ptr__")
  46. Polycore.__ptr_lookup[retVal].__ptr = retVal
  47. return Polycore.__ptr_lookup[retVal]
  48. end
  49. elseif name == "colorCurveR" then
  50. retVal = Polycore.ParticleEmitter_get_colorCurveR(self.__ptr)
  51. if Polycore.__ptr_lookup[retVal] ~= nil then
  52. return Polycore.__ptr_lookup[retVal]
  53. else
  54. Polycore.__ptr_lookup[retVal] = BezierCurve("__skip_ptr__")
  55. Polycore.__ptr_lookup[retVal].__ptr = retVal
  56. return Polycore.__ptr_lookup[retVal]
  57. end
  58. elseif name == "colorCurveG" then
  59. retVal = Polycore.ParticleEmitter_get_colorCurveG(self.__ptr)
  60. if Polycore.__ptr_lookup[retVal] ~= nil then
  61. return Polycore.__ptr_lookup[retVal]
  62. else
  63. Polycore.__ptr_lookup[retVal] = BezierCurve("__skip_ptr__")
  64. Polycore.__ptr_lookup[retVal].__ptr = retVal
  65. return Polycore.__ptr_lookup[retVal]
  66. end
  67. elseif name == "colorCurveB" then
  68. retVal = Polycore.ParticleEmitter_get_colorCurveB(self.__ptr)
  69. if Polycore.__ptr_lookup[retVal] ~= nil then
  70. return Polycore.__ptr_lookup[retVal]
  71. else
  72. Polycore.__ptr_lookup[retVal] = BezierCurve("__skip_ptr__")
  73. Polycore.__ptr_lookup[retVal].__ptr = retVal
  74. return Polycore.__ptr_lookup[retVal]
  75. end
  76. elseif name == "colorCurveA" then
  77. retVal = Polycore.ParticleEmitter_get_colorCurveA(self.__ptr)
  78. if Polycore.__ptr_lookup[retVal] ~= nil then
  79. return Polycore.__ptr_lookup[retVal]
  80. else
  81. Polycore.__ptr_lookup[retVal] = BezierCurve("__skip_ptr__")
  82. Polycore.__ptr_lookup[retVal].__ptr = retVal
  83. return Polycore.__ptr_lookup[retVal]
  84. end
  85. elseif name == "useColorCurves" then
  86. return Polycore.ParticleEmitter_get_useColorCurves(self.__ptr)
  87. elseif name == "useScaleCurves" then
  88. return Polycore.ParticleEmitter_get_useScaleCurves(self.__ptr)
  89. end
  90. end
  91. function ParticleEmitter:__set_callback(name,value)
  92. if name == "particleSpeedMod" then
  93. Polycore.ParticleEmitter_set_particleSpeedMod(self.__ptr, value)
  94. return true
  95. elseif name == "brightnessDeviation" then
  96. Polycore.ParticleEmitter_set_brightnessDeviation(self.__ptr, value)
  97. return true
  98. elseif name == "lifespan" then
  99. Polycore.ParticleEmitter_set_lifespan(self.__ptr, value)
  100. return true
  101. elseif name == "rotationFollowsPath" then
  102. Polycore.ParticleEmitter_set_rotationFollowsPath(self.__ptr, value)
  103. return true
  104. elseif name == "useColorCurves" then
  105. Polycore.ParticleEmitter_set_useColorCurves(self.__ptr, value)
  106. return true
  107. elseif name == "useScaleCurves" then
  108. Polycore.ParticleEmitter_set_useScaleCurves(self.__ptr, value)
  109. return true
  110. end
  111. return false
  112. end
  113. function ParticleEmitter:ParticleEmitter(...)
  114. for k,v in pairs(arg) do
  115. if type(v) == "table" then
  116. if v.__ptr ~= nil then
  117. arg[k] = v.__ptr
  118. end
  119. end
  120. end
  121. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  122. self.__ptr = Polycore.ParticleEmitter(unpack(arg))
  123. Polycore.__ptr_lookup[self.__ptr] = self
  124. end
  125. end
  126. function ParticleEmitter:createParticles()
  127. local retVal = Polycore.ParticleEmitter_createParticles(self.__ptr)
  128. end
  129. function ParticleEmitter:setRotationSpeed(speed)
  130. local retVal = Polycore.ParticleEmitter_setRotationSpeed(self.__ptr, speed)
  131. end
  132. function ParticleEmitter:setParticleBlendingMode(mode)
  133. local retVal = Polycore.ParticleEmitter_setParticleBlendingMode(self.__ptr, mode)
  134. end
  135. function ParticleEmitter:setDepthWrite(val)
  136. local retVal = Polycore.ParticleEmitter_setDepthWrite(self.__ptr, val)
  137. end
  138. function ParticleEmitter:setDepthTest(val)
  139. local retVal = Polycore.ParticleEmitter_setDepthTest(self.__ptr, val)
  140. end
  141. function ParticleEmitter:setAlphaTest(val)
  142. local retVal = Polycore.ParticleEmitter_setAlphaTest(self.__ptr, val)
  143. end
  144. function ParticleEmitter:enablePerlin(val)
  145. local retVal = Polycore.ParticleEmitter_enablePerlin(self.__ptr, val)
  146. end
  147. function ParticleEmitter:setParticleVisibility(val)
  148. local retVal = Polycore.ParticleEmitter_setParticleVisibility(self.__ptr, val)
  149. end
  150. function ParticleEmitter:setPerlinModSize(size)
  151. local retVal = Polycore.ParticleEmitter_setPerlinModSize(self.__ptr, size)
  152. end
  153. function ParticleEmitter:setBillboardMode(mode)
  154. local retVal = Polycore.ParticleEmitter_setBillboardMode(self.__ptr, mode)
  155. end
  156. function ParticleEmitter:enableEmitter(val)
  157. local retVal = Polycore.ParticleEmitter_enableEmitter(self.__ptr, val)
  158. end
  159. function ParticleEmitter:emitterEnabled()
  160. local retVal = Polycore.ParticleEmitter_emitterEnabled(self.__ptr)
  161. return retVal
  162. end
  163. function ParticleEmitter:setEmitterRadius(rad)
  164. local retVal = Polycore.ParticleEmitter_setEmitterRadius(self.__ptr, rad.__ptr)
  165. end
  166. function ParticleEmitter:setAllAtOnce(val)
  167. local retVal = Polycore.ParticleEmitter_setAllAtOnce(self.__ptr, val)
  168. end
  169. function ParticleEmitter:Trigger()
  170. local retVal = Polycore.ParticleEmitter_Trigger(self.__ptr)
  171. end
  172. function ParticleEmitter:resetParticle(particle)
  173. local retVal = Polycore.ParticleEmitter_resetParticle(self.__ptr, particle.__ptr)
  174. end
  175. function ParticleEmitter:setParticleCount(count)
  176. local retVal = Polycore.ParticleEmitter_setParticleCount(self.__ptr, count)
  177. end
  178. function ParticleEmitter:addParticleBody(particleBody)
  179. local retVal = Polycore.ParticleEmitter_addParticleBody(self.__ptr, particleBody.__ptr)
  180. end
  181. function ParticleEmitter:getBaseMatrix()
  182. local retVal = Polycore.ParticleEmitter_getBaseMatrix(self.__ptr)
  183. if retVal == nil then return nil end
  184. if Polycore.__ptr_lookup[retVal] ~= nil then
  185. return Polycore.__ptr_lookup[retVal]
  186. else
  187. Polycore.__ptr_lookup[retVal] = Matrix4("__skip_ptr__")
  188. Polycore.__ptr_lookup[retVal].__ptr = retVal
  189. return Polycore.__ptr_lookup[retVal]
  190. end
  191. end
  192. function ParticleEmitter:updateEmitter()
  193. local retVal = Polycore.ParticleEmitter_updateEmitter(self.__ptr)
  194. end
  195. function ParticleEmitter:__delete()
  196. Polycore.__ptr_lookup[self.__ptr] = nil
  197. Polycore.delete_ParticleEmitter(self.__ptr)
  198. end