Vector4.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. function Vector4() {
  2. Object.defineProperties(this, {
  3. 'x': { enumerable: true, configurable: true, get: Vector4.prototype.__get_x, set: Vector4.prototype.__set_x},
  4. 'y': { enumerable: true, configurable: true, get: Vector4.prototype.__get_y, set: Vector4.prototype.__set_y},
  5. 'z': { enumerable: true, configurable: true, get: Vector4.prototype.__get_z, set: Vector4.prototype.__set_z},
  6. 'w': { enumerable: true, configurable: true, get: Vector4.prototype.__get_w, set: Vector4.prototype.__set_w}
  7. })
  8. }
  9. Vector4.prototype.__get_x = function() {
  10. return Polycode.Vector4__get_x(this.__ptr)
  11. }
  12. Vector4.prototype.__set_x = function(val) {
  13. Polycode.Vector4__set_x(this.__ptr, val)
  14. }
  15. Vector4.prototype.__get_y = function() {
  16. return Polycode.Vector4__get_y(this.__ptr)
  17. }
  18. Vector4.prototype.__set_y = function(val) {
  19. Polycode.Vector4__set_y(this.__ptr, val)
  20. }
  21. Vector4.prototype.__get_z = function() {
  22. return Polycode.Vector4__get_z(this.__ptr)
  23. }
  24. Vector4.prototype.__set_z = function(val) {
  25. Polycode.Vector4__set_z(this.__ptr, val)
  26. }
  27. Vector4.prototype.__get_w = function() {
  28. return Polycode.Vector4__get_w(this.__ptr)
  29. }
  30. Vector4.prototype.__set_w = function(val) {
  31. Polycode.Vector4__set_w(this.__ptr, val)
  32. }
  33. Duktape.fin(Vector4.prototype, function (x) {
  34. if (x === Vector4.prototype) {
  35. return;
  36. }
  37. Polycode.Vector4__delete(x.__ptr)
  38. })
  39. Vector4.prototype.set = function(x,y,z,w) {
  40. Polycode.Vector4_set(this.__ptr, x,y,z,w)
  41. }
  42. Vector4.prototype.dot = function(u) {
  43. return Polycode.Vector4_dot(this.__ptr, u)
  44. }