Browse Source

Update scene and camera matrices once, globally.

Don McCurdy 8 years ago
parent
commit
73f36b774c
1 changed files with 9 additions and 9 deletions
  1. 9 9
      examples/js/loaders/GLTFLoader.js

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

@@ -107,6 +107,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 ];
@@ -174,15 +183,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 ) {