2
0

Matrix4.lua 3.5 KB

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