SceneLight.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. require "Polycode/SceneEntity"
  2. class "SceneLight" (SceneEntity)
  3. AREA_LIGHT = 0
  4. SPOT_LIGHT = 1
  5. function SceneLight:SceneLight(...)
  6. for k,v in pairs(arg) do
  7. if type(v) == "table" then
  8. if v.__ptr ~= nil then
  9. arg[k] = v.__ptr
  10. end
  11. end
  12. end
  13. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  14. self.__ptr = Polycore.SceneLight(unpack(arg))
  15. end
  16. end
  17. function SceneLight:getIntensity()
  18. local retVal = Polycore.SceneLight_getIntensity(self.__ptr)
  19. return retVal
  20. end
  21. function SceneLight:getDistance()
  22. local retVal = Polycore.SceneLight_getDistance(self.__ptr)
  23. return retVal
  24. end
  25. function SceneLight:getType()
  26. local retVal = Polycore.SceneLight_getType(self.__ptr)
  27. return retVal
  28. end
  29. function SceneLight:renderDepthMap(scene)
  30. local retVal = Polycore.SceneLight_renderDepthMap(self.__ptr, scene.__ptr)
  31. end
  32. function SceneLight:Render()
  33. local retVal = Polycore.SceneLight_Render(self.__ptr)
  34. end
  35. function SceneLight:getLightViewMatrix()
  36. local retVal = Polycore.SceneLight_getLightViewMatrix(self.__ptr)
  37. if Polycore.__ptr_lookup[retVal] ~= nil then
  38. return Polycore.__ptr_lookup[retVal]
  39. else
  40. Polycore.__ptr_lookup[retVal] = Matrix4("__skip_ptr__")
  41. Polycore.__ptr_lookup[retVal].__ptr = retVal
  42. return Polycore.__ptr_lookup[retVal]
  43. end
  44. end
  45. function SceneLight:getZBufferTexture()
  46. local retVal = Polycore.SceneLight_getZBufferTexture(self.__ptr)
  47. if Polycore.__ptr_lookup[retVal] ~= nil then
  48. return Polycore.__ptr_lookup[retVal]
  49. else
  50. Polycore.__ptr_lookup[retVal] = Texture("__skip_ptr__")
  51. Polycore.__ptr_lookup[retVal].__ptr = retVal
  52. return Polycore.__ptr_lookup[retVal]
  53. end
  54. end
  55. function SceneLight:setLightColor(r, g, b)
  56. local retVal = Polycore.SceneLight_setLightColor(self.__ptr, r, g, b)
  57. end
  58. function SceneLight:enableShadows(val, resolution)
  59. local retVal = Polycore.SceneLight_enableShadows(self.__ptr, val, resolution)
  60. end
  61. function SceneLight:setShadowMapFOV(fov)
  62. local retVal = Polycore.SceneLight_setShadowMapFOV(self.__ptr, fov)
  63. end
  64. function SceneLight:areShadowsEnabled()
  65. local retVal = Polycore.SceneLight_areShadowsEnabled(self.__ptr)
  66. return retVal
  67. end
  68. function SceneLight:getLightType()
  69. local retVal = Polycore.SceneLight_getLightType(self.__ptr)
  70. return retVal
  71. end