SceneLight.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. Polycore.__ptr_lookup[self.__ptr] = self
  16. end
  17. end
  18. function SceneLight:getIntensity()
  19. local retVal = Polycore.SceneLight_getIntensity(self.__ptr)
  20. return retVal
  21. end
  22. function SceneLight:getDistance()
  23. local retVal = Polycore.SceneLight_getDistance(self.__ptr)
  24. return retVal
  25. end
  26. function SceneLight:getType()
  27. local retVal = Polycore.SceneLight_getType(self.__ptr)
  28. return retVal
  29. end
  30. function SceneLight:renderDepthMap(scene)
  31. local retVal = Polycore.SceneLight_renderDepthMap(self.__ptr, scene.__ptr)
  32. end
  33. function SceneLight:Render()
  34. local retVal = Polycore.SceneLight_Render(self.__ptr)
  35. end
  36. function SceneLight:getLightViewMatrix()
  37. local retVal = Polycore.SceneLight_getLightViewMatrix(self.__ptr)
  38. if Polycore.__ptr_lookup[retVal] ~= nil then
  39. return Polycore.__ptr_lookup[retVal]
  40. else
  41. Polycore.__ptr_lookup[retVal] = Matrix4("__skip_ptr__")
  42. Polycore.__ptr_lookup[retVal].__ptr = retVal
  43. return Polycore.__ptr_lookup[retVal]
  44. end
  45. end
  46. function SceneLight:getZBufferTexture()
  47. local retVal = Polycore.SceneLight_getZBufferTexture(self.__ptr)
  48. if Polycore.__ptr_lookup[retVal] ~= nil then
  49. return Polycore.__ptr_lookup[retVal]
  50. else
  51. Polycore.__ptr_lookup[retVal] = Texture("__skip_ptr__")
  52. Polycore.__ptr_lookup[retVal].__ptr = retVal
  53. return Polycore.__ptr_lookup[retVal]
  54. end
  55. end
  56. function SceneLight:setLightColor(r, g, b)
  57. local retVal = Polycore.SceneLight_setLightColor(self.__ptr, r, g, b)
  58. end
  59. function SceneLight:enableShadows(val, resolution)
  60. local retVal = Polycore.SceneLight_enableShadows(self.__ptr, val, resolution)
  61. end
  62. function SceneLight:setShadowMapFOV(fov)
  63. local retVal = Polycore.SceneLight_setShadowMapFOV(self.__ptr, fov)
  64. end
  65. function SceneLight:areShadowsEnabled()
  66. local retVal = Polycore.SceneLight_areShadowsEnabled(self.__ptr)
  67. return retVal
  68. end
  69. function SceneLight:getLightType()
  70. local retVal = Polycore.SceneLight_getLightType(self.__ptr)
  71. return retVal
  72. end