Преглед на файлове

[gltf] Fix use of lines primitive.

Don McCurdy преди 8 години
родител
ревизия
ce7ffe1ddc

+ 4 - 8
examples/js/loaders/GLTF2Loader.js

@@ -1812,7 +1812,7 @@ THREE.GLTF2Loader = ( function () {
 				// For VEC3: itemSize is 3, elementBytes is 4, itemBytes is 12.
 				var elementBytes = TypedArray.BYTES_PER_ELEMENT;
 				var itemBytes = elementBytes * itemSize;
-				var byteStride = json.bufferViews[accessor.bufferView].byteStride;	
+				var byteStride = json.bufferViews[ accessor.bufferView ].byteStride;
 				var array;
 
 				// The buffer is not interleaved if the stride is the item size in bytes.
@@ -2328,17 +2328,13 @@ THREE.GLTF2Loader = ( function () {
 
 							geometry.setIndex( dependencies.accessors[ primitive.indices ] );
 
-							meshNode = new THREE.LineSegments( geometry, material );
-
-						} else {
-
-							meshNode = new THREE.Line( geometry, material );
-
 						}
 
+						meshNode = new THREE.LineSegments( geometry, material );
+
 					} else {
 
-						throw new Error( "Only triangular and line primitives are supported" );
+						throw new Error( 'Only triangular and line primitives are supported' );
 
 					}
 

Файловите разлики са ограничени, защото са твърде много
+ 188 - 0
examples/models/gltf/OutlinedBox/OutlinedBox.gltf


+ 9 - 0
examples/models/gltf/OutlinedBox/README.md

@@ -0,0 +1,9 @@
+# Outlined Box
+
+## Screenshot
+
+![screenshot](screenshot.png)
+
+## License Information
+
+Donated by @twittmann for glTF testing.

BIN
examples/models/gltf/OutlinedBox/screenshot.png


+ 10 - 0
examples/webgl_loader_gltf2.html

@@ -483,6 +483,16 @@
 					// TODO: 'glTF-MaterialsCommon', 'glTF-techniqueWebGL'
 					extensions: ['glTF', 'glTF-Embedded', 'glTF-pbrSpecularGlossiness', 'glTF-Binary']
 				},
+				{
+					name : 'Outlined Box',
+					url : './models/gltf/OutlinedBox/OutlinedBox.gltf',
+					cameraPos: new THREE.Vector3(0, 5, 15),
+					objectScale: new THREE.Vector3(0.01, 0.01, 0.01),
+					objectRotation: new THREE.Euler(0, 90, 0),
+					addLights:true,
+					shadows:true,
+					extensions: ['glTF']
+				},
 			];
 
 			function buildSceneList() {

Някои файлове не бяха показани, защото твърде много файлове са промени