We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, I'm trying to read image data into buffer via getTypedArrayForImageData, but result is empty array.
getTypedArrayForImageData
Model:
import { GLTFLoader, GLTFScenegraph, type GLTFMaterial, type GLTFMesh } from '@loaders.gl/gltf'; import { parse } from '@loaders.gl/core'; export const load = async (bytes: ArrayBuffer): Promise<Model> => { const data = await parse(bytes, GLTFLoader); const gltf = new GLTFScenegraph(data); const defaultScene = gltf.getScene(0); const stack = defaultScene.nodes ?? []; while (stack.length) { const [nodeId] = stack.pop()!; const node = gltf.getNode(nodeId); if (typeof node.mesh !== 'undefined') { const mesh = gltf.getMesh(node.mesh); for (const primitive of mesh.primitives) { if (typeof primitive.material !== 'undefined') { const material = gltf.getMaterial(primitive.material); if (typeof material?.pbrMetallicRoughness?.baseColorTexture !== 'undefined') { const image = gltf.getImage(material.pbrMetallicRoughness.baseColorTexture.index); const data = gltf.getTypedArrayForImageData(image) // ERROR -> DATA SIZE 0 } } } } if (typeof node.children !== 'undefined') { stack.push(...node.children); } } };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
Hello, I'm trying to read image data into buffer via
getTypedArrayForImageData
, but result is empty array.Model:
Minimal example
The text was updated successfully, but these errors were encountered: