SceneMesh.lua 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 == "backfaceCulled" then
  13. return Polycode.SceneMesh_get_backfaceCulled(self.__ptr)
  14. elseif name == "sendBoneMatricesToMaterial" then
  15. return Polycode.SceneMesh_get_sendBoneMatricesToMaterial(self.__ptr)
  16. end
  17. if Entity["__getvar"] ~= nil then
  18. return Entity.__getvar(self, name)
  19. end
  20. end
  21. function SceneMesh:__setvar(name,value)
  22. if name == "lineWidth" then
  23. Polycode.SceneMesh_set_lineWidth(self.__ptr, value)
  24. return true
  25. elseif name == "lineSmooth" then
  26. Polycode.SceneMesh_set_lineSmooth(self.__ptr, value)
  27. return true
  28. elseif name == "pointSmooth" then
  29. Polycode.SceneMesh_set_pointSmooth(self.__ptr, value)
  30. return true
  31. elseif name == "useGeometryHitDetection" then
  32. Polycode.SceneMesh_set_useGeometryHitDetection(self.__ptr, value)
  33. return true
  34. elseif name == "backfaceCulled" then
  35. Polycode.SceneMesh_set_backfaceCulled(self.__ptr, value)
  36. return true
  37. elseif name == "sendBoneMatricesToMaterial" then
  38. Polycode.SceneMesh_set_sendBoneMatricesToMaterial(self.__ptr, value)
  39. return true
  40. end
  41. if Entity["__setvar"] ~= nil then
  42. return Entity.__setvar(self, name, value)
  43. else
  44. return false
  45. end
  46. end
  47. function SceneMesh:SceneMesh(...)
  48. local arg = {...}
  49. if type(arg[1]) == "table" and count(arg) == 1 then
  50. if ""..arg[1].__classname == "Entity" then
  51. self.__ptr = arg[1].__ptr
  52. return
  53. end
  54. end
  55. for k,v in pairs(arg) do
  56. if type(v) == "table" then
  57. if v.__ptr ~= nil then
  58. arg[k] = v.__ptr
  59. end
  60. end
  61. end
  62. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  63. self.__ptr = Polycode.SceneMesh(unpack(arg))
  64. end
  65. end
  66. function SceneMesh:getShaderPass(index)
  67. local retVal = Polycode.SceneMesh_getShaderPass(self.__ptr, index)
  68. if retVal == nil then return nil end
  69. local __c = _G["ShaderPass"]("__skip_ptr__")
  70. __c.__ptr = retVal
  71. return __c
  72. end
  73. function SceneMesh:getNumShaderPasses()
  74. local retVal = Polycode.SceneMesh_getNumShaderPasses(self.__ptr)
  75. return retVal
  76. end
  77. function SceneMesh:addShaderPass(pass)
  78. local retVal = Polycode.SceneMesh_addShaderPass(self.__ptr, pass.__ptr)
  79. end
  80. function SceneMesh:removeShaderPass(shaderIndex)
  81. local retVal = Polycode.SceneMesh_removeShaderPass(self.__ptr, shaderIndex)
  82. end
  83. function SceneMesh:getMesh()
  84. local retVal = Polycode.SceneMesh_getMesh(self.__ptr)
  85. if retVal == nil then return nil end
  86. local __c = _G["shared_ptr<Mesh>"]("__skip_ptr__")
  87. __c.__ptr = retVal
  88. return __c
  89. end
  90. function SceneMesh:getMaterial()
  91. local retVal = Polycode.SceneMesh_getMaterial(self.__ptr)
  92. if retVal == nil then return nil end
  93. local __c = _G["shared_ptr<Material>"]("__skip_ptr__")
  94. __c.__ptr = retVal
  95. return __c
  96. end
  97. function SceneMesh:clearMaterial()
  98. local retVal = Polycode.SceneMesh_clearMaterial(self.__ptr)
  99. end
  100. function SceneMesh:setMaterial(material)
  101. local retVal = Polycode.SceneMesh_setMaterial(self.__ptr, material.__ptr)
  102. end
  103. function SceneMesh:setMesh(mesh)
  104. local retVal = Polycode.SceneMesh_setMesh(self.__ptr, mesh.__ptr)
  105. end
  106. function SceneMesh:setSkeleton(skeleton)
  107. local retVal = Polycode.SceneMesh_setSkeleton(self.__ptr, skeleton.__ptr)
  108. end
  109. function SceneMesh:getSkeleton()
  110. local retVal = Polycode.SceneMesh_getSkeleton(self.__ptr)
  111. if retVal == nil then return nil end
  112. local __c = _G["shared_ptr<Skeleton>"]("__skip_ptr__")
  113. __c.__ptr = retVal
  114. return __c
  115. end
  116. function SceneMesh:setLineWidth(newWidth)
  117. local retVal = Polycode.SceneMesh_setLineWidth(self.__ptr, newWidth)
  118. end
  119. function SceneMesh:getFilename()
  120. local retVal = Polycode.SceneMesh_getFilename(self.__ptr)
  121. return retVal
  122. end
  123. function SceneMesh:setFilename(fileName)
  124. local retVal = Polycode.SceneMesh_setFilename(self.__ptr, fileName)
  125. end
  126. function SceneMesh:customHitDetection(ray)
  127. local retVal = Polycode.SceneMesh_customHitDetection(self.__ptr, ray.__ptr)
  128. return retVal
  129. end
  130. function SceneMesh:setForceMaterial(forceMaterial)
  131. local retVal = Polycode.SceneMesh_setForceMaterial(self.__ptr, forceMaterial)
  132. end
  133. function SceneMesh:getForceMaterial()
  134. local retVal = Polycode.SceneMesh_getForceMaterial(self.__ptr)
  135. return retVal
  136. end
  137. function SceneMesh:__delete()
  138. if self then Polycode.delete_SceneMesh(self.__ptr) end
  139. end