BezierPoint.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. class "BezierPoint"
  2. function BezierPoint:__getvar(name)
  3. if name == "p1" then
  4. local retVal = Polycode.BezierPoint_get_p1(self.__ptr)
  5. if retVal == nil then return nil end
  6. local __c = _G["Vector3"]("__skip_ptr__")
  7. __c.__ptr = retVal
  8. return __c
  9. elseif name == "p2" then
  10. local retVal = Polycode.BezierPoint_get_p2(self.__ptr)
  11. if retVal == nil then return nil end
  12. local __c = _G["Vector3"]("__skip_ptr__")
  13. __c.__ptr = retVal
  14. return __c
  15. elseif name == "p3" then
  16. local retVal = Polycode.BezierPoint_get_p3(self.__ptr)
  17. if retVal == nil then return nil end
  18. local __c = _G["Vector3"]("__skip_ptr__")
  19. __c.__ptr = retVal
  20. return __c
  21. end
  22. end
  23. function BezierPoint:__setvar(name,value)
  24. if name == "p1" then
  25. Polycode.BezierPoint_set_p1(self.__ptr, value.__ptr)
  26. return true
  27. elseif name == "p2" then
  28. Polycode.BezierPoint_set_p2(self.__ptr, value.__ptr)
  29. return true
  30. elseif name == "p3" then
  31. Polycode.BezierPoint_set_p3(self.__ptr, value.__ptr)
  32. return true
  33. end
  34. return false
  35. end
  36. function BezierPoint:BezierPoint(...)
  37. local arg = {...}
  38. for k,v in pairs(arg) do
  39. if type(v) == "table" then
  40. if v.__ptr ~= nil then
  41. arg[k] = v.__ptr
  42. end
  43. end
  44. end
  45. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  46. self.__ptr = Polycode.BezierPoint(unpack(arg))
  47. end
  48. end
  49. function BezierPoint:__delete()
  50. if self then Polycode.delete_BezierPoint(self.__ptr) end
  51. end