SceneMesh.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. require "Polycode/SceneEntity"
  2. class "SceneMesh" (SceneEntity)
  3. function SceneMesh:__index__(name)
  4. if name == "showVertexNormals" then
  5. return Polycore.SceneMesh_get_showVertexNormals(self.__ptr)
  6. end
  7. end
  8. function SceneMesh:__set_callback(name,value)
  9. if name == "showVertexNormals" then
  10. Polycore.SceneMesh_set_showVertexNormals(self.__ptr, value)
  11. return true
  12. end
  13. return false
  14. end
  15. function SceneMesh:SceneMesh(...)
  16. for k,v in pairs(arg) do
  17. if type(v) == "table" then
  18. if v.__ptr ~= nil then
  19. arg[k] = v.__ptr
  20. end
  21. end
  22. end
  23. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  24. self.__ptr = Polycore.SceneMesh(unpack(arg))
  25. end
  26. end
  27. function SceneMesh:Render()
  28. local retVal = Polycore.SceneMesh_Render(self.__ptr)
  29. end
  30. function SceneMesh:getLocalShaderOptions()
  31. local retVal = Polycore.SceneMesh_getLocalShaderOptions(self.__ptr)
  32. if Polycore.__ptr_lookup[retVal] ~= nil then
  33. return Polycore.__ptr_lookup[retVal]
  34. else
  35. Polycore.__ptr_lookup[retVal] = ShaderBinding("__skip_ptr__")
  36. Polycore.__ptr_lookup[retVal].__ptr = retVal
  37. return Polycore.__ptr_lookup[retVal]
  38. end
  39. end
  40. function SceneMesh:getMesh()
  41. local retVal = Polycore.SceneMesh_getMesh(self.__ptr)
  42. if Polycore.__ptr_lookup[retVal] ~= nil then
  43. return Polycore.__ptr_lookup[retVal]
  44. else
  45. Polycore.__ptr_lookup[retVal] = Mesh("__skip_ptr__")
  46. Polycore.__ptr_lookup[retVal].__ptr = retVal
  47. return Polycore.__ptr_lookup[retVal]
  48. end
  49. end
  50. function SceneMesh:getTexture()
  51. local retVal = Polycore.SceneMesh_getTexture(self.__ptr)
  52. if Polycore.__ptr_lookup[retVal] ~= nil then
  53. return Polycore.__ptr_lookup[retVal]
  54. else
  55. Polycore.__ptr_lookup[retVal] = Texture("__skip_ptr__")
  56. Polycore.__ptr_lookup[retVal].__ptr = retVal
  57. return Polycore.__ptr_lookup[retVal]
  58. end
  59. end
  60. function SceneMesh:getMaterial()
  61. local retVal = Polycore.SceneMesh_getMaterial(self.__ptr)
  62. if Polycore.__ptr_lookup[retVal] ~= nil then
  63. return Polycore.__ptr_lookup[retVal]
  64. else
  65. Polycore.__ptr_lookup[retVal] = Material("__skip_ptr__")
  66. Polycore.__ptr_lookup[retVal].__ptr = retVal
  67. return Polycore.__ptr_lookup[retVal]
  68. end
  69. end
  70. function SceneMesh:loadTexture(fileName, clamp)
  71. local retVal = Polycore.SceneMesh_loadTexture(self.__ptr, fileName, clamp)
  72. end
  73. function SceneMesh:loadSkeleton(fileName)
  74. local retVal = Polycore.SceneMesh_loadSkeleton(self.__ptr, fileName)
  75. end
  76. function SceneMesh:setTexture(texture)
  77. local retVal = Polycore.SceneMesh_setTexture(self.__ptr, texture.__ptr)
  78. end
  79. function SceneMesh:setMaterial(material)
  80. local retVal = Polycore.SceneMesh_setMaterial(self.__ptr, material.__ptr)
  81. end
  82. function SceneMesh:setMaterialByName(materialName)
  83. local retVal = Polycore.SceneMesh_setMaterialByName(self.__ptr, materialName)
  84. end
  85. function SceneMesh:setMesh(mesh)
  86. local retVal = Polycore.SceneMesh_setMesh(self.__ptr, mesh.__ptr)
  87. end
  88. function SceneMesh:setSkeleton(skeleton)
  89. local retVal = Polycore.SceneMesh_setSkeleton(self.__ptr, skeleton.__ptr)
  90. end
  91. function SceneMesh:getSkeleton()
  92. local retVal = Polycore.SceneMesh_getSkeleton(self.__ptr)
  93. if Polycore.__ptr_lookup[retVal] ~= nil then
  94. return Polycore.__ptr_lookup[retVal]
  95. else
  96. Polycore.__ptr_lookup[retVal] = Skeleton("__skip_ptr__")
  97. Polycore.__ptr_lookup[retVal].__ptr = retVal
  98. return Polycore.__ptr_lookup[retVal]
  99. end
  100. end
  101. function SceneMesh:renderMeshLocally()
  102. local retVal = Polycore.SceneMesh_renderMeshLocally(self.__ptr)
  103. end
  104. function SceneMesh:cacheToVertexBuffer(cache)
  105. local retVal = Polycore.SceneMesh_cacheToVertexBuffer(self.__ptr, cache)
  106. end