protected void getRenderables (Node node, Array<Renderable> renderables, Pool<Renderable> pool) { if (node.parts.size > 0) { for (NodePart nodePart : node.parts) { if (nodePart.enabled) renderables.add(getRenderable(pool.obtain(), node, nodePart)); } } for (Node child : node.getChildren()) { getRenderables(child, renderables, pool); } }
protected void getRenderables (Node node, Array<Renderable> renderables, Pool<Renderable> pool) { if (node.parts.size > 0) { for (NodePart nodePart : node.parts) { if (nodePart.enabled) renderables.add(getRenderable(pool.obtain(), node, nodePart)); } } for (Node child : node.getChildren()) { getRenderables(child, renderables, pool); } }
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(); }
private static void rebuildReferences (final Model model, final Node node) { for (final NodePart mpm : node.parts) { if (!model.materials.contains(mpm.material, true)) model.materials.add(mpm.material); if (!model.meshParts.contains(mpm.meshPart, true)) { model.meshParts.add(mpm.meshPart); if (!model.meshes.contains(mpm.meshPart.mesh, true)) model.meshes.add(mpm.meshPart.mesh); model.manageDisposable(mpm.meshPart.mesh); } } for (final Node child : node.getChildren()) rebuildReferences(model, child); }
public void renderSkeleton (final Vector3 from, final Node node) { final Vector3 pos = vectorPool.obtain(); node.globalTransform.getTranslation(pos); shapeRenderer.setColor(node.isAnimated ? Color.RED : Color.YELLOW); shapeRenderer.box(pos.x, pos.y, pos.z, 0.5f, 0.5f, 0.5f); shapeRenderer.setColor(Color.WHITE); shapeRenderer.line(from.x, from.y, from.z, pos.x, pos.y, pos.z); for (Node child : node.getChildren()) renderSkeleton(pos, child); vectorPool.free(pos); }
private static void rebuildReferences (final Model model, final Node node) { for (final NodePart mpm : node.parts) { if (!model.materials.contains(mpm.material, true)) model.materials.add(mpm.material); if (!model.meshParts.contains(mpm.meshPart, true)) { model.meshParts.add(mpm.meshPart); if (!model.meshes.contains(mpm.meshPart.mesh, true)) model.meshes.add(mpm.meshPart.mesh); model.manageDisposable(mpm.meshPart.mesh); } } for (final Node child : node.getChildren()) rebuildReferences(model, child); }
final boolean transformed = applyTransform && !Arrays.equals(transform.val, idt.val); final int o = transformed ? out.size : offset; getShapeParts(node.getChildren(), out, o, pool); if (transformed) { for (int i = o, n = out.size; i < n; i++) {
final boolean transformed = applyTransform && !Arrays.equals(transform.val, idt.val); final int o = transformed ? out.size : offset; getShapeParts(node.getChildren(), out, o, pool); if (transformed) { for (int i = o, n = out.size; i < n; i++) {
/** Creates a nested copy of this Node, any child nodes are copied using the {@link #copy()} method. This will detach this node * from its parent, but does not attach it to the parent of node being copied. The {@link #parts} are copied using the * {@link NodePart#copy()} method. Note that that method copies the material and nodes (bones) by reference. If you intend to * use this node in a different node tree (e.g. a different Model or ModelInstance) then you will need to update these * references afterwards. * * Override this method in your custom Node class to copy any additional fields you've added. * @return This Node for chaining */ protected Node set (Node other) { detach(); id = other.id; isAnimated = other.isAnimated; inheritTransform = other.inheritTransform; translation.set(other.translation); rotation.set(other.rotation); scale.set(other.scale); localTransform.set(other.localTransform); globalTransform.set(other.globalTransform); parts.clear(); for (NodePart nodePart : other.parts) { parts.add(nodePart.copy()); } children.clear(); for (Node child : other.getChildren()) { addChild(child.copy()); } return this; }
/** Creates a nested copy of this Node, any child nodes are copied using the {@link #copy()} method. This will detach this node * from its parent, but does not attach it to the parent of node being copied. The {@link #parts} are copied using the * {@link NodePart#copy()} method. Note that that method copies the material and nodes (bones) by reference. If you intend to * use this node in a different node tree (e.g. a different Model or ModelInstance) then you will need to update these * references afterwards. * * Override this method in your custom Node class to copy any additional fields you've added. * @return This Node for chaining */ protected Node set (Node other) { detach(); id = other.id; isAnimated = other.isAnimated; inheritTransform = other.inheritTransform; translation.set(other.translation); rotation.set(other.rotation); scale.set(other.scale); localTransform.set(other.localTransform); globalTransform.set(other.globalTransform); parts.clear(); for (NodePart nodePart : other.parts) { parts.add(nodePart.copy()); } children.clear(); for (Node child : other.getChildren()) { addChild(child.copy()); } return this; }
protected void getRenderables (Node node, Array<Renderable> renderables, Pool<Renderable> pool) { if (node.parts.size > 0) { for (NodePart nodePart : node.parts) { if (nodePart.enabled) renderables.add(getRenderable(pool.obtain(), node, nodePart)); } } for (Node child : node.getChildren()) { getRenderables(child, renderables, pool); } }
private static void rebuildReferences (final Model model, final Node node) { for (final NodePart mpm : node.parts) { if (!model.materials.contains(mpm.material, true)) model.materials.add(mpm.material); if (!model.meshParts.contains(mpm.meshPart, true)) { model.meshParts.add(mpm.meshPart); if (!model.meshes.contains(mpm.meshPart.mesh, true)) model.meshes.add(mpm.meshPart.mesh); model.manageDisposable(mpm.meshPart.mesh); } } for (final Node child : node.getChildren()) rebuildReferences(model, child); }
private static void rebuildReferences(final Model model, final Node node) { for (final NodePart mpm : node.parts) { if (!model.materials.contains(mpm.material, true)) model.materials.add(mpm.material); if (!model.meshParts.contains(mpm.meshPart, true)) { model.meshParts.add(mpm.meshPart); if (!model.meshes.contains(mpm.meshPart.mesh, true)) model.meshes.add(mpm.meshPart.mesh); model.manageDisposable(mpm.meshPart.mesh); } } Iterable<Node> nodeIter = node.getChildren(); for (final Node child : nodeIter) rebuildReferences(model, child); }
final boolean transformed = applyTransform && !Arrays.equals(transform.val, idt.val); final int o = transformed ? out.size : offset; getShapeParts(node.getChildren(), out, o, pool); if (transformed) { for (int i = o, n = out.size; i < n; i++) {
private void drawArmatureNodes(Node currentNode, Vector3 modelPos, Quaternion modelRot, Vector3 parentNodePos, Vector3 currentNodePos) { currentNode.globalTransform.getTranslation(currentNodePos); modelRot.transform(currentNodePos); currentNodePos.add(modelPos); drawVertex(currentNodePos, 0.02f, Color.GREEN); shapeRenderer.setColor(Color.YELLOW); if (currentNode.hasParent()) { shapeRenderer.line(parentNodePos, currentNodePos); } if (currentNode.hasChildren()) { float x = currentNodePos.x; float y = currentNodePos.y; float z = currentNodePos.z; for (Node child : currentNode.getChildren()) { drawArmatureNodes(child, modelPos, modelRot, currentNodePos, parentNodePos); currentNodePos.set(x, y, z); } } }
/** Creates a nested copy of this Node, any child nodes are copied using the {@link #copy()} method. This will detach this node * from its parent, but does not attach it to the parent of node being copied. The {@link #parts} are copied using the * {@link NodePart#copy()} method. Note that that method copies the material and nodes (bones) by reference. If you intend to * use this node in a different node tree (e.g. a different Model or ModelInstance) then you will need to update these * references afterwards. * * Override this method in your custom Node class to copy any additional fields you've added. * @return This Node for chaining */ protected Node set (Node other) { detach(); id = other.id; isAnimated = other.isAnimated; inheritTransform = other.inheritTransform; translation.set(other.translation); rotation.set(other.rotation); scale.set(other.scale); localTransform.set(other.localTransform); globalTransform.set(other.globalTransform); parts.clear(); for (NodePart nodePart : other.parts) { parts.add(nodePart.copy()); } children.clear(); for (Node child : other.getChildren()) { addChild(child.copy()); } return this; }