SceneMesh.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. Polycore.__ptr_lookup[self.__ptr] = self
  26. end
  27. end
  28. function SceneMesh:Render()
  29. local retVal = Polycore.SceneMesh_Render(self.__ptr)
  30. end
  31. function SceneMesh:getLocalShaderOptions()
  32. local retVal = Polycore.SceneMesh_getLocalShaderOptions(self.__ptr)
  33. if Polycore.__ptr_lookup[retVal] ~= nil then
  34. return Polycore.__ptr_lookup[retVal]
  35. else
  36. Polycore.__ptr_lookup[retVal] = ShaderBinding("__skip_ptr__")
  37. Polycore.__ptr_lookup[retVal].__ptr = retVal
  38. return Polycore.__ptr_lookup[retVal]
  39. end
  40. end
  41. function SceneMesh:getMesh()
  42. local retVal = Polycore.SceneMesh_getMesh(self.__ptr)
  43. if Polycore.__ptr_lookup[retVal] ~= nil then
  44. return Polycore.__ptr_lookup[retVal]
  45. else
  46. Polycore.__ptr_lookup[retVal] = Mesh("__skip_ptr__")
  47. Polycore.__ptr_lookup[retVal].__ptr = retVal
  48. return Polycore.__ptr_lookup[retVal]
  49. end
  50. end
  51. function SceneMesh:getTexture()
  52. local retVal = Polycore.SceneMesh_getTexture(self.__ptr)
  53. if Polycore.__ptr_lookup[retVal] ~= nil then
  54. return Polycore.__ptr_lookup[retVal]
  55. else
  56. Polycore.__ptr_lookup[retVal] = Texture("__skip_ptr__")
  57. Polycore.__ptr_lookup[retVal].__ptr = retVal
  58. return Polycore.__ptr_lookup[retVal]
  59. end
  60. end
  61. function SceneMesh:getMaterial()
  62. local retVal = Polycore.SceneMesh_getMaterial(self.__ptr)
  63. if Polycore.__ptr_lookup[retVal] ~= nil then
  64. return Polycore.__ptr_lookup[retVal]
  65. else
  66. Polycore.__ptr_lookup[retVal] = Material("__skip_ptr__")
  67. Polycore.__ptr_lookup[retVal].__ptr = retVal
  68. return Polycore.__ptr_lookup[retVal]
  69. end
  70. end
  71. function SceneMesh:loadTexture(fileName, clamp)
  72. local retVal = Polycore.SceneMesh_loadTexture(self.__ptr, fileName, clamp)
  73. end
  74. function SceneMesh:loadSkeleton(fileName)
  75. local retVal = Polycore.SceneMesh_loadSkeleton(self.__ptr, fileName)
  76. end
  77. function SceneMesh:setTexture(texture)
  78. local retVal = Polycore.SceneMesh_setTexture(self.__ptr, texture.__ptr)
  79. end
  80. function SceneMesh:setMaterial(material)
  81. local retVal = Polycore.SceneMesh_setMaterial(self.__ptr, material.__ptr)
  82. end
  83. function SceneMesh:setMaterialByName(materialName)
  84. local retVal = Polycore.SceneMesh_setMaterialByName(self.__ptr, materialName)
  85. end
  86. function SceneMesh:setMesh(mesh)
  87. local retVal = Polycore.SceneMesh_setMesh(self.__ptr, mesh.__ptr)
  88. end
  89. function SceneMesh:setSkeleton(skeleton)
  90. local retVal = Polycore.SceneMesh_setSkeleton(self.__ptr, skeleton.__ptr)
  91. end
  92. function SceneMesh:getSkeleton()
  93. local retVal = Polycore.SceneMesh_getSkeleton(self.__ptr)
  94. if Polycore.__ptr_lookup[retVal] ~= nil then
  95. return Polycore.__ptr_lookup[retVal]
  96. else
  97. Polycore.__ptr_lookup[retVal] = Skeleton("__skip_ptr__")
  98. Polycore.__ptr_lookup[retVal].__ptr = retVal
  99. return Polycore.__ptr_lookup[retVal]
  100. end
  101. end
  102. function SceneMesh:renderMeshLocally()
  103. local retVal = Polycore.SceneMesh_renderMeshLocally(self.__ptr)
  104. end
  105. function SceneMesh:cacheToVertexBuffer(cache)
  106. local retVal = Polycore.SceneMesh_cacheToVertexBuffer(self.__ptr, cache)
  107. end