SceneMesh.lua 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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:getShaderPass(index)
  72. local retVal = Polycode.SceneMesh_getShaderPass(self.__ptr, index)
  73. if retVal == nil then return nil end
  74. local __c = _G["ShaderPass"]("__skip_ptr__")
  75. __c.__ptr = retVal
  76. return __c
  77. end
  78. function SceneMesh:getNumShaderPasses()
  79. local retVal = Polycode.SceneMesh_getNumShaderPasses(self.__ptr)
  80. return retVal
  81. end
  82. function SceneMesh:addShaderPass(pass)
  83. local retVal = Polycode.SceneMesh_addShaderPass(self.__ptr, pass.__ptr)
  84. end
  85. function SceneMesh:removeShaderPass(shaderIndex)
  86. local retVal = Polycode.SceneMesh_removeShaderPass(self.__ptr, shaderIndex)
  87. end
  88. function SceneMesh:getMesh()
  89. local retVal = Polycode.SceneMesh_getMesh(self.__ptr)
  90. if retVal == nil then return nil end
  91. local __c = _G["shared_ptr<Mesh>"]("__skip_ptr__")
  92. __c.__ptr = retVal
  93. return __c
  94. end
  95. function SceneMesh:getMaterial()
  96. local retVal = Polycode.SceneMesh_getMaterial(self.__ptr)
  97. if retVal == nil then return nil end
  98. local __c = _G["shared_ptr<Material>"]("__skip_ptr__")
  99. __c.__ptr = retVal
  100. return __c
  101. end
  102. function SceneMesh:clearMaterial()
  103. local retVal = Polycode.SceneMesh_clearMaterial(self.__ptr)
  104. end
  105. function SceneMesh:setMaterial(material)
  106. local retVal = Polycode.SceneMesh_setMaterial(self.__ptr, material.__ptr)
  107. end
  108. function SceneMesh:setMesh(mesh)
  109. local retVal = Polycode.SceneMesh_setMesh(self.__ptr, mesh.__ptr)
  110. end
  111. function SceneMesh:setSkeleton(skeleton)
  112. local retVal = Polycode.SceneMesh_setSkeleton(self.__ptr, skeleton.__ptr)
  113. end
  114. function SceneMesh:getSkeleton()
  115. local retVal = Polycode.SceneMesh_getSkeleton(self.__ptr)
  116. if retVal == nil then return nil end
  117. local __c = _G["shared_ptr<Skeleton>"]("__skip_ptr__")
  118. __c.__ptr = retVal
  119. return __c
  120. end
  121. function SceneMesh:setLineWidth(newWidth)
  122. local retVal = Polycode.SceneMesh_setLineWidth(self.__ptr, newWidth)
  123. end
  124. function SceneMesh:getFilename()
  125. local retVal = Polycode.SceneMesh_getFilename(self.__ptr)
  126. return retVal
  127. end
  128. function SceneMesh:setFilename(fileName)
  129. local retVal = Polycode.SceneMesh_setFilename(self.__ptr, fileName)
  130. end
  131. function SceneMesh:customHitDetection(ray)
  132. local retVal = Polycode.SceneMesh_customHitDetection(self.__ptr, ray.__ptr)
  133. return retVal
  134. end
  135. function SceneMesh:setForceMaterial(forceMaterial)
  136. local retVal = Polycode.SceneMesh_setForceMaterial(self.__ptr, forceMaterial)
  137. end
  138. function SceneMesh:getForceMaterial()
  139. local retVal = Polycode.SceneMesh_getForceMaterial(self.__ptr)
  140. return retVal
  141. end
  142. function SceneMesh:__delete()
  143. if self then Polycode.delete_SceneMesh(self.__ptr) end
  144. end