ProgramAttribute.lua 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. class "ProgramAttribute"
  2. function ProgramAttribute:__getvar(name)
  3. if name == "size" then
  4. return Polycore.ProgramAttribute_get_size(self.__ptr)
  5. elseif name == "name" then
  6. return Polycore.ProgramAttribute_get_name(self.__ptr)
  7. elseif name == "platformData" then
  8. local retVal = Polycore.ProgramAttribute_get_platformData(self.__ptr)
  9. if retVal == nil then return nil end
  10. local __c = _G["void"]("__skip_ptr__")
  11. __c.__ptr = retVal
  12. return __c
  13. end
  14. end
  15. function ProgramAttribute:__setvar(name,value)
  16. if name == "size" then
  17. Polycore.ProgramAttribute_set_size(self.__ptr, value)
  18. return true
  19. elseif name == "name" then
  20. Polycore.ProgramAttribute_set_name(self.__ptr, value)
  21. return true
  22. end
  23. return false
  24. end
  25. function ProgramAttribute:ProgramAttribute(...)
  26. local arg = {...}
  27. for k,v in pairs(arg) do
  28. if type(v) == "table" then
  29. if v.__ptr ~= nil then
  30. arg[k] = v.__ptr
  31. end
  32. end
  33. end
  34. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  35. self.__ptr = Polycore.ProgramAttribute(unpack(arg))
  36. end
  37. end
  38. function ProgramAttribute:__delete()
  39. if self then Polycore.delete_ProgramAttribute(self.__ptr) end
  40. end