Browse Source

Merge pull request #10548 from donmccurdy/feat-global-scene-matrix-update

GLTFShader: Update scene and camera matrices once, globally.
Mr.doob 8 years ago
parent
commit
576f87cb89
1 changed files with 9 additions and 9 deletions
  1. 9 9
      examples/js/loaders/GLTFLoader.js

+ 9 - 9
examples/js/loaders/GLTFLoader.js

@@ -108,6 +108,15 @@ THREE.GLTFLoader = ( function () {
 
 			update: function ( scene, camera ) {
 
+				// update scene graph
+
+				scene.updateMatrixWorld();
+
+				// update camera matrices and frustum
+
+				camera.updateMatrixWorld();
+				camera.matrixWorldInverse.getInverse( camera.matrixWorld );
+
 				for ( var name in objects ) {
 
 					var object = objects[ name ];
@@ -175,15 +184,6 @@ THREE.GLTFLoader = ( function () {
 	// Update - update all the uniform values
 	GLTFShader.prototype.update = function ( scene, camera ) {
 
-		// update scene graph
-
-		scene.updateMatrixWorld();
-
-		// update camera matrices and frustum
-
-		camera.updateMatrixWorld();
-		camera.matrixWorldInverse.getInverse( camera.matrixWorld );
-
 		var boundUniforms = this.boundUniforms;
 
 		for ( var name in boundUniforms ) {