Object3D.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. */
  4. THREE.Object3D = function ( material ) {
  5. this.position = new THREE.Vector3();
  6. this.rotation = new THREE.Vector3();
  7. this.scale = new THREE.Vector3( 1, 1, 1 );
  8. this.matrix = new THREE.Matrix4();
  9. this.matrixTranslation = new THREE.Matrix4();
  10. this.matrixRotation = new THREE.Matrix4();
  11. this.matrixScale = new THREE.Matrix4();
  12. this.screen = new THREE.Vector3();
  13. this.visible = true;
  14. this.autoUpdateMatrix = true;
  15. this.updateMatrix = function () {
  16. this.matrixPosition = THREE.Matrix4.translationMatrix( this.position.x, this.position.y, this.position.z );
  17. this.matrixRotation = THREE.Matrix4.rotationXMatrix( this.rotation.x );
  18. this.matrixRotation.multiplySelf( THREE.Matrix4.rotationYMatrix( this.rotation.y ) );
  19. this.matrixRotation.multiplySelf( THREE.Matrix4.rotationZMatrix( this.rotation.z ) );
  20. this.matrixScale = THREE.Matrix4.scaleMatrix( this.scale.x, this.scale.y, this.scale.z );
  21. this.matrix.copy( this.matrixPosition );
  22. this.matrix.multiplySelf( this.matrixRotation );
  23. this.matrix.multiplySelf( this.matrixScale );
  24. };
  25. };