SceneMesh.lua 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. require "Polycode/Entity"
  2. class "SceneMesh" (Entity)
  3. function SceneMesh:__getvar(name)
  4. if name == "lineWidth" then
  5. return Polycore.SceneMesh_get_lineWidth(self.__ptr)
  6. elseif name == "lineSmooth" then
  7. return Polycore.SceneMesh_get_lineSmooth(self.__ptr)
  8. elseif name == "pointSmooth" then
  9. return Polycore.SceneMesh_get_pointSmooth(self.__ptr)
  10. elseif name == "ownsMesh" then
  11. return Polycore.SceneMesh_get_ownsMesh(self.__ptr)
  12. elseif name == "ownsSkeleton" then
  13. return Polycore.SceneMesh_get_ownsSkeleton(self.__ptr)
  14. elseif name == "useGeometryHitDetection" then
  15. return Polycore.SceneMesh_get_useGeometryHitDetection(self.__ptr)
  16. elseif name == "alphaTest" then
  17. return Polycore.SceneMesh_get_alphaTest(self.__ptr)
  18. elseif name == "backfaceCulled" then
  19. return Polycore.SceneMesh_get_backfaceCulled(self.__ptr)
  20. elseif name == "sendBoneMatricesToMaterial" then
  21. return Polycore.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. Polycore.SceneMesh_set_lineWidth(self.__ptr, value)
  30. return true
  31. elseif name == "lineSmooth" then
  32. Polycore.SceneMesh_set_lineSmooth(self.__ptr, value)
  33. return true
  34. elseif name == "pointSmooth" then
  35. Polycore.SceneMesh_set_pointSmooth(self.__ptr, value)
  36. return true
  37. elseif name == "ownsMesh" then
  38. Polycore.SceneMesh_set_ownsMesh(self.__ptr, value)
  39. return true
  40. elseif name == "ownsSkeleton" then
  41. Polycore.SceneMesh_set_ownsSkeleton(self.__ptr, value)
  42. return true
  43. elseif name == "useGeometryHitDetection" then
  44. Polycore.SceneMesh_set_useGeometryHitDetection(self.__ptr, value)
  45. return true
  46. elseif name == "alphaTest" then
  47. Polycore.SceneMesh_set_alphaTest(self.__ptr, value)
  48. return true
  49. elseif name == "backfaceCulled" then
  50. Polycore.SceneMesh_set_backfaceCulled(self.__ptr, value)
  51. return true
  52. elseif name == "sendBoneMatricesToMaterial" then
  53. Polycore.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 = Polycore.SceneMesh(unpack(arg))
  79. end
  80. end
  81. function SceneMesh.SceneMeshFromMesh(mesh)
  82. local retVal = Polycore.SceneMesh_SceneMeshFromMesh(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.SceneMeshWithType(meshType)
  89. local retVal = Polycore.SceneMesh_SceneMeshWithType(meshType)
  90. if retVal == nil then return nil end
  91. local __c = _G["SceneMesh"]("__skip_ptr__")
  92. __c.__ptr = retVal
  93. return __c
  94. end
  95. function SceneMesh:Render(buffer)
  96. local retVal = Polycore.SceneMesh_Render(self.__ptr, buffer.__ptr)
  97. end
  98. function SceneMesh:getShaderPass(index)
  99. local retVal = Polycore.SceneMesh_getShaderPass(self.__ptr, index)
  100. if retVal == nil then return nil end
  101. local __c = _G["ShaderPass"]("__skip_ptr__")
  102. __c.__ptr = retVal
  103. return __c
  104. end
  105. function SceneMesh:getNumShaderPasses()
  106. local retVal = Polycore.SceneMesh_getNumShaderPasses(self.__ptr)
  107. return retVal
  108. end
  109. function SceneMesh:addShaderPass(pass)
  110. local retVal = Polycore.SceneMesh_addShaderPass(self.__ptr, pass.__ptr)
  111. end
  112. function SceneMesh:removeShaderPass(shaderIndex)
  113. local retVal = Polycore.SceneMesh_removeShaderPass(self.__ptr, shaderIndex)
  114. end
  115. function SceneMesh:getMesh()
  116. local retVal = Polycore.SceneMesh_getMesh(self.__ptr)
  117. if retVal == nil then return nil end
  118. local __c = _G["Mesh"]("__skip_ptr__")
  119. __c.__ptr = retVal
  120. return __c
  121. end
  122. function SceneMesh:getMaterial()
  123. local retVal = Polycore.SceneMesh_getMaterial(self.__ptr)
  124. if retVal == nil then return nil end
  125. local __c = _G["Material"]("__skip_ptr__")
  126. __c.__ptr = retVal
  127. return __c
  128. end
  129. function SceneMesh:loadSkeleton(fileName)
  130. local retVal = Polycore.SceneMesh_loadSkeleton(self.__ptr, fileName)
  131. if retVal == nil then return nil end
  132. local __c = _G["Skeleton"]("__skip_ptr__")
  133. __c.__ptr = retVal
  134. return __c
  135. end
  136. function SceneMesh:clearMaterial()
  137. local retVal = Polycore.SceneMesh_clearMaterial(self.__ptr)
  138. end
  139. function SceneMesh:setMaterial(material)
  140. local retVal = Polycore.SceneMesh_setMaterial(self.__ptr, material.__ptr)
  141. end
  142. function SceneMesh:rebuildAttributes()
  143. local retVal = Polycore.SceneMesh_rebuildAttributes(self.__ptr)
  144. end
  145. function SceneMesh:setMaterialByName(materialName, resourcePool)
  146. local retVal = Polycore.SceneMesh_setMaterialByName(self.__ptr, materialName, resourcePool.__ptr)
  147. end
  148. function SceneMesh:setMesh(mesh)
  149. local retVal = Polycore.SceneMesh_setMesh(self.__ptr, mesh.__ptr)
  150. end
  151. function SceneMesh:setSkeleton(skeleton)
  152. local retVal = Polycore.SceneMesh_setSkeleton(self.__ptr, skeleton.__ptr)
  153. end
  154. function SceneMesh:getSkeleton()
  155. local retVal = Polycore.SceneMesh_getSkeleton(self.__ptr)
  156. if retVal == nil then return nil end
  157. local __c = _G["Skeleton"]("__skip_ptr__")
  158. __c.__ptr = retVal
  159. return __c
  160. end
  161. function SceneMesh:applySkeletonLocally()
  162. local retVal = Polycore.SceneMesh_applySkeletonLocally(self.__ptr)
  163. end
  164. function SceneMesh:setLineWidth(newWidth)
  165. local retVal = Polycore.SceneMesh_setLineWidth(self.__ptr, newWidth)
  166. end
  167. function SceneMesh:getFilename()
  168. local retVal = Polycore.SceneMesh_getFilename(self.__ptr)
  169. return retVal
  170. end
  171. function SceneMesh:setFilename(fileName)
  172. local retVal = Polycore.SceneMesh_setFilename(self.__ptr, fileName)
  173. end
  174. function SceneMesh:loadFromFile(fileName)
  175. local retVal = Polycore.SceneMesh_loadFromFile(self.__ptr, fileName)
  176. end
  177. function SceneMesh:customHitDetection(ray)
  178. local retVal = Polycore.SceneMesh_customHitDetection(self.__ptr, ray.__ptr)
  179. return retVal
  180. end
  181. function SceneMesh:setForceMaterial(forceMaterial)
  182. local retVal = Polycore.SceneMesh_setForceMaterial(self.__ptr, forceMaterial)
  183. end
  184. function SceneMesh:getForceMaterial()
  185. local retVal = Polycore.SceneMesh_getForceMaterial(self.__ptr)
  186. return retVal
  187. end
  188. function SceneMesh:Clone(deepClone, ignoreEditorOnly)
  189. local retVal = Polycore.SceneMesh_Clone(self.__ptr, deepClone, ignoreEditorOnly)
  190. if retVal == nil then return nil end
  191. local __c = _G["Entity"]("__skip_ptr__")
  192. __c.__ptr = retVal
  193. return __c
  194. end
  195. function SceneMesh:applyClone(clone, deepClone, ignoreEditorOnly)
  196. local retVal = Polycore.SceneMesh_applyClone(self.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
  197. end
  198. function SceneMesh:__delete()
  199. if self then Polycore.delete_SceneMesh(self.__ptr) end
  200. end