Browse Source

Revert "Add glTF PBR Specular-Glossiness extension support"

This reverts commit 4a0b4a471617792695a8f77be4e80fb4aabf67c1.
Takahiro 8 years ago
parent
commit
79c0af2d23
2 changed files with 12 additions and 56 deletions
  1. 11 54
      examples/js/loaders/GLTF2Loader.js
  2. 1 2
      examples/webgl_loader_gltf2.html

+ 11 - 54
examples/js/loaders/GLTF2Loader.js

@@ -1223,50 +1223,7 @@ THREE.GLTF2Loader = ( function () {
 
 
 				} else if ( material.technique === undefined ) {
 				} else if ( material.technique === undefined ) {
 
 
-					if ( material.extensions && material.extensions.KHR_materials_pbrSpecularGlossiness ) {
-
-						// specification
-						// https://github.com/sbtron/glTF/tree/KHRpbrSpecGloss/extensions/Khronos/KHR_materials_pbrSpecularGlossiness
-
-						var pbrSpecularGlossiness = material.extensions.KHR_materials_pbrSpecularGlossiness;
-
-						materialType = THREE.MeshStandardMaterialSG;
-
-						materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 );
-						materialParams.opacity = 1.0;
-
-						if ( Array.isArray( pbrSpecularGlossiness.diffuseFactor ) ) {
-
-							var array = pbrSpecularGlossiness.diffuseFactor;
-
-							materialParams.color.fromArray( array );
-							materialParams.opacity = array[ 3 ];
-
-						}
-
-						if ( pbrSpecularGlossiness.diffuseTexture !== undefined ) {
-
-							materialParams.map = dependencies.textures[ pbrSpecularGlossiness.diffuseTexture.index ];
-
-						}
-
-						materialParams.glossiness = pbrSpecularGlossiness.glossinessFactor !== undefined ? pbrSpecularGlossiness.glossinessFactor : 1.0;
-						materialParams.specular2 = new THREE.Color( 1.0, 1.0, 1.0 );
-
-						if ( Array.isArray( pbrSpecularGlossiness.specularFactor ) ) {
-
-							materialParams.specular2.fromArray( pbrSpecularGlossiness.specularFactor );
-
-						}
-
-						if ( pbrSpecularGlossiness.specularGlossinessTexture !== undefined ) {
-
-							materialParams.glossinessMap = dependencies.textures[ pbrSpecularGlossiness.specularGlossinessTexture.index ];
-							materialParams.specular2Map = dependencies.textures[ pbrSpecularGlossiness.specularGlossinessTexture.index ];
-
-						}
-
-					} else if ( material.pbrMetallicRoughness !== undefined )  {
+					if ( material.pbrMetallicRoughness !== undefined )  {
 
 
 						// specification
 						// specification
 						// https://github.com/sbtron/glTF/blob/30de0b365d1566b1bbd8b9c140f9e995d3203226/specification/2.0/README.md#metallic-roughness-material
 						// https://github.com/sbtron/glTF/blob/30de0b365d1566b1bbd8b9c140f9e995d3203226/specification/2.0/README.md#metallic-roughness-material
@@ -1295,6 +1252,16 @@ THREE.GLTF2Loader = ( function () {
 
 
 							}
 							}
 
 
+							if ( materialParams.opacity < 1.0 ||
+							     ( materialParams.map !== undefined &&
+							       ( materialParams.map.format === THREE.AlphaFormat ||
+							         materialParams.map.format === THREE.RGBAFormat ||
+							         materialParams.map.format === THREE.LuminanceAlphaFormat ) ) ) {
+
+								materialParams.transparent = true;
+
+							}
+
 							materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;
 							materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0;
 							materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;
 							materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0;
 
 
@@ -1322,16 +1289,6 @@ THREE.GLTF2Loader = ( function () {
 
 
 					}
 					}
 
 
-					if ( materialParams.opacity < 1.0 ||
-					     ( materialParams.map !== undefined &&
-					       ( materialParams.map.format === THREE.AlphaFormat ||
-					         materialParams.map.format === THREE.RGBAFormat ||
-					         materialParams.map.format === THREE.LuminanceAlphaFormat ) ) ) {
-
-						materialParams.transparent = true;
-
-					}
-
 					if ( material.normalTexture !== undefined ) {
 					if ( material.normalTexture !== undefined ) {
 
 
 						materialParams.normalMap = dependencies.textures[ material.normalTexture.index ];
 						materialParams.normalMap = dependencies.textures[ material.normalTexture.index ];

+ 1 - 2
examples/webgl_loader_gltf2.html

@@ -88,7 +88,6 @@
 			<select id="extensions_list" onchange="selectExtension();">
 			<select id="extensions_list" onchange="selectExtension();">
 				<option value="glTF">None</option>
 				<option value="glTF">None</option>
 				<option value="glTF-MaterialsCommon">Built-in shaders</option>
 				<option value="glTF-MaterialsCommon">Built-in shaders</option>
-				<option value="glTF-pbrSpecularGlossiness">Specular-Glossiness</option>
 				<option value="glTF-Binary">Binary</option>
 				<option value="glTF-Binary">Binary</option>
 			</select>
 			</select>
 		</div>
 		</div>
@@ -417,7 +416,7 @@
 					cameraPos: new THREE.Vector3(2, 1, 3),
 					cameraPos: new THREE.Vector3(2, 1, 3),
 					objectRotation: new THREE.Euler(0, Math.PI, 0),
 					objectRotation: new THREE.Euler(0, Math.PI, 0),
 					addLights:true,
 					addLights:true,
-					extensions: ["glTF", "glTF-pbrSpecularGlossiness", "glTF-Binary"],
+					extensions: ["glTF", "glTF-Binary"],
 					addEnvMap: true
 					addEnvMap: true
 				}
 				}
 			];
 			];