Matrix4.lua 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. class "Matrix4"
  2. function Matrix4:Matrix4(...)
  3. local arg = {...}
  4. for k,v in pairs(arg) do
  5. if type(v) == "table" then
  6. if v.__ptr ~= nil then
  7. arg[k] = v.__ptr
  8. end
  9. end
  10. end
  11. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  12. self.__ptr = Polycode.Matrix4(unpack(arg))
  13. end
  14. end
  15. function Matrix4:identity()
  16. local retVal = Polycode.Matrix4_identity(self.__ptr)
  17. end
  18. function Matrix4:rotateVector(v2)
  19. local retVal = Polycode.Matrix4_rotateVector(self.__ptr, v2.__ptr)
  20. if retVal == nil then return nil end
  21. local __c = _G["Vector3"]("__skip_ptr__")
  22. __c.__ptr = retVal
  23. return __c
  24. end
  25. function Matrix4:getPosition()
  26. local retVal = Polycode.Matrix4_getPosition(self.__ptr)
  27. if retVal == nil then return nil end
  28. local __c = _G["Vector3"]("__skip_ptr__")
  29. __c.__ptr = retVal
  30. return __c
  31. end
  32. function Matrix4:multiplyWithPerspective(v2)
  33. local retVal = Polycode.Matrix4_multiplyWithPerspective(self.__ptr, v2.__ptr)
  34. if retVal == nil then return nil end
  35. local __c = _G["Vector3"]("__skip_ptr__")
  36. __c.__ptr = retVal
  37. return __c
  38. end
  39. function Matrix4:multVector3(v2)
  40. local retVal = Polycode.Matrix4_multVector3(self.__ptr, v2.__ptr)
  41. if retVal == nil then return nil end
  42. local __c = _G["Vector3"]("__skip_ptr__")
  43. __c.__ptr = retVal
  44. return __c
  45. end
  46. function Matrix4:multVector4(v2)
  47. local retVal = Polycode.Matrix4_multVector4(self.__ptr, v2.__ptr)
  48. if retVal == nil then return nil end
  49. local __c = _G["Vector4"]("__skip_ptr__")
  50. __c.__ptr = retVal
  51. return __c
  52. end
  53. function Matrix4:Translate(x, y, z)
  54. local retVal = Polycode.Matrix4_Translate(self.__ptr, x, y, z)
  55. end
  56. function Matrix4:setPosition(x, y, z)
  57. local retVal = Polycode.Matrix4_setPosition(self.__ptr, x, y, z)
  58. end
  59. function Matrix4:setScale(scale)
  60. local retVal = Polycode.Matrix4_setScale(self.__ptr, scale.__ptr)
  61. end
  62. function Matrix4:transpose()
  63. local retVal = Polycode.Matrix4_transpose(self.__ptr)
  64. if retVal == nil then return nil end
  65. local __c = _G["Matrix4"]("__skip_ptr__")
  66. __c.__ptr = retVal
  67. return __c
  68. end
  69. function Matrix4:Inverse()
  70. local retVal = Polycode.Matrix4_Inverse(self.__ptr)
  71. if retVal == nil then return nil end
  72. local __c = _G["Matrix4"]("__skip_ptr__")
  73. __c.__ptr = retVal
  74. return __c
  75. end
  76. function Matrix4:inverseAffine()
  77. local retVal = Polycode.Matrix4_inverseAffine(self.__ptr)
  78. if retVal == nil then return nil end
  79. local __c = _G["Matrix4"]("__skip_ptr__")
  80. __c.__ptr = retVal
  81. return __c
  82. end
  83. function Matrix4:determinant()
  84. local retVal = Polycode.Matrix4_determinant(self.__ptr)
  85. return retVal
  86. end
  87. function Matrix4:setOrthoProjection(left, right, bottom, top, zNear, zFar)
  88. local retVal = Polycode.Matrix4_setOrthoProjection(self.__ptr, left, right, bottom, top, zNear, zFar)
  89. end
  90. function Matrix4:setProjectionFrustum(left, right, bottom, top, zNear, zFar)
  91. local retVal = Polycode.Matrix4_setProjectionFrustum(self.__ptr, left, right, bottom, top, zNear, zFar)
  92. end
  93. function Matrix4:setProjection(fov, aspect, zNear, zFar)
  94. local retVal = Polycode.Matrix4_setProjection(self.__ptr, fov, aspect, zNear, zFar)
  95. end
  96. function Matrix4:__delete()
  97. if self then Polycode.delete_Matrix4(self.__ptr) end
  98. end