本文整理汇总了Java中com.badlogic.gdx.graphics.g3d.model.Node.addChild方法的典型用法代码示例。如果您正苦于以下问题:Java Node.addChild方法的具体用法?Java Node.addChild怎么用?Java Node.addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.graphics.g3d.model.Node
的用法示例。
在下文中一共展示了Node.addChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyNode
import com.badlogic.gdx.graphics.g3d.model.Node; //导入方法依赖的package包/类
private Node copyNode (Node node) {
Node copy = new Node();
copy.id = node.id;
copy.inheritTransform = node.inheritTransform;
copy.translation.set(node.translation);
copy.rotation.set(node.rotation);
copy.scale.set(node.scale);
copy.localTransform.set(node.localTransform);
copy.globalTransform.set(node.globalTransform);
for (NodePart nodePart : node.parts) {
copy.parts.add(copyNodePart(nodePart));
}
for (Node child : node.getChildren()) {
copy.addChild(copyNode(child));
}
return copy;
}
示例2: process
import com.badlogic.gdx.graphics.g3d.model.Node; //导入方法依赖的package包/类
@Override
protected void process(int entityId) {
ModelComponent modelComponent = modelMapper.get(entityId);
NodeComponent nodeComponent = nodeMapper.get(entityId);
if (modelComponent.enabled && cameras.size > 0 &&
modelComponent.type == ModelComponent.Type.DYNAMIC && modelComponent.model != null) {
Camera camera = cameras.first();
if (!modelComponent.nodeAdded) {
modelComponent.nodeAdded = true;
for (int i = 0; i < modelComponent.model.nodes.size; i++) {
Node n = modelComponent.model.nodes.get(i);
nodeComponent.node.addChild(n);
}
String parentInternalNodeId = nodeComponent.parentInternalNodeId;
if (parentInternalNodeId != null && !parentInternalNodeId.isEmpty()) {
NodeComponent parentNodeComponent = nodeComponent.parentNodeComponent;
Node parentInternalNode = parentNodeComponent.node.getChild(parentInternalNodeId, true, false);
if (parentInternalNode != null) {
parentNodeComponent.node.removeChild(nodeComponent.node);
parentInternalNode.addChild(nodeComponent.node);
}
}
}
modelComponent.model.calculateTransforms();
if (camera.frustum.sphereInFrustum(nodeComponent.getTranslation(), modelComponent.radius)) {
if (modelComponent.animationController != null) {
modelComponent.animationController.update(Gdx.graphics.getDeltaTime());
}
renderableProviders.add(modelComponent.model);
}
}
}
示例3: loadNode
import com.badlogic.gdx.graphics.g3d.model.Node; //导入方法依赖的package包/类
private Node loadNode (ModelNode modelNode) {
Node node = new Node();
node.id = modelNode.id;
if (modelNode.translation != null) node.translation.set(modelNode.translation);
if (modelNode.rotation != null) node.rotation.set(modelNode.rotation);
if (modelNode.scale != null) node.scale.set(modelNode.scale);
// FIXME create temporary maps for faster lookup?
if (modelNode.parts != null) {
for (ModelNodePart modelNodePart : modelNode.parts) {
MeshPart meshPart = null;
Material meshMaterial = null;
if (modelNodePart.meshPartId != null) {
for (MeshPart part : meshParts) {
if (modelNodePart.meshPartId.equals(part.id)) {
meshPart = part;
break;
}
}
}
if (modelNodePart.materialId != null) {
for (Material material : materials) {
if (modelNodePart.materialId.equals(material.id)) {
meshMaterial = material;
break;
}
}
}
if (meshPart == null || meshMaterial == null) throw new GdxRuntimeException("Invalid node: " + node.id);
if (meshPart != null && meshMaterial != null) {
NodePart nodePart = new NodePart();
nodePart.meshPart = meshPart;
nodePart.material = meshMaterial;
node.parts.add(nodePart);
if (modelNodePart.bones != null) nodePartBones.put(nodePart, modelNodePart.bones);
}
}
}
if (modelNode.children != null) {
for (ModelNode child : modelNode.children) {
node.addChild(loadNode(child));
}
}
return node;
}