SceneLight.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. require "Polycode/Entity"
  2. class "SceneLight" (Entity)
  3. SceneLight.POINT_LIGHT = 0
  4. SceneLight.SPOT_LIGHT = 1
  5. function SceneLight:SceneLight(...)
  6. local arg = {...}
  7. if type(arg[1]) == "table" and count(arg) == 1 then
  8. if ""..arg[1].__classname == "Entity" then
  9. self.__ptr = arg[1].__ptr
  10. return
  11. end
  12. end
  13. for k,v in pairs(arg) do
  14. if type(v) == "table" then
  15. if v.__ptr ~= nil then
  16. arg[k] = v.__ptr
  17. end
  18. end
  19. end
  20. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  21. self.__ptr = Polycore.SceneLight(unpack(arg))
  22. end
  23. end
  24. function SceneLight:getIntensity()
  25. local retVal = Polycore.SceneLight_getIntensity(self.__ptr)
  26. return retVal
  27. end
  28. function SceneLight:setIntensity(newIntensity)
  29. local retVal = Polycore.SceneLight_setIntensity(self.__ptr, newIntensity)
  30. end
  31. function SceneLight:setAttenuation(constantAttenuation, linearAttenuation, quadraticAttenuation)
  32. local retVal = Polycore.SceneLight_setAttenuation(self.__ptr, constantAttenuation, linearAttenuation, quadraticAttenuation)
  33. end
  34. function SceneLight:getConstantAttenuation()
  35. local retVal = Polycore.SceneLight_getConstantAttenuation(self.__ptr)
  36. return retVal
  37. end
  38. function SceneLight:getLinearAttenuation()
  39. local retVal = Polycore.SceneLight_getLinearAttenuation(self.__ptr)
  40. return retVal
  41. end
  42. function SceneLight:getQuadraticAttenuation()
  43. local retVal = Polycore.SceneLight_getQuadraticAttenuation(self.__ptr)
  44. return retVal
  45. end
  46. function SceneLight:getType()
  47. local retVal = Polycore.SceneLight_getType(self.__ptr)
  48. return retVal
  49. end
  50. function SceneLight:renderDepthMap(scene)
  51. local retVal = Polycore.SceneLight_renderDepthMap(self.__ptr, scene.__ptr)
  52. end
  53. function SceneLight:getZBufferTexture()
  54. local retVal = Polycore.SceneLight_getZBufferTexture(self.__ptr)
  55. if retVal == nil then return nil end
  56. local __c = _G["Texture"]("__skip_ptr__")
  57. __c.__ptr = retVal
  58. return __c
  59. end
  60. function SceneLight:setSpecularLightColor(r, g, b, a)
  61. local retVal = Polycore.SceneLight_setSpecularLightColor(self.__ptr, r, g, b, a)
  62. end
  63. function SceneLight:setDiffuseLightColor(r, g, b, a)
  64. local retVal = Polycore.SceneLight_setDiffuseLightColor(self.__ptr, r, g, b, a)
  65. end
  66. function SceneLight:setLightColor(r, g, b, a)
  67. local retVal = Polycore.SceneLight_setLightColor(self.__ptr, r, g, b, a)
  68. end
  69. function SceneLight:setSpotlightProperties(spotlightCutoff, spotlightExponent)
  70. local retVal = Polycore.SceneLight_setSpotlightProperties(self.__ptr, spotlightCutoff, spotlightExponent)
  71. end
  72. function SceneLight:getSpotlightCutoff()
  73. local retVal = Polycore.SceneLight_getSpotlightCutoff(self.__ptr)
  74. return retVal
  75. end
  76. function SceneLight:getSpotlightExponent()
  77. local retVal = Polycore.SceneLight_getSpotlightExponent(self.__ptr)
  78. return retVal
  79. end
  80. function SceneLight:enableShadows(val, resolution)
  81. local retVal = Polycore.SceneLight_enableShadows(self.__ptr, val, resolution)
  82. end
  83. function SceneLight:setShadowMapFOV(fov)
  84. local retVal = Polycore.SceneLight_setShadowMapFOV(self.__ptr, fov)
  85. end
  86. function SceneLight:getShadowMapFOV()
  87. local retVal = Polycore.SceneLight_getShadowMapFOV(self.__ptr)
  88. return retVal
  89. end
  90. function SceneLight:getShadowMapResolution()
  91. local retVal = Polycore.SceneLight_getShadowMapResolution(self.__ptr)
  92. return retVal
  93. end
  94. function SceneLight:areShadowsEnabled()
  95. local retVal = Polycore.SceneLight_areShadowsEnabled(self.__ptr)
  96. return retVal
  97. end
  98. function SceneLight:getLightType()
  99. local retVal = Polycore.SceneLight_getLightType(self.__ptr)
  100. return retVal
  101. end
  102. function SceneLight:setLightImportance(newImportance)
  103. local retVal = Polycore.SceneLight_setLightImportance(self.__ptr, newImportance)
  104. end
  105. function SceneLight:getLightImportance()
  106. local retVal = Polycore.SceneLight_getLightImportance(self.__ptr)
  107. return retVal
  108. end
  109. function SceneLight:setLightType(lightType)
  110. local retVal = Polycore.SceneLight_setLightType(self.__ptr, lightType)
  111. end
  112. function SceneLight:Clone(deepClone, ignoreEditorOnly)
  113. local retVal = Polycore.SceneLight_Clone(self.__ptr, deepClone, ignoreEditorOnly)
  114. if retVal == nil then return nil end
  115. local __c = _G["Entity"]("__skip_ptr__")
  116. __c.__ptr = retVal
  117. return __c
  118. end
  119. function SceneLight:applyClone(clone, deepClone, ignoreEditorOnly)
  120. local retVal = Polycore.SceneLight_applyClone(self.__ptr, clone.__ptr, deepClone, ignoreEditorOnly)
  121. end
  122. function SceneLight:getParentScene()
  123. local retVal = Polycore.SceneLight_getParentScene(self.__ptr)
  124. if retVal == nil then return nil end
  125. local __c = _G["Scene"]("__skip_ptr__")
  126. __c.__ptr = retVal
  127. return __c
  128. end
  129. function SceneLight:setParentScene(scene)
  130. local retVal = Polycore.SceneLight_setParentScene(self.__ptr, scene.__ptr)
  131. end
  132. function SceneLight:getSpotlightCamera()
  133. local retVal = Polycore.SceneLight_getSpotlightCamera(self.__ptr)
  134. if retVal == nil then return nil end
  135. local __c = _G["Camera"]("__skip_ptr__")
  136. __c.__ptr = retVal
  137. return __c
  138. end
  139. function SceneLight:getLightInfo()
  140. local retVal = Polycore.SceneLight_getLightInfo(self.__ptr)
  141. if retVal == nil then return nil end
  142. local __c = _G["LightInfo"]("__skip_ptr__")
  143. __c.__ptr = retVal
  144. return __c
  145. end
  146. function SceneLight:__delete()
  147. if self then Polycore.delete_SceneLight(self.__ptr) end
  148. end