Skeletal Animation: remove shared mesh support

- shared meshes in J3O / OgreXML are automatically de-shared on import, so this functionality is no longer used in the engine
experimental
shadowislord 10 years ago
parent 5760a48eea
commit 50f0eca3e6
  1. 33
      jme3-core/src/main/java/com/jme3/animation/SkeletonControl.java
  2. 1
      jme3-core/src/main/java/com/jme3/scene/Geometry.java

@ -206,43 +206,18 @@ public class SkeletonControl extends AbstractControl implements Cloneable {
}
private void findTargets(Node node) {
Mesh sharedMesh = null;
for (Spatial child : node.getChildren()) {
if (child instanceof Geometry) {
Geometry geom = (Geometry) child;
// is this geometry using a shared mesh?
Mesh childSharedMesh = geom.getUserData(UserData.JME_SHAREDMESH);
if (childSharedMesh != null) {
// Don’t bother with non-animated shared meshes
if (childSharedMesh.isAnimated()) {
// child is using shared mesh,
// so animate the shared mesh but ignore child
if (sharedMesh == null) {
sharedMesh = childSharedMesh;
} else if (sharedMesh != childSharedMesh) {
throw new IllegalStateException("Two conflicting shared meshes for " + node);
}
materials.add(geom.getMaterial());
}
} else {
Mesh mesh = geom.getMesh();
if (mesh.isAnimated()) {
targets.add(mesh);
materials.add(geom.getMaterial());
}
Mesh mesh = geom.getMesh();
if (mesh.isAnimated()) {
targets.add(mesh);
materials.add(geom.getMaterial());
}
} else if (child instanceof Node) {
findTargets((Node) child);
}
}
if (sharedMesh != null) {
targets.add(sharedMesh);
}
}
@Override

@ -580,6 +580,7 @@ public class Geometry extends Spatial {
Mesh sharedMesh = getUserData(UserData.JME_SHAREDMESH);
if (sharedMesh != null) {
getMesh().extractVertexData(sharedMesh);
setUserData(UserData.JME_SHAREDMESH, null);
}
}
}

Loading…
Cancel
Save