Package com.jme3.scene.plugins.gltf
Class GltfUtils
java.lang.Object
com.jme3.scene.plugins.gltf.GltfUtils
Created by Nehon on 07/08/2017.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBufferstatic voidassertNotNull(Object o, String errorMessage) static voiddumpArray(float[] array) static voidstatic voidstatic booleanequalsEpsilon(Quaternion q1, Quaternion q2) static booleanequalsEpsilon(Vector3f v1, Vector3f v2) static SpatialfindCommonAncestor(List<Spatial> spatials) static MaterialAdaptergetAdapterForMaterial(AssetInfo info, String defName) static BooleangetAsBoolean(com.jme3.plugins.json.JsonObject parent, String name) static BooleangetAsBoolean(com.jme3.plugins.json.JsonObject parent, String name, boolean defaultValue) static ColorRGBAgetAsColor(com.jme3.plugins.json.JsonObject parent, String name) static ColorRGBAgetAsColor(com.jme3.plugins.json.JsonObject parent, String name, ColorRGBA defaultValue) static FloatgetAsFloat(com.jme3.plugins.json.JsonObject parent, String name) static FloatgetAsFloat(com.jme3.plugins.json.JsonObject parent, String name, float defaultValue) static IntegergetAsInteger(com.jme3.plugins.json.JsonObject parent, String name) static IntegergetAsInteger(com.jme3.plugins.json.JsonObject parent, String name, int defaultValue) static StringgetAsString(com.jme3.plugins.json.JsonObject parent, String name) static BuffergetBufferView(ByteBuffer source, int byteOffset, int count, int byteStride, int numComponents, VertexBuffer.Format originalFormat, VertexBuffer.Format targetFormat) Try to expose a glTF buffer region as a typed NIO view without copying.static intstatic GltfModelKeystatic Texture.MagFiltergetMagFilter(Integer value) static Mesh.ModegetMeshMode(Integer mode) static Texture.MinFiltergetMinFilter(Integer value) static intgetNumberOfComponents(String type) static LittleEndiengetStream(byte[] buffer) static VertexBuffer.FormatgetVertexBufferFormat(int componentType) static VertexBuffer.TypegetVertexBufferType(String attribute) static Texture.WrapModegetWrapMode(Integer value) static voidhandleSkinningBuffers(Mesh mesh, IntMap<GltfLoader.SkinBuffers> skinBuffers) static booleanisKeepSkeletonPose(AssetInfo info) static voidpadBuffer(float[] array, int bufferSize) static voidpadBuffer(short[] array, int bufferSize) static voidstatic voidpadBuffer(Quaternion[] array, int bufferSize) static voidstatic voidstatic com.jme3.plugins.json.JsonObjectparse(InputStream stream) Parse a json input stream and returns aJsonObjectstatic voidpopulateBuffer(Object store, ByteBuffer source, int count, int byteOffset, int byteStride, int numComponents, VertexBuffer.Format format) static floatreadAsFloat(ByteBuffer source, VertexBuffer.Format format) static voidreadToByteArray(InputStream input, byte[] dst, int bytesToRead) static voidreadToByteBuffer(InputStream input, ByteBuffer dst, int bytesToRead) static voidsetSkinBuffers(Mesh mesh, short[] jointsArray, float[] weightsArray, int componentSize) static byte[]toByteArray(short[] shortArray) static Matrix4ftoRowMajor(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
-
Method Details
-
asReadableByteBuffer
-
parse
Parse a json input stream and returns aJsonObject- Parameters:
stream- the stream to parse- Returns:
- the JsonObject
-
getMeshMode
-
getVertexBufferFormat
-
getNumberOfComponents
-
getVertexBufferType
-
getIndex
-
getMagFilter
-
getMinFilter
-
getWrapMode
-
padBuffer
-
padBuffer
public static void padBuffer(float[] array, int bufferSize) -
padBuffer
public static void padBuffer(short[] array, int bufferSize) -
padBuffer
-
padBuffer
-
padBuffer
-
populateBuffer
public static void populateBuffer(Object store, ByteBuffer source, int count, int byteOffset, int byteStride, int numComponents, VertexBuffer.Format format) throws IOException - Throws:
IOException
-
readAsFloat
- Throws:
IOException
-
toByteArray
public static byte[] toByteArray(short[] shortArray) -
handleSkinningBuffers
-
setSkinBuffers
public static void setSkinBuffers(Mesh mesh, short[] jointsArray, float[] weightsArray, int componentSize) -
toRowMajor
public static Matrix4f toRowMajor(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) -
getKey
-
getAdapterForMaterial
-
isKeepSkeletonPose
-
getStream
-
getAsString
-
getAsInteger
-
getAsInteger
-
getAsFloat
-
getAsFloat
-
getAsBoolean
-
getAsBoolean
-
getAsColor
-
getAsColor
-
assertNotNull
-
equalsEpsilon
-
equalsEpsilon
-
dumpArray
-
dumpArray
public static void dumpArray(float[] array) -
findCommonAncestor
-
dumpMesh
-
readToByteBuffer
public static void readToByteBuffer(InputStream input, ByteBuffer dst, int bytesToRead) throws IOException - Throws:
IOException
-
readToByteArray
public static void readToByteArray(InputStream input, byte[] dst, int bytesToRead) throws IOException - Throws:
IOException
-
getBufferView
public static Buffer getBufferView(ByteBuffer source, int byteOffset, int count, int byteStride, int numComponents, VertexBuffer.Format originalFormat, VertexBuffer.Format targetFormat) throws IOException Try to expose a glTF buffer region as a typed NIO view without copying. Falls back to allocating a destination buffer and populating it when interleaving, normalization, or format mismatch prevents a pure view.- Parameters:
source- the original ByteBuffer (direct or heap)byteOffset- start offset within source (relative to beginning)count- number of elementsbyteStride- stride in bytes (0 means tightly packed = element size)numComponents- components per element (e.g. 3 for VEC3)originalFormat- the source component typetargetFormat- the desired buffer view type to return- Throws:
IOException
-