Explorar el Código

GLTFLoader: Support accessors with no bufferView. (#24904)

* GLTFLoader: Support accessors with no bufferView.

* GLTFLoader: Clean up.
Michael Herzog hace 2 años
padre
commit
cf75321442
Se han modificado 1 ficheros con 6 adiciones y 4 borrados
  1. 6 4
      examples/jsm/loaders/GLTFLoader.js

+ 6 - 4
examples/jsm/loaders/GLTFLoader.js

@@ -3027,10 +3027,12 @@ class GLTFParser {
 
 
 		if ( accessorDef.bufferView === undefined && accessorDef.sparse === undefined ) {
 		if ( accessorDef.bufferView === undefined && accessorDef.sparse === undefined ) {
 
 
-			// Ignore empty accessors, which may be used to declare runtime
-			// information about attributes coming from another source (e.g. Draco
-			// compression extension).
-			return Promise.resolve( null );
+			const itemSize = WEBGL_TYPE_SIZES[ accessorDef.type ];
+			const TypedArray = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
+			const normalized = accessorDef.normalized === true;
+
+			const array = new TypedArray( accessorDef.count * itemSize );
+			return Promise.resolve( new BufferAttribute( array, itemSize, normalized ) );
 
 
 		}
 		}