ProxyVector3.js 728 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. * @author jbaicoianu / http://baicoianu.com/
  4. */
  5. THREE.ProxyVector3 = function ( array, offset ) {
  6. this.array = array;
  7. this.offset = offset;
  8. };
  9. THREE.ProxyVector3.prototype = Object.create( THREE.Vector3.prototype );
  10. Object.defineProperties( THREE.ProxyVector3.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. } );