Package com.jme3.scene.plugins.gltf
Class GltfLoader
java.lang.Object
com.jme3.scene.plugins.gltf.GltfLoader
- All Implemented Interfaces:
AssetLoader
- Direct Known Subclasses:
GlbLoader
GLTF 2.0 loader
Created by Nehon on 07/08/2017.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToCache
(String name, int index, Object object, int maxLength) <T> T
fetchFromCache
(String name, int index, Class<T> type) protected byte[]
com.google.gson.JsonObject
getInfo()
Loads asset from the given input stream, parsing it into an application-usable object.protected Object
loadFromStream
(AssetInfo assetInfo, InputStream stream) void
readAnimation
(int animationIndex) readBuffer
(Integer bufferViewIndex, int byteOffset, int count, Object store, int numComponents, VertexBuffer.Format format) void
byte[]
readData
(int bufferIndex) readImage
(int sourceIndex, boolean flip) readMaterial
(int materialIndex) Geometry[]
readMeshPrimitives
(int meshIndex) readNode
(int nodeIndex) readNodeAsBone
(int nodeIndex, int jointIndex, int skinIndex, Matrix4f inverseModelBindMatrix) readSampler
(int samplerIndex, Texture2D texture) void
readScenes
(com.google.gson.JsonPrimitive defaultScene, Node rootNode) void
readTexture
(com.google.gson.JsonObject texture) readTexture
(com.google.gson.JsonObject texture, boolean flip) readTransforms
(com.google.gson.JsonObject nodeData) static void
registerDefaultExtrasLoader
(Class<? extends ExtrasLoader> loader) Sets the default extras loader used when no loader is specified in the GltfModelKey.static void
registerExtension
(String name, Class<? extends ExtensionLoader> ext) static void
Unregisters the default extras loader.static void
unregisterExtension
(String name)
-
Constructor Details
-
GltfLoader
public GltfLoader()
-
-
Method Details
-
load
Description copied from interface:AssetLoader
Loads asset from the given input stream, parsing it into an application-usable object.- Specified by:
load
in interfaceAssetLoader
- Parameters:
assetInfo
- the located asset- Returns:
- An object representing the resource.
- Throws:
IOException
- If an I/O error occurs while loading
-
loadFromStream
- Throws:
IOException
-
readScenes
public void readScenes(com.google.gson.JsonPrimitive defaultScene, Node rootNode) throws IOException - Throws:
IOException
-
readNode
- Throws:
IOException
-
readTransforms
-
readMeshPrimitives
- Throws:
IOException
-
readBuffer
public Object readBuffer(Integer bufferViewIndex, int byteOffset, int count, Object store, int numComponents, VertexBuffer.Format format) throws IOException - Throws:
IOException
-
readData
- Throws:
IOException
-
getBytes
- Throws:
IOException
-
readMaterial
- Throws:
IOException
-
readCameras
- Throws:
IOException
-
readTexture
- Throws:
IOException
-
readTexture
- Throws:
IOException
-
readImage
- Throws:
IOException
-
readAnimation
- Throws:
IOException
-
readSampler
- Throws:
IOException
-
readSkins
- Throws:
IOException
-
readNodeAsBone
public Joint readNodeAsBone(int nodeIndex, int jointIndex, int skinIndex, Matrix4f inverseModelBindMatrix) throws IOException - Throws:
IOException
-
fetchFromCache
-
addToCache
-
getInfo
-
getDocRoot
public com.google.gson.JsonObject getDocRoot() -
getRootNode
-
registerExtension
-
unregisterExtension
-
registerDefaultExtrasLoader
Sets the default extras loader used when no loader is specified in the GltfModelKey.- Parameters:
loader
- the default extras loader.
-
unregisterDefaultExtrasLoader
public static void unregisterDefaultExtrasLoader()Unregisters the default extras loader.
-