ProxyVector4.js 926 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. * @author jbaicoianu / http://baicoianu.com/
  4. */
  5. THREE.ProxyVector4 = function ( array, offset ) {
  6. this.array = array;
  7. this.offset = offset;
  8. };
  9. THREE.ProxyVector4.prototype = Object.create( THREE.Vector4.prototype );
  10. THREE.ProxyVector4.prototype.constructor = THREE.ProxyVector4;
  11. Object.defineProperties( THREE.ProxyVector4.prototype, {
  12. 'x': {
  13. get: function () { return this.array[ this.offset ]; },
  14. set: function ( v ) { this.array[ this.offset ] = v; }
  15. },
  16. 'y': {
  17. get: function () { return this.array[ this.offset + 1 ]; },
  18. set: function ( v ) { this.array[ this.offset + 1 ] = v; }
  19. },
  20. 'z': {
  21. get: function () { return this.array[ this.offset + 2 ]; },
  22. set: function ( v ) { this.array[ this.offset + 2 ] = v; }
  23. },
  24. 'w': {
  25. get: function () { return this.array[ this.offset + 3 ]; },
  26. set: function ( v ) { this.array[ this.offset + 3 ] = v; }
  27. }
  28. } );