SceneMesh.lua 5.9 KB

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