GPUDrawBuffer.lua 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. class "GPUDrawBuffer"
  2. function GPUDrawBuffer:__getvar(name)
  3. if name == "targetFramebuffer" then
  4. local retVal = Polycode.GPUDrawBuffer_get_targetFramebuffer(self.__ptr)
  5. if retVal == nil then return nil end
  6. local __c = _G["RenderBuffer"]("__skip_ptr__")
  7. __c.__ptr = retVal
  8. return __c
  9. elseif name == "projectionMatrix" then
  10. local retVal = Polycode.GPUDrawBuffer_get_projectionMatrix(self.__ptr)
  11. if retVal == nil then return nil end
  12. local __c = _G["Matrix4"]("__skip_ptr__")
  13. __c.__ptr = retVal
  14. return __c
  15. elseif name == "viewMatrix" then
  16. local retVal = Polycode.GPUDrawBuffer_get_viewMatrix(self.__ptr)
  17. if retVal == nil then return nil end
  18. local __c = _G["Matrix4"]("__skip_ptr__")
  19. __c.__ptr = retVal
  20. return __c
  21. elseif name == "cameraMatrix" then
  22. local retVal = Polycode.GPUDrawBuffer_get_cameraMatrix(self.__ptr)
  23. if retVal == nil then return nil end
  24. local __c = _G["Matrix4"]("__skip_ptr__")
  25. __c.__ptr = retVal
  26. return __c
  27. elseif name == "clearColor" then
  28. local retVal = Polycode.GPUDrawBuffer_get_clearColor(self.__ptr)
  29. if retVal == nil then return nil end
  30. local __c = _G["Color"]("__skip_ptr__")
  31. __c.__ptr = retVal
  32. return __c
  33. elseif name == "clearDepthBuffer" then
  34. return Polycode.GPUDrawBuffer_get_clearDepthBuffer(self.__ptr)
  35. elseif name == "clearColorBuffer" then
  36. return Polycode.GPUDrawBuffer_get_clearColorBuffer(self.__ptr)
  37. elseif name == "backingResolutionScale" then
  38. local retVal = Polycode.GPUDrawBuffer_get_backingResolutionScale(self.__ptr)
  39. if retVal == nil then return nil end
  40. local __c = _G["Vector2"]("__skip_ptr__")
  41. __c.__ptr = retVal
  42. return __c
  43. elseif name == "globalMaterial" then
  44. local retVal = Polycode.GPUDrawBuffer_get_globalMaterial(self.__ptr)
  45. if retVal == nil then return nil end
  46. local __c = _G["Material"]("__skip_ptr__")
  47. __c.__ptr = retVal
  48. return __c
  49. elseif name == "viewport" then
  50. local retVal = Polycode.GPUDrawBuffer_get_viewport(self.__ptr)
  51. if retVal == nil then return nil end
  52. local __c = _G["Rectangle"]("__skip_ptr__")
  53. __c.__ptr = retVal
  54. return __c
  55. end
  56. end
  57. function GPUDrawBuffer:__setvar(name,value)
  58. if name == "targetFramebuffer" then
  59. Polycode.GPUDrawBuffer_set_targetFramebuffer(self.__ptr, value.__ptr)
  60. return true
  61. elseif name == "projectionMatrix" then
  62. Polycode.GPUDrawBuffer_set_projectionMatrix(self.__ptr, value.__ptr)
  63. return true
  64. elseif name == "viewMatrix" then
  65. Polycode.GPUDrawBuffer_set_viewMatrix(self.__ptr, value.__ptr)
  66. return true
  67. elseif name == "cameraMatrix" then
  68. Polycode.GPUDrawBuffer_set_cameraMatrix(self.__ptr, value.__ptr)
  69. return true
  70. elseif name == "clearColor" then
  71. Polycode.GPUDrawBuffer_set_clearColor(self.__ptr, value.__ptr)
  72. return true
  73. elseif name == "clearDepthBuffer" then
  74. Polycode.GPUDrawBuffer_set_clearDepthBuffer(self.__ptr, value)
  75. return true
  76. elseif name == "clearColorBuffer" then
  77. Polycode.GPUDrawBuffer_set_clearColorBuffer(self.__ptr, value)
  78. return true
  79. elseif name == "backingResolutionScale" then
  80. Polycode.GPUDrawBuffer_set_backingResolutionScale(self.__ptr, value.__ptr)
  81. return true
  82. elseif name == "globalMaterial" then
  83. Polycode.GPUDrawBuffer_set_globalMaterial(self.__ptr, value.__ptr)
  84. return true
  85. elseif name == "viewport" then
  86. Polycode.GPUDrawBuffer_set_viewport(self.__ptr, value.__ptr)
  87. return true
  88. end
  89. return false
  90. end
  91. function GPUDrawBuffer:GPUDrawBuffer(...)
  92. local arg = {...}
  93. for k,v in pairs(arg) do
  94. if type(v) == "table" then
  95. if v.__ptr ~= nil then
  96. arg[k] = v.__ptr
  97. end
  98. end
  99. end
  100. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  101. self.__ptr = Polycode.GPUDrawBuffer(unpack(arg))
  102. end
  103. end
  104. function GPUDrawBuffer:__delete()
  105. if self then Polycode.delete_GPUDrawBuffer(self.__ptr) end
  106. end