ProxyVector2.js 593 B

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