public Renderable getRenderable (final Renderable out, final Node node, final NodePart nodePart) { nodePart.setRenderable(out); if (nodePart.bones == null && transform != null) out.worldTransform.set(transform).mul(node.globalTransform); else if (transform != null) out.worldTransform.set(transform); else out.worldTransform.idt(); out.userData = userData; return out; }
/** Adds the specified MeshPart to the current Node. The Mesh will be managed by the model and disposed when the model is * disposed. The resources the Material might contain are not managed, use {@link #manage(Disposable)} to add those to the * model. */ public void part (final MeshPart meshpart, final Material material) { if (node == null) node(); node.parts.add(new NodePart(meshpart, material)); }
/** 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; }
/** Adds the specified MeshPart to the current Node. The Mesh will be managed by the model and disposed when the model is * disposed. The resources the Material might contain are not managed, use {@link #manage(Disposable)} to add those to the * model. */ public void part (final MeshPart meshpart, final Material material) { if (node == null) node(); node.parts.add(new NodePart(meshpart, material)); }
/** 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; }
NodePart nodePart = new NodePart(); nodePart.meshPart = meshPart; nodePart.material = meshMaterial;
public Renderable getRenderable (final Renderable out, final Node node, final NodePart nodePart) { nodePart.setRenderable(out); if (nodePart.bones == null && transform != null) out.worldTransform.set(transform).mul(node.globalTransform); else if (transform != null) out.worldTransform.set(transform); else out.worldTransform.idt(); out.userData = userData; return out; }
/** 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; }
NodePart nodePart = new NodePart(); nodePart.meshPart = meshPart; nodePart.material = meshMaterial;
@Override public void create () { super.create(); environment.clear(); environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.2f, 0.2f, 0.2f, 1.0f)); environment.add(dirLight = new DirectionalLight().set(0.8f, 0.2f, 0.2f, -1f, -2f, -0.5f)); environment.add(pointLight = new PointLight().set(0.2f, 0.8f, 0.2f, 0f, 0f, 0f, 100f)); ModelBuilder mb = new ModelBuilder(); lightModel = mb.createSphere(1, 1, 1, 10, 10, new Material(ColorAttribute.createDiffuse(1, 1, 1, 1)), Usage.Position); lightModel.nodes.get(0).parts.get(0).setRenderable(pLight = new Renderable()); }
/** Adds the specified MeshPart to the current Node. The Mesh will be managed by the model and disposed when the model is * disposed. The resources the Material might contain are not managed, use {@link #manage(Disposable)} to add those to the * model. */ public void part (final MeshPart meshpart, final Material material) { if (node == null) node(); node.parts.add(new NodePart(meshpart, material)); }
public Renderable getRenderable (final Renderable out, final Node node, final NodePart nodePart) { nodePart.setRenderable(out); if (nodePart.bones == null && transform != null) out.worldTransform.set(transform).mul(node.globalTransform); else if (transform != null) out.worldTransform.set(transform); else out.worldTransform.idt(); out.userData = userData; return out; }
/** * Adds the specified MeshPart to the current Node. The Mesh will be managed * by the model and disposed when the model is disposed. The resources the * Material might contain are not managed, use {@link #manage(Disposable)} * to add those to the model. */ public void part(final MeshPart meshpart, final Material material) { if (node == null) node(); node.parts.add(new NodePart(meshpart, material)); }
NodePart nodePart = new NodePart(); nodePart.meshPart = meshPart; nodePart.material = meshMaterial;
@Deprecated public static Model createFromMesh(final Mesh mesh, int indexOffset, int vertexCount, int primitiveType, final Material material) { Model result = new Model(); MeshPart meshPart = new MeshPart(); meshPart.id = "part1"; meshPart.offset = indexOffset; meshPart.size = vertexCount; meshPart.primitiveType = primitiveType; meshPart.mesh = mesh; NodePart partMaterial = new NodePart(); partMaterial.material = material; partMaterial.meshPart = meshPart; Node node = new Node(); node.id = "node1"; node.parts.add(partMaterial); result.meshes.add(mesh); result.materials.add(material); result.nodes.add(node); result.meshParts.add(meshPart); result.manageDisposable(mesh); return result; }