use of com.jme3.shader.Uniform in project jmonkeyengine by jMonkeyEngine.
the class FbxNode method toJmeObject.
@Override
public Spatial toJmeObject() {
Spatial spatial;
if (nodeAttribute instanceof FbxMesh) {
FbxMesh fbxMesh = (FbxMesh) nodeAttribute;
IntMap<Mesh> jmeMeshes = fbxMesh.getJmeObject();
if (jmeMeshes == null || jmeMeshes.size() == 0) {
// No meshes found on FBXMesh (??)
logger.log(Level.WARNING, "No meshes could be loaded. Creating empty node.");
spatial = new Node(getName() + "-node");
} else {
// Multiple jME3 geometries required for a single FBXMesh.
String nodeName;
if (children.isEmpty()) {
nodeName = getName() + "-mesh";
} else {
nodeName = getName() + "-node";
}
Node node = new Node(nodeName);
boolean singleMesh = jmeMeshes.size() == 1;
for (IntMap.Entry<Mesh> meshInfo : jmeMeshes) {
node.attachChild(tryCreateGeometry(meshInfo.getKey(), meshInfo.getValue(), singleMesh));
}
spatial = node;
}
} else {
if (nodeAttribute != null) {
// Just specifies that this is a "null" node.
nodeAttribute.getJmeObject();
}
// TODO: handle other node attribute types.
// right now everything we don't know about gets converted
// to jME3 Node.
spatial = new Node(getName() + "-node");
}
if (!children.isEmpty()) {
// Check uniform scale.
// Although, if inheritType is 0 (eInheritRrSs)
// it might not be a problem.
Vector3f localScale = jmeLocalNodeTransform.getScale();
if (!FastMath.approximateEquals(localScale.x, localScale.y) || !FastMath.approximateEquals(localScale.x, localScale.z)) {
logger.log(Level.WARNING, "Non-uniform scale detected on parent node. " + "The model may appear distorted.");
}
}
spatial.setLocalTransform(jmeLocalNodeTransform);
if (visibility == 0.0) {
spatial.setCullHint(CullHint.Always);
}
for (Map.Entry<String, Object> userDataEntry : userData.entrySet()) {
spatial.setUserData(userDataEntry.getKey(), userDataEntry.getValue());
}
return spatial;
}
Aggregations