ProxyVector3.js 680 B

123456789101112131415161718192021222324252627
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. THREE.ProxyVector3 = function ( array, offset ) {
  5. this.array = array;
  6. this.offset = offset;
  7. };
  8. THREE.ProxyVector3.prototype = Object.create( THREE.Vector3.prototype );
  9. Object.defineProperties( THREE.ProxyVector3.prototype, {
  10. 'x': {
  11. get: function () { return this.array[ this.offset ]; },
  12. set: function ( v ) { this.array[ this.offset ] = v; }
  13. },
  14. 'y': {
  15. get: function () { return this.array[ this.offset + 1 ]; },
  16. set: function ( v ) { this.array[ this.offset + 1 ] = v; }
  17. },
  18. 'z': {
  19. get: function () { return this.array[ this.offset + 2 ]; },
  20. set: function ( v ) { this.array[ this.offset + 2 ] = v; }
  21. }
  22. } );
粤ICP备19079148号