提交 5cae03ef 编写于 作者: M Mr.doob

Camera doesn't need to be added to the Scene anymore (as it used to).

I'll update all the examples in a sec.
上级 632b0f8e
......@@ -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 } );
......
......@@ -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 );
......
......@@ -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 );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册