public final class GltfAssetReader
extends java.lang.Object
read(URI) method allows reading the asset from a URI. The
external references of the asset will be resolved against the parent
of the given URI, and loaded automatically. The respective data may
then be obtained with GltfAsset.getReferenceData(String).readWithoutReferences(URI) and
readWithoutReferences(InputStream) methods allow reading an
asset from a URI or an input stream, without resolving external
references. This is mainly intended for binary- or embedded glTF assets
that do not have external references, or for cases where the external
references should be resolved manually.GltfAsset that was read, the
major version of the read asset may be
queried. Depending on the version, the asset may be obtained as a
glTF 1.0 asset or a
glTF 2.0 asset.GltfAsset may then be processed further, for example,
by creating a GltfModel using GltfModels.create(GltfAsset).| Constructor and Description |
|---|
GltfAssetReader()
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
GltfAsset |
read(java.net.URI uri)
Read the
GltfAsset from the given URI |
GltfAsset |
readWithoutReferences(java.io.InputStream inputStream)
Read the glTF asset from the given input stream.
|
GltfAsset |
readWithoutReferences(java.net.URI uri)
Read the
GltfAsset from the given URI. |
void |
setJsonErrorConsumer(java.util.function.Consumer<? super JsonError> jsonErrorConsumer)
Set the given consumer to receive
JsonErrors that may
occur when a glTF is read |
public void setJsonErrorConsumer(java.util.function.Consumer<? super JsonError> jsonErrorConsumer)
JsonErrors that may
occur when a glTF is readjsonErrorConsumer - The JsonError consumerpublic GltfAsset read(java.net.URI uri) throws java.io.IOException
GltfAsset from the given URIuri - The URIGltfModeljava.io.IOException - If an IO error occurspublic GltfAsset readWithoutReferences(java.net.URI uri) throws java.io.IOException
GltfAsset from the given URI.read(URI) method, this method will
not resolve any external references.uri - The URIGltfModeljava.io.IOException - If an IO error occurspublic GltfAsset readWithoutReferences(java.io.InputStream inputStream) throws java.io.IOException
getMajorVersion(), and the actual asset may be obtained
with getAsGltfAssetV1() or getAsGltfAssetV2().read(URI) method, this method will
not resolve any external references.inputStream - The input streamGltfAssetjava.io.IOException - If an IO error occurredCopyright © 2022. All Rights Reserved.