Browse Source

GLTFLoader: Clone geometry for multi-pass geometry

Takahiro 7 years ago
parent
commit
68ed316cb6
1 changed files with 4 additions and 1 deletions
  1. 4 1
      examples/js/loaders/GLTFLoader.js

+ 4 - 1
examples/js/loaders/GLTFLoader.js

@@ -2155,7 +2155,8 @@ THREE.GLTFLoader = ( function () {
 
 
 				if ( isCombinable ) {
 				if ( isCombinable ) {
 
 
-					var geometry = geometries[ 0 ];
+					// Cloning geometry because of index override
+					var geometry = geometries[ 0 ].clone();
 					var indices = [];
 					var indices = [];
 					var offset = 0;
 					var offset = 0;
 
 
@@ -2177,6 +2178,8 @@ THREE.GLTFLoader = ( function () {
 
 
 					geometry.setIndex( indices );
 					geometry.setIndex( indices );
 
 
+					return [ geometry ];
+
 				} else if ( geometries.length > 1 && THREE.BufferGeometryUtils !== undefined ) {
 				} else if ( geometries.length > 1 && THREE.BufferGeometryUtils !== undefined ) {
 
 
 					// Tries to merge geometries with BufferGeometryUtils if possible
 					// Tries to merge geometries with BufferGeometryUtils if possible