Object3D.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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.translationMatrix = new THREE.Matrix4();
  10. this.rotationMatrix = new THREE.Matrix4();
  11. this.scaleMatrix = 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.rotationMatrix = THREE.Matrix4.rotationXMatrix( this.rotation.x );
  18. this.rotationMatrix.multiplySelf( THREE.Matrix4.rotationYMatrix( this.rotation.y ) );
  19. this.rotationMatrix.multiplySelf( THREE.Matrix4.rotationZMatrix( this.rotation.z ) );
  20. this.scaleMatrix = THREE.Matrix4.scaleMatrix( this.scale.x, this.scale.y, this.scale.z );
  21. this.matrix.copy( this.matrixPosition );
  22. this.matrix.multiplySelf( this.rotationMatrix );
  23. this.matrix.multiplySelf( this.scaleMatrix );
  24. };
  25. };