GPUDrawBuffer.lua 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. class "GPUDrawBuffer"
  2. function GPUDrawBuffer:__getvar(name)
  3. if name == "projectionMatrix" then
  4. local retVal = Polycode.GPUDrawBuffer_get_projectionMatrix(self.__ptr)
  5. if retVal == nil then return nil end
  6. local __c = _G["Matrix4"]("__skip_ptr__")
  7. __c.__ptr = retVal
  8. return __c
  9. elseif name == "viewMatrix" then
  10. local retVal = Polycode.GPUDrawBuffer_get_viewMatrix(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 == "cameraMatrix" then
  16. local retVal = Polycode.GPUDrawBuffer_get_cameraMatrix(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 == "clearColor" then
  22. local retVal = Polycode.GPUDrawBuffer_get_clearColor(self.__ptr)
  23. if retVal == nil then return nil end
  24. local __c = _G["Color"]("__skip_ptr__")
  25. __c.__ptr = retVal
  26. return __c
  27. elseif name == "clearDepthBuffer" then
  28. return Polycode.GPUDrawBuffer_get_clearDepthBuffer(self.__ptr)
  29. elseif name == "clearColorBuffer" then
  30. return Polycode.GPUDrawBuffer_get_clearColorBuffer(self.__ptr)
  31. elseif name == "backingResolutionScale" then
  32. local retVal = Polycode.GPUDrawBuffer_get_backingResolutionScale(self.__ptr)
  33. if retVal == nil then return nil end
  34. local __c = _G["Vector2"]("__skip_ptr__")
  35. __c.__ptr = retVal
  36. return __c
  37. elseif name == "viewport" then
  38. local retVal = Polycode.GPUDrawBuffer_get_viewport(self.__ptr)
  39. if retVal == nil then return nil end
  40. local __c = _G["Rectangle"]("__skip_ptr__")
  41. __c.__ptr = retVal
  42. return __c
  43. end
  44. end
  45. function GPUDrawBuffer:__setvar(name,value)
  46. if name == "projectionMatrix" then
  47. Polycode.GPUDrawBuffer_set_projectionMatrix(self.__ptr, value.__ptr)
  48. return true
  49. elseif name == "viewMatrix" then
  50. Polycode.GPUDrawBuffer_set_viewMatrix(self.__ptr, value.__ptr)
  51. return true
  52. elseif name == "cameraMatrix" then
  53. Polycode.GPUDrawBuffer_set_cameraMatrix(self.__ptr, value.__ptr)
  54. return true
  55. elseif name == "clearColor" then
  56. Polycode.GPUDrawBuffer_set_clearColor(self.__ptr, value.__ptr)
  57. return true
  58. elseif name == "clearDepthBuffer" then
  59. Polycode.GPUDrawBuffer_set_clearDepthBuffer(self.__ptr, value)
  60. return true
  61. elseif name == "clearColorBuffer" then
  62. Polycode.GPUDrawBuffer_set_clearColorBuffer(self.__ptr, value)
  63. return true
  64. elseif name == "backingResolutionScale" then
  65. Polycode.GPUDrawBuffer_set_backingResolutionScale(self.__ptr, value.__ptr)
  66. return true
  67. elseif name == "viewport" then
  68. Polycode.GPUDrawBuffer_set_viewport(self.__ptr, value.__ptr)
  69. return true
  70. end
  71. return false
  72. end
  73. function GPUDrawBuffer:GPUDrawBuffer(...)
  74. local arg = {...}
  75. for k,v in pairs(arg) do
  76. if type(v) == "table" then
  77. if v.__ptr ~= nil then
  78. arg[k] = v.__ptr
  79. end
  80. end
  81. end
  82. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  83. self.__ptr = Polycode.GPUDrawBuffer(unpack(arg))
  84. end
  85. end
  86. function GPUDrawBuffer:__delete()
  87. if self then Polycode.delete_GPUDrawBuffer(self.__ptr) end
  88. end