Matrix4.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. function Matrix4() {
  2. }
  3. Matrix4.prototype.identity = function() {
  4. Polycode.Matrix4_identity(this.__ptr)
  5. }
  6. Matrix4.prototype.rotateVector = function(v2) {
  7. var retVal = new Vector3()
  8. retVal.__ptr = Polycode.Matrix4_rotateVector(this.__ptr, v2)
  9. return retVal
  10. }
  11. Matrix4.prototype.getPosition = function() {
  12. var retVal = new Vector3()
  13. retVal.__ptr = Polycode.Matrix4_getPosition(this.__ptr)
  14. return retVal
  15. }
  16. Matrix4.prototype.multiplyWithPerspective = function(v2) {
  17. var retVal = new Vector3()
  18. retVal.__ptr = Polycode.Matrix4_multiplyWithPerspective(this.__ptr, v2)
  19. return retVal
  20. }
  21. Matrix4.prototype.multVector3 = function(v2) {
  22. var retVal = new Vector3()
  23. retVal.__ptr = Polycode.Matrix4_multVector3(this.__ptr, v2)
  24. return retVal
  25. }
  26. Matrix4.prototype.multVector4 = function(v2) {
  27. var retVal = new Vector4()
  28. retVal.__ptr = Polycode.Matrix4_multVector4(this.__ptr, v2)
  29. return retVal
  30. }
  31. Matrix4.prototype.Translate = function(x,y,z) {
  32. Polycode.Matrix4_Translate(this.__ptr, x,y,z)
  33. }
  34. Matrix4.prototype.setPosition = function(x,y,z) {
  35. Polycode.Matrix4_setPosition(this.__ptr, x,y,z)
  36. }
  37. Matrix4.prototype.setScale = function(scale) {
  38. Polycode.Matrix4_setScale(this.__ptr, scale)
  39. }
  40. Matrix4.prototype.getEulerAngles = function(ax,ay,az) {
  41. Polycode.Matrix4_getEulerAngles(this.__ptr, ax,ay,az)
  42. }
  43. Matrix4.prototype.transpose = function() {
  44. var retVal = new Matrix4()
  45. retVal.__ptr = Polycode.Matrix4_transpose(this.__ptr)
  46. return retVal
  47. }
  48. Matrix4.prototype.Inverse = function() {
  49. var retVal = new Matrix4()
  50. retVal.__ptr = Polycode.Matrix4_Inverse(this.__ptr)
  51. return retVal
  52. }
  53. Matrix4.prototype.inverseAffine = function() {
  54. var retVal = new Matrix4()
  55. retVal.__ptr = Polycode.Matrix4_inverseAffine(this.__ptr)
  56. return retVal
  57. }
  58. Matrix4.prototype.determinant = function() {
  59. return Polycode.Matrix4_determinant(this.__ptr)
  60. }
  61. Matrix4.prototype.setOrthoProjection = function(left,right,bottom,top,zNear,zFar) {
  62. Polycode.Matrix4_setOrthoProjection(this.__ptr, left,right,bottom,top,zNear,zFar)
  63. }
  64. Matrix4.prototype.setProjectionFrustum = function(left,right,bottom,top,zNear,zFar) {
  65. Polycode.Matrix4_setProjectionFrustum(this.__ptr, left,right,bottom,top,zNear,zFar)
  66. }
  67. Matrix4.prototype.setProjection = function(fov,aspect,zNear,zFar) {
  68. Polycode.Matrix4_setProjection(this.__ptr, fov,aspect,zNear,zFar)
  69. }