Particle.lua 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. class "Particle"
  2. BILLBOARD_PARTICLE = 0
  3. MESH_PARTICLE = 1
  4. function Particle:__index__(name)
  5. if name == "life" then
  6. return Polycore.Particle_get_life(self.__ptr)
  7. elseif name == "lifespan" then
  8. return Polycore.Particle_get_lifespan(self.__ptr)
  9. elseif name == "brightnessDeviation" then
  10. return Polycore.Particle_get_brightnessDeviation(self.__ptr)
  11. elseif name == "perlinPosX" then
  12. return Polycore.Particle_get_perlinPosX(self.__ptr)
  13. elseif name == "perlinPosY" then
  14. return Polycore.Particle_get_perlinPosY(self.__ptr)
  15. elseif name == "perlinPosZ" then
  16. return Polycore.Particle_get_perlinPosZ(self.__ptr)
  17. end
  18. end
  19. function Particle:__set_callback(name,value)
  20. if name == "life" then
  21. Polycore.Particle_set_life(self.__ptr, value)
  22. return true
  23. elseif name == "lifespan" then
  24. Polycore.Particle_set_lifespan(self.__ptr, value)
  25. return true
  26. elseif name == "brightnessDeviation" then
  27. Polycore.Particle_set_brightnessDeviation(self.__ptr, value)
  28. return true
  29. elseif name == "perlinPosX" then
  30. Polycore.Particle_set_perlinPosX(self.__ptr, value)
  31. return true
  32. elseif name == "perlinPosY" then
  33. Polycore.Particle_set_perlinPosY(self.__ptr, value)
  34. return true
  35. elseif name == "perlinPosZ" then
  36. Polycore.Particle_set_perlinPosZ(self.__ptr, value)
  37. return true
  38. end
  39. return false
  40. end
  41. function Particle:Particle(...)
  42. for k,v in pairs(arg) do
  43. if type(v) == "table" then
  44. if v.__ptr ~= nil then
  45. arg[k] = v.__ptr
  46. end
  47. end
  48. end
  49. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  50. self.__ptr = Polycore.Particle(unpack(arg))
  51. end
  52. end
  53. function Particle:Reset(continuious)
  54. local retVal = Polycore.Particle_Reset(self.__ptr, continuious)
  55. end
  56. function Particle:createSceneParticle(particleType, texture, particleMesh)
  57. local retVal = Polycore.Particle_createSceneParticle(self.__ptr, particleType, texture.__ptr, particleMesh.__ptr)
  58. end
  59. function Particle:createScreenParticle(particleType, texture, particleMesh)
  60. local retVal = Polycore.Particle_createScreenParticle(self.__ptr, particleType, texture.__ptr, particleMesh.__ptr)
  61. end