Browse Source

Fixes for issues brought up by donmccurdy

Alan Millman 7 years ago
parent
commit
e58f973602
2 changed files with 12 additions and 19 deletions
  1. 1 12
      editor/js/Loader.js
  2. 11 7
      examples/js/loaders/deprecated/LegacyGLTFLoader.js

+ 1 - 12
editor/js/Loader.js

@@ -596,18 +596,7 @@ var Loader = function ( editor ) {
 
 			if ( magic === 'glTF' ) {
 
-				try {
-
-					extensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( contents );
-
-				} catch ( error ) {
-
-					// dunno what it is, but it's definitely not OK
-					return false;
-
-				}
-
-				resultContent = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content;
+				return false;
 
 			} else {
 

+ 11 - 7
examples/js/loaders/deprecated/LegacyGLTFLoader.js

@@ -1592,8 +1592,6 @@ THREE.LegacyGLTFLoader = ( function () {
 
 						var attributes = primitive.attributes;
 
-						var attributeIndex = 0;
-
 						for ( var attributeId in attributes ) {
 
 							var attributeEntry = attributes[ attributeId ];
@@ -1638,13 +1636,19 @@ THREE.LegacyGLTFLoader = ( function () {
 
 								default:
 									var material = json.materials[ primitive.material ];
-									var attributeNames = json.techniques[ material.technique ].attributes;
-									var attributeName = Object.keys( attributeNames )[ attributeIndex ];
+									var parameters = json.techniques[ material.technique ].parameters;
+									
+									for( var attributeName in parameters ) {
 
-									geometry.addAttribute( attributeName, bufferAttribute );
-							}
+										if( parameters[attributeName]['semantic'] === attributeId ) {
+
+											geometry.addAttribute( attributeName, bufferAttribute );
+
+										}
+
+									}
 
-							++attributeIndex;
+							}
 
 						}