Class GltfLoader
java.lang.Object
com.jme3.scene.plugins.gltf.GltfLoader
- All Implemented Interfaces:
com.jme3.asset.AssetLoader
- Direct Known Subclasses:
GlbLoader
GLTF 2.0 loader Created by Nehon on 07/08/2017.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCache(String name, int index, Object object, int maxLength) protected com.jme3.material.MaterialcreateMaterial(GltfMaterialData gltfMaterialData, int materialIndex) <T> TfetchFromCache(String name, int index, Class<T> type) protected com.jme3.texture.Texture2DgetAsTexture2D(com.jme3.plugins.json.JsonObject jsonObject, String textureName) protected ByteBuffercom.jme3.plugins.json.JsonObjectcom.jme3.asset.AssetInfogetInfo()com.jme3.scene.Nodeload(com.jme3.asset.AssetInfo assetInfo) protected ObjectloadFromStream(com.jme3.asset.AssetInfo assetInfo, InputStream stream) voidreadAnimation(int animationIndex) readBuffer(Integer bufferViewIndex, int byteOffset, int count, Object store, int numComponents, com.jme3.scene.VertexBuffer.Format format) voidreadData(int bufferIndex) com.jme3.texture.Texture2DreadImage(int sourceIndex, boolean flip) com.jme3.material.MaterialreadMaterial(int materialIndex, boolean usesVertexColors) protected com.jme3.material.MaterialreadMaterialUsingMaterialAdapters(int materialIndex, boolean usesVertexColors) Deprecated.com.jme3.scene.Geometry[]readMeshPrimitives(int meshIndex) readNode(int nodeIndex) com.jme3.anim.JointreadNodeAsBone(int nodeIndex, int jointIndex, int skinIndex, com.jme3.math.Matrix4f inverseModelBindMatrix) com.jme3.texture.Texture2DreadSampler(int samplerIndex, com.jme3.texture.Texture2D texture) voidreadScenes(com.jme3.plugins.json.JsonPrimitive defaultScene, com.jme3.scene.Node rootNode) voidprotected GltfMaterialDatareadStandardMaterialParameters(com.jme3.plugins.json.JsonObject materialJson) com.jme3.texture.Texture2DreadTexture(com.jme3.plugins.json.JsonObject texture) com.jme3.texture.Texture2DreadTexture(com.jme3.plugins.json.JsonObject texture, boolean flip) com.jme3.math.TransformreadTransforms(com.jme3.plugins.json.JsonObject nodeData) static voidregisterDefaultExtrasLoader(Class<? extends ExtrasLoader> loader) Sets the default extras loader used when no loader is specified in the GltfModelKey.static voidregisterExtension(String name, Class<? extends ExtensionLoader> ext) static voidregisterMaterialFactoryFirst(GltfMaterialFactory materialFactory) Registers a new material factory and places it before all existing factories.
The ordering of these factories defines their priority.static voidregisterMaterialFactoryLast(GltfMaterialFactory materialFactory) Registers a new material factory and places it behind all existing factories.
The ordering of these factories defines their priority.static voidUnregisters all material factories.static voidUnregisters the default extras loader.static voidunregisterExtension(String name) static voidunregisterMaterialFactory(Class<? extends GltfMaterialFactory> materialFactoryClass) Unregisters a material factory by its class.viewBuffer(Integer bufferViewIndex, int byteOffset, int count, int numComponents, com.jme3.scene.VertexBuffer.Format originalFormat, com.jme3.scene.VertexBuffer.Format targetFormat)
-
Constructor Details
-
GltfLoader
public GltfLoader()
-
-
Method Details
-
load
- Specified by:
loadin interfacecom.jme3.asset.AssetLoader- Throws:
IOException
-
loadFromStream
protected Object loadFromStream(com.jme3.asset.AssetInfo assetInfo, InputStream stream) throws IOException - Throws:
IOException
-
readScenes
public void readScenes(com.jme3.plugins.json.JsonPrimitive defaultScene, com.jme3.scene.Node rootNode) throws IOException - Throws:
IOException
-
readNode
- Throws:
IOException
-
readTransforms
public com.jme3.math.Transform readTransforms(com.jme3.plugins.json.JsonObject nodeData) -
readMeshPrimitives
- Throws:
IOException
-
readBuffer
public Object readBuffer(Integer bufferViewIndex, int byteOffset, int count, Object store, int numComponents, com.jme3.scene.VertexBuffer.Format format) throws IOException - Throws:
IOException
-
viewBuffer
public Buffer viewBuffer(Integer bufferViewIndex, int byteOffset, int count, int numComponents, com.jme3.scene.VertexBuffer.Format originalFormat, com.jme3.scene.VertexBuffer.Format targetFormat) throws IOException - Throws:
IOException
-
readData
- Throws:
IOException
-
getBytes
- Throws:
IOException
-
readMaterial
public com.jme3.material.Material readMaterial(int materialIndex, boolean usesVertexColors) throws IOException - Throws:
IOException
-
readStandardMaterialParameters
protected GltfMaterialData readStandardMaterialParameters(com.jme3.plugins.json.JsonObject materialJson) throws IOException - Throws:
IOException
-
createMaterial
protected com.jme3.material.Material createMaterial(GltfMaterialData gltfMaterialData, int materialIndex) -
readMaterialUsingMaterialAdapters
@Deprecated protected com.jme3.material.Material readMaterialUsingMaterialAdapters(int materialIndex, boolean usesVertexColors) throws IOException Deprecated.- Throws:
IOException
-
readCameras
- Throws:
IOException
-
getAsTexture2D
protected com.jme3.texture.Texture2D getAsTexture2D(com.jme3.plugins.json.JsonObject jsonObject, String textureName) throws IOException - Throws:
IOException
-
readTexture
public com.jme3.texture.Texture2D readTexture(com.jme3.plugins.json.JsonObject texture) throws IOException - Throws:
IOException
-
readTexture
public com.jme3.texture.Texture2D readTexture(com.jme3.plugins.json.JsonObject texture, boolean flip) throws IOException - Throws:
IOException
-
readImage
- Throws:
IOException
-
readAnimation
- Throws:
IOException
-
readSampler
public com.jme3.texture.Texture2D readSampler(int samplerIndex, com.jme3.texture.Texture2D texture) throws IOException - Throws:
IOException
-
readSkins
- Throws:
IOException
-
readNodeAsBone
public com.jme3.anim.Joint readNodeAsBone(int nodeIndex, int jointIndex, int skinIndex, com.jme3.math.Matrix4f inverseModelBindMatrix) throws IOException - Throws:
IOException
-
fetchFromCache
-
addToCache
-
getInfo
public com.jme3.asset.AssetInfo getInfo() -
getDocRoot
public com.jme3.plugins.json.JsonObject getDocRoot() -
getRootNode
public com.jme3.scene.Node 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. -
registerMaterialFactoryFirst
Registers a new material factory and places it before all existing factories.
The ordering of these factories defines their priority. When a new material needs to be created, the loader searches for the first material factory that accepts the given material data.- Parameters:
materialFactory- TheGltfMaterialFactoryto register.
-
registerMaterialFactoryLast
Registers a new material factory and places it behind all existing factories.
The ordering of these factories defines their priority. When a new material needs to be created, the loader searches for the first material factory that accepts the given material data.- Parameters:
materialFactory- TheGltfMaterialFactoryto register.
-
unregisterMaterialFactory
public static void unregisterMaterialFactory(Class<? extends GltfMaterialFactory> materialFactoryClass) Unregisters a material factory by its class.- Parameters:
materialFactoryClass- The class of theGltfMaterialFactoryto unregister.
-
unregisterAllMaterialFactories
public static void unregisterAllMaterialFactories()Unregisters all material factories.
-