Search in sources :

Example 21 with Node

use of com.badlogic.gdx.graphics.g3d.model.Node in project libgdx by libgdx.

the class SkeletonTest method renderSkeleton.

public void renderSkeleton(final ModelInstance instance) {
    shapeRenderer.setProjectionMatrix(cam.combined);
    shapeRenderer.begin(ShapeType.Line);
    for (Node node : instance.nodes) {
        shapeRenderer.setColor(node.isAnimated ? Color.RED : Color.YELLOW);
        node.globalTransform.getTranslation(tmpV);
        shapeRenderer.box(tmpV.x, tmpV.y, tmpV.z, 0.5f, 0.5f, 0.5f);
        for (Node child : node.getChildren()) renderSkeleton(tmpV, child);
    }
    shapeRenderer.end();
}
Also used : Node(com.badlogic.gdx.graphics.g3d.model.Node)

Aggregations

Node (com.badlogic.gdx.graphics.g3d.model.Node)21 Vector3 (com.badlogic.gdx.math.Vector3)5 NodePart (com.badlogic.gdx.graphics.g3d.model.NodePart)4 Model (com.badlogic.gdx.graphics.g3d.Model)3 ModelInstance (com.badlogic.gdx.graphics.g3d.ModelInstance)3 NodeAnimation (com.badlogic.gdx.graphics.g3d.model.NodeAnimation)3 PerspectiveCamera (com.badlogic.gdx.graphics.PerspectiveCamera)2 Material (com.badlogic.gdx.graphics.g3d.Material)2 Animation (com.badlogic.gdx.graphics.g3d.model.Animation)2 MeshPart (com.badlogic.gdx.graphics.g3d.model.MeshPart)2 NodeKeyframe (com.badlogic.gdx.graphics.g3d.model.NodeKeyframe)2 ModelNode (com.badlogic.gdx.graphics.g3d.model.data.ModelNode)2 ModelBuilder (com.badlogic.gdx.graphics.g3d.utils.ModelBuilder)2 Quaternion (com.badlogic.gdx.math.Quaternion)2 BoundingBox (com.badlogic.gdx.math.collision.BoundingBox)2 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)2 AssetManager (com.badlogic.gdx.assets.AssetManager)1 Camera (com.badlogic.gdx.graphics.Camera)1 Texture (com.badlogic.gdx.graphics.Texture)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1