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. 35
      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) { private void findTargets(Node node) {
Mesh sharedMesh = null;
for (Spatial child : node.getChildren()) { for (Spatial child : node.getChildren()) {
if (child instanceof Geometry) { if (child instanceof Geometry) {
Geometry geom = (Geometry) child; Geometry geom = (Geometry) child;
Mesh mesh = geom.getMesh();
// is this geometry using a shared mesh? if (mesh.isAnimated()) {
Mesh childSharedMesh = geom.getUserData(UserData.JME_SHAREDMESH); targets.add(mesh);
materials.add(geom.getMaterial());
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());
}
} }
} else if (child instanceof Node) { } else if (child instanceof Node) {
findTargets((Node) child); findTargets((Node) child);
} }
} }
if (sharedMesh != null) {
targets.add(sharedMesh);
}
} }
@Override @Override
@ -263,7 +238,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable {
softwareSkinUpdate(mesh, offsetMatrices); softwareSkinUpdate(mesh, offsetMatrices);
} }
} }
private void controlRenderHardware() { private void controlRenderHardware() {
offsetMatrices = skeleton.computeSkinningMatrices(); offsetMatrices = skeleton.computeSkinningMatrices();
for (Material m : materials) { for (Material m : materials) {

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

Loading…
Cancel
Save