* @return a new Ardor3D node, created from the given <node> element
*/
@SuppressWarnings("unchecked")
private Node buildNode(final Element dNode, JointNode jointNode) {
final NodeType nodeType = getNodeType(dNode);
final JointNode jointChildNode;
if (nodeType == NodeType.JOINT) {
String name = dNode.getAttributeValue("name");
if (name == null) {
name = dNode.getAttributeValue("id");
}
if (name == null) {
name = dNode.getAttributeValue("sid");
}
final Joint joint = new Joint(name);
jointChildNode = new JointNode(joint);
jointChildNode.setParent(jointNode);
jointNode.getChildren().add(jointChildNode);
jointNode = jointChildNode;
_dataCache.getElementJointMapping().put(dNode, joint);
} else {
jointChildNode = null;
}
String nodeName = dNode.getAttributeValue("name", (String) null);
if (nodeName == null) { // use id if name doesn't exist
nodeName = dNode.getAttributeValue("id", dNode.getName());
}
final Node node = new Node(nodeName);
final List<Element> transforms = new ArrayList<Element>();
for (final Element child : dNode.getChildren()) {
if (_dataCache.getTransformTypes().contains(child.getName())) {
transforms.add(child);
}
}
// process any transform information.
if (!transforms.isEmpty()) {
final Transform localTransform = getNodeTransforms(transforms);
node.setTransform(localTransform);
if (jointChildNode != null) {
jointChildNode.setSceneNode(node);
}
}
// process any instance geometries
for (final Element instance_geometry : dNode.getChildren("instance_geometry")) {