Browse Source

Camera doesn't need to be added to the Scene anymore (as it used to).
I'll update all the examples in a sec.

Mr.doob 13 years ago
parent
commit
5cae03ef22
3 changed files with 6 additions and 17 deletions
  1. 2 3
      README.md
  2. 2 7
      src/core/Projector.js
  3. 2 7
      src/renderers/WebGLRenderer.js

+ 2 - 3
README.md

@@ -30,11 +30,10 @@ This code creates a scene, then creates a camera, adds the camera and cube to th
 
 	function init() {
 
-		scene = new THREE.Scene();
-
 		camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
 		camera.position.z = 1000;
-		scene.add( camera );
+
+		scene = new THREE.Scene();
 
 		geometry = new THREE.CubeGeometry( 200, 200, 200 );
 		material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );

+ 2 - 7
src/core/Projector.js

@@ -140,15 +140,10 @@ THREE.Projector = function() {
 
 		_renderData.elements.length = 0;
 
-		if ( camera.parent === undefined ) {
-
-			console.warn( 'DEPRECATED: Camera hasn\'t been added to a Scene. Adding it...' );
-			scene.add( camera );
-
-		}
-
 		scene.updateMatrixWorld();
 
+		if ( camera.parent === undefined ) camera.updateMatrixWorld();
+
 		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
 
 		_viewProjectionMatrix.multiply( camera.projectionMatrix, camera.matrixWorldInverse );

+ 2 - 7
src/renderers/WebGLRenderer.js

@@ -3702,17 +3702,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		// update scene graph
 
-		if ( camera.parent === undefined ) {
-
-			console.warn( 'DEPRECATED: Camera hasn\'t been added to a Scene. Adding it...' );
-			scene.add( camera );
-
-		}
-
 		if ( this.autoUpdateScene ) scene.updateMatrixWorld();
 
 		// update camera matrices and frustum
 
+		if ( camera.parent === undefined ) camera.updateMatrixWorld();
+
 		if ( ! camera._viewMatrixArray ) camera._viewMatrixArray = new Float32Array( 16 );
 		if ( ! camera._projectionMatrixArray ) camera._projectionMatrixArray = new Float32Array( 16 );