SceneMesh.lua 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. require "Polycode/Entity"
  2. class "SceneMesh" (Entity)
  3. function SceneMesh:__getvar(name)
  4. if name == "lineWidth" then
  5. return Polycode.SceneMesh_get_lineWidth(self.__ptr)
  6. elseif name == "lineSmooth" then
  7. return Polycode.SceneMesh_get_lineSmooth(self.__ptr)
  8. elseif name == "pointSmooth" then
  9. return Polycode.SceneMesh_get_pointSmooth(self.__ptr)
  10. elseif name == "ownsMesh" then
  11. return Polycode.SceneMesh_get_ownsMesh(self.__ptr)
  12. elseif name == "ownsSkeleton" then
  13. return Polycode.SceneMesh_get_ownsSkeleton(self.__ptr)
  14. elseif name == "useGeometryHitDetection" then
  15. return Polycode.SceneMesh_get_useGeometryHitDetection(self.__ptr)
  16. elseif name == "alphaTest" then
  17. return Polycode.SceneMesh_get_alphaTest(self.__ptr)
  18. elseif name == "backfaceCulled" then
  19. return Polycode.SceneMesh_get_backfaceCulled(self.__ptr)
  20. elseif name == "sendBoneMatricesToMaterial" then
  21. return Polycode.SceneMesh_get_sendBoneMatricesToMaterial(self.__ptr)
  22. end
  23. if Entity["__getvar"] ~= nil then
  24. return Entity.__getvar(self, name)
  25. end
  26. end
  27. function SceneMesh:__setvar(name,value)
  28. if name == "lineWidth" then
  29. Polycode.SceneMesh_set_lineWidth(self.__ptr, value)
  30. return true
  31. elseif name == "lineSmooth" then
  32. Polycode.SceneMesh_set_lineSmooth(self.__ptr, value)
  33. return true
  34. elseif name == "pointSmooth" then
  35. Polycode.SceneMesh_set_pointSmooth(self.__ptr, value)
  36. return true
  37. elseif name == "ownsMesh" then
  38. Polycode.SceneMesh_set_ownsMesh(self.__ptr, value)
  39. return true
  40. elseif name == "ownsSkeleton" then
  41. Polycode.SceneMesh_set_ownsSkeleton(self.__ptr, value)
  42. return true
  43. elseif name == "useGeometryHitDetection" then
  44. Polycode.SceneMesh_set_useGeometryHitDetection(self.__ptr, value)
  45. return true
  46. elseif name == "alphaTest" then
  47. Polycode.SceneMesh_set_alphaTest(self.__ptr, value)
  48. return true
  49. elseif name == "backfaceCulled" then
  50. Polycode.SceneMesh_set_backfaceCulled(self.__ptr, value)
  51. return true
  52. elseif name == "sendBoneMatricesToMaterial" then
  53. Polycode.SceneMesh_set_sendBoneMatricesToMaterial(self.__ptr, value)
  54. return true
  55. end
  56. if Entity["__setvar"] ~= nil then
  57. return Entity.__setvar(self, name, value)
  58. else
  59. return false
  60. end
  61. end
  62. function SceneMesh:SceneMesh(...)
  63. local arg = {...}
  64. if type(arg[1]) == "table" and count(arg) == 1 then
  65. if ""..arg[1].__classname == "Entity" then
  66. self.__ptr = arg[1].__ptr
  67. return
  68. end
  69. end
  70. for k,v in pairs(arg) do
  71. if type(v) == "table" then
  72. if v.__ptr ~= nil then
  73. arg[k] = v.__ptr
  74. end
  75. end
  76. end
  77. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  78. self.__ptr = Polycode.SceneMesh(unpack(arg))
  79. end
  80. end
  81. function SceneMesh:SceneMeshFromMesh(mesh)
  82. local retVal = Polycode.SceneMesh_SceneMeshFromMesh(self.__ptr, mesh.__ptr)
  83. if retVal == nil then return nil end
  84. local __c = _G["SceneMesh"]("__skip_ptr__")
  85. __c.__ptr = retVal
  86. return __c
  87. end
  88. function SceneMesh:Render(buffer)
  89. local retVal = Polycode.SceneMesh_Render(self.__ptr, buffer.__ptr)
  90. end
  91. function SceneMesh:getShaderPass(index)
  92. local retVal = Polycode.SceneMesh_getShaderPass(self.__ptr, index)
  93. if retVal == nil then return nil end
  94. local __c = _G["ShaderPass"]("__skip_ptr__")
  95. __c.__ptr = retVal
  96. return __c
  97. end
  98. function SceneMesh:getNumShaderPasses()
  99. local retVal = Polycode.SceneMesh_getNumShaderPasses(self.__ptr)
  100. return retVal
  101. end
  102. function SceneMesh:addShaderPass(pass)
  103. local retVal = Polycode.SceneMesh_addShaderPass(self.__ptr, pass.__ptr)
  104. end
  105. function SceneMesh:removeShaderPass(shaderIndex)
  106. local retVal = Polycode.SceneMesh_removeShaderPass(self.__ptr, shaderIndex)
  107. end
  108. function SceneMesh:getMesh()
  109. local retVal = Polycode.SceneMesh_getMesh(self.__ptr)
  110. if retVal == nil then return nil end
  111. local __c = _G["Mesh"]("__skip_ptr__")
  112. __c.__ptr = retVal
  113. return __c
  114. end
  115. function SceneMesh:getMaterial()
  116. local retVal = Polycode.SceneMesh_getMaterial(self.__ptr)
  117. if retVal == nil then return nil end
  118. local __c = _G["Material"]("__skip_ptr__")
  119. __c.__ptr = retVal
  120. return __c
  121. end
  122. function SceneMesh:loadSkeleton(fileName)
  123. local retVal = Polycode.SceneMesh_loadSkeleton(self.__ptr, fileName)
  124. if retVal == nil then return nil end
  125. local __c = _G["Skeleton"]("__skip_ptr__")
  126. __c.__ptr = retVal
  127. return __c
  128. end
  129. function SceneMesh:clearMaterial()
  130. local retVal = Polycode.SceneMesh_clearMaterial(self.__ptr)
  131. end
  132. function SceneMesh:setMaterial(material)
  133. local retVal = Polycode.SceneMesh_setMaterial(self.__ptr, material.__ptr)
  134. end
  135. function SceneMesh:setMaterialByName(materialName, resourcePool)
  136. local retVal = Polycode.SceneMesh_setMaterialByName(self.__ptr, materialName, resourcePool.__ptr)
  137. end
  138. function SceneMesh:setMesh(mesh)
  139. local retVal = Polycode.SceneMesh_setMesh(self.__ptr, mesh.__ptr)
  140. end
  141. function SceneMesh:setSkeleton(skeleton)
  142. local retVal = Polycode.SceneMesh_setSkeleton(self.__ptr, skeleton.__ptr)
  143. end
  144. function SceneMesh:getSkeleton()
  145. local retVal = Polycode.SceneMesh_getSkeleton(self.__ptr)
  146. if retVal == nil then return nil end
  147. local __c = _G["Skeleton"]("__skip_ptr__")
  148. __c.__ptr = retVal
  149. return __c
  150. end
  151. function SceneMesh:applySkeletonLocally()
  152. local retVal = Polycode.SceneMesh_applySkeletonLocally(self.__ptr)
  153. end
  154. function SceneMesh:setLineWidth(newWidth)
  155. local retVal = Polycode.SceneMesh_setLineWidth(self.__ptr, newWidth)
  156. end
  157. function SceneMesh:getFilename()
  158. local retVal = Polycode.SceneMesh_getFilename(self.__ptr)
  159. return retVal
  160. end
  161. function SceneMesh:setFilename(fileName)
  162. local retVal = Polycode.SceneMesh_setFilename(self.__ptr, fileName)
  163. end
  164. function SceneMesh:loadFromFile(fileName)
  165. local retVal = Polycode.SceneMesh_loadFromFile(self.__ptr, fileName)
  166. end
  167. function SceneMesh:customHitDetection(ray)
  168. local retVal = Polycode.SceneMesh_customHitDetection(self.__ptr, ray.__ptr)
  169. return retVal
  170. end
  171. function SceneMesh:setForceMaterial(forceMaterial)
  172. local retVal = Polycode.SceneMesh_setForceMaterial(self.__ptr, forceMaterial)
  173. end
  174. function SceneMesh:getForceMaterial()
  175. local retVal = Polycode.SceneMesh_getForceMaterial(self.__ptr)
  176. return retVal
  177. end
  178. function SceneMesh:Clone(deepClone, ignoreEditorOnly)
  179. local retVal = Polycode.SceneMesh_Clone(self.__ptr, deepClone, ignoreEditorOnly)
  180. if retVal == nil then return nil end
  181. local __c = _G["Entity"]("__skip_ptr__")
  182. __c.__ptr = retVal
  183. return __c
  184. end
  185. function SceneMesh:applyClone(clone, deepClone, ignoreEditorOnly)
  186. local retVal = Polycode.SceneMesh_applyClone(self.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
  187. end
  188. function SceneMesh:__delete()
  189. if self then Polycode.delete_SceneMesh(self.__ptr) end
  190. end