SceneLight.lua 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 = Polycode.SceneLight(unpack(arg))
  22. end
  23. end
  24. function SceneLight:getIntensity()
  25. local retVal = Polycode.SceneLight_getIntensity(self.__ptr)
  26. return retVal
  27. end
  28. function SceneLight:setIntensity(newIntensity)
  29. local retVal = Polycode.SceneLight_setIntensity(self.__ptr, newIntensity)
  30. end
  31. function SceneLight:setAttenuation(constantAttenuation, linearAttenuation, quadraticAttenuation)
  32. local retVal = Polycode.SceneLight_setAttenuation(self.__ptr, constantAttenuation, linearAttenuation, quadraticAttenuation)
  33. end
  34. function SceneLight:getConstantAttenuation()
  35. local retVal = Polycode.SceneLight_getConstantAttenuation(self.__ptr)
  36. return retVal
  37. end
  38. function SceneLight:getLinearAttenuation()
  39. local retVal = Polycode.SceneLight_getLinearAttenuation(self.__ptr)
  40. return retVal
  41. end
  42. function SceneLight:getQuadraticAttenuation()
  43. local retVal = Polycode.SceneLight_getQuadraticAttenuation(self.__ptr)
  44. return retVal
  45. end
  46. function SceneLight:getType()
  47. local retVal = Polycode.SceneLight_getType(self.__ptr)
  48. return retVal
  49. end
  50. function SceneLight:getZBufferTexture()
  51. local retVal = Polycode.SceneLight_getZBufferTexture(self.__ptr)
  52. if retVal == nil then return nil end
  53. local __c = _G["shared_ptr<Texture>"]("__skip_ptr__")
  54. __c.__ptr = retVal
  55. return __c
  56. end
  57. function SceneLight:setSpecularLightColor(r, g, b, a)
  58. local retVal = Polycode.SceneLight_setSpecularLightColor(self.__ptr, r, g, b, a)
  59. end
  60. function SceneLight:setDiffuseLightColor(r, g, b, a)
  61. local retVal = Polycode.SceneLight_setDiffuseLightColor(self.__ptr, r, g, b, a)
  62. end
  63. function SceneLight:setLightColor(r, g, b, a)
  64. local retVal = Polycode.SceneLight_setLightColor(self.__ptr, r, g, b, a)
  65. end
  66. function SceneLight:setSpotlightProperties(spotlightCutoff, spotlightExponent)
  67. local retVal = Polycode.SceneLight_setSpotlightProperties(self.__ptr, spotlightCutoff, spotlightExponent)
  68. end
  69. function SceneLight:getSpotlightCutoff()
  70. local retVal = Polycode.SceneLight_getSpotlightCutoff(self.__ptr)
  71. return retVal
  72. end
  73. function SceneLight:getSpotlightExponent()
  74. local retVal = Polycode.SceneLight_getSpotlightExponent(self.__ptr)
  75. return retVal
  76. end
  77. function SceneLight:enableShadows(val, resolution)
  78. local retVal = Polycode.SceneLight_enableShadows(self.__ptr, val, resolution)
  79. end
  80. function SceneLight:setShadowMapFOV(fov)
  81. local retVal = Polycode.SceneLight_setShadowMapFOV(self.__ptr, fov)
  82. end
  83. function SceneLight:getShadowMapFOV()
  84. local retVal = Polycode.SceneLight_getShadowMapFOV(self.__ptr)
  85. return retVal
  86. end
  87. function SceneLight:getShadowMapResolution()
  88. local retVal = Polycode.SceneLight_getShadowMapResolution(self.__ptr)
  89. return retVal
  90. end
  91. function SceneLight:areShadowsEnabled()
  92. local retVal = Polycode.SceneLight_areShadowsEnabled(self.__ptr)
  93. return retVal
  94. end
  95. function SceneLight:getLightType()
  96. local retVal = Polycode.SceneLight_getLightType(self.__ptr)
  97. return retVal
  98. end
  99. function SceneLight:setLightImportance(newImportance)
  100. local retVal = Polycode.SceneLight_setLightImportance(self.__ptr, newImportance)
  101. end
  102. function SceneLight:getLightImportance()
  103. local retVal = Polycode.SceneLight_getLightImportance(self.__ptr)
  104. return retVal
  105. end
  106. function SceneLight:setLightType(lightType)
  107. local retVal = Polycode.SceneLight_setLightType(self.__ptr, lightType)
  108. end
  109. function SceneLight:getLightInfo()
  110. local retVal = Polycode.SceneLight_getLightInfo(self.__ptr)
  111. if retVal == nil then return nil end
  112. local __c = _G["LightInfo"]("__skip_ptr__")
  113. __c.__ptr = retVal
  114. return __c
  115. end
  116. function SceneLight:__delete()
  117. if self then Polycode.delete_SceneLight(self.__ptr) end
  118. end