ProxyVector4.js 863 B

123456789101112131415161718192021222324252627282930313233
  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. Object.defineProperties( THREE.ProxyVector4.prototype, {
  11. 'x': {
  12. get: function () { return this.array[ this.offset ]; },
  13. set: function ( v ) { this.array[ this.offset ] = v; }
  14. },
  15. 'y': {
  16. get: function () { return this.array[ this.offset + 1 ]; },
  17. set: function ( v ) { this.array[ this.offset + 1 ] = v; }
  18. },
  19. 'z': {
  20. get: function () { return this.array[ this.offset + 2 ]; },
  21. set: function ( v ) { this.array[ this.offset + 2 ] = v; }
  22. },
  23. 'w': {
  24. get: function () { return this.array[ this.offset + 3 ]; },
  25. set: function ( v ) { this.array[ this.offset + 3 ] = v; }
  26. }
  27. } );