Class GltfScene
java.lang.Object
com.codename1.gpu.GltfScene
The whole of a glTF 2.0 file as plain data: every node of the scene graph,
every triangle primitive, the materials, the skins and the animation clips.
Produced by GltfLoader#loadScene(byte[]).
Nothing here is uploaded to a GraphicsDevice; the vertex data is kept on the
CPU so a renderer can pose it. com.codename1.gaming.AnimatedModel is the
ready made consumer: it samples the clips, skins the vertices and draws the
result as ordinary Meshes.
Node transforms follow the glTF convention: a node's local matrix is
T * R * S of its translation, rotation (an x, y, z, w quaternion) and
scale, and its world matrix is its parent's world matrix times that.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA named animation clip.static final classKeyframes for one property of one node.static final classThe parts of a glTF material aMaterialcan express.static final classOne node of the scene graph.static final classOne triangle primitive, with its vertex data in the node's local space.static final classA skeleton: the joint nodes and the matrices that take a vertex from the mesh's bind pose into each joint's space. -
Method Summary
Modifier and TypeMethodDescriptionfindAnimation(String name) The first clip namedname, or null.intThe index of the first node namedname, or -1.getAnimation(int index) The clip atindex.intThe number of animation clips.getImage(int index) The decoded embedded image atindex, or null when it could not be read.getMaterial(int index) The material atindex.intThe number of materials.getNode(int index) The node atindex.intThe number of nodes in the file.getPrimitive(int index) The primitive atindex.intThe number of triangle primitives across every mesh node.int[]getRoots()The indices of the scene's root nodes, parents before children.getSkin(int index) The skin atindex.intThe number of skins.getTexture(GraphicsDevice device, int index) The texture for imageindexondevice, uploaded on first use and then shared by every model drawn from this scene.
-
Method Details
-
getNodeCount
public int getNodeCount()The number of nodes in the file. -
getNode
The node atindex. -
findNode
The index of the first node namedname, or -1. -
getRoots
public int[] getRoots()The indices of the scene's root nodes, parents before children. -
getPrimitiveCount
public int getPrimitiveCount()The number of triangle primitives across every mesh node. -
getPrimitive
The primitive atindex. -
getMaterialCount
public int getMaterialCount()The number of materials. -
getMaterial
The material atindex. -
getImage
The decoded embedded image atindex, or null when it could not be read. -
getTexture
The texture for imageindexondevice, uploaded on first use and then shared by every model drawn from this scene. Returns null when the image could not be decoded. Asking with a different device uploads afresh. -
getSkinCount
public int getSkinCount()The number of skins. -
getSkin
The skin atindex. -
getAnimationCount
public int getAnimationCount()The number of animation clips. -
getAnimation
The clip atindex. -
findAnimation
The first clip namedname, or null.
-