Object3D.js 909 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. */
  4. THREE.Object3D = function (material) {
  5. this.position = new THREE.Vector3(0, 0, 0);
  6. this.rotation = new THREE.Vector3(0, 0, 0);
  7. this.scale = new THREE.Vector3(1, 1, 1);
  8. this.matrix = new THREE.Matrix4();
  9. this.screen = new THREE.Vector3(0, 0, 0);
  10. this.material = material instanceof Array ? material : [material];
  11. this.autoUpdateMatrix = true;
  12. this.updateMatrix = function () {
  13. this.matrix.identity();
  14. this.matrix.multiplySelf(THREE.Matrix4.translationMatrix(this.position.x, this.position.y, this.position.z));
  15. this.matrix.multiplySelf(THREE.Matrix4.rotationXMatrix(this.rotation.x));
  16. this.matrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));
  17. this.matrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));
  18. this.matrix.multiplySelf(THREE.Matrix4.scaleMatrix(this.scale.x, this.scale.y, this.scale.z));
  19. }
  20. }
粤ICP备19079148号