|
|
@ -99,10 +99,8 @@ public class SkeletonControl extends AbstractControl implements Cloneable { |
|
|
|
Mesh childSharedMesh = geom.getUserData(UserData.JME_SHAREDMESH); |
|
|
|
Mesh childSharedMesh = geom.getUserData(UserData.JME_SHAREDMESH); |
|
|
|
|
|
|
|
|
|
|
|
if (childSharedMesh != null){ |
|
|
|
if (childSharedMesh != null){ |
|
|
|
|
|
|
|
|
|
|
|
// Don't bother with non-animated shared meshes
|
|
|
|
// Don't bother with non-animated shared meshes
|
|
|
|
if (isMeshAnimated(childSharedMesh)){ |
|
|
|
if (isMeshAnimated(childSharedMesh)){ |
|
|
|
|
|
|
|
|
|
|
|
// child is using shared mesh,
|
|
|
|
// child is using shared mesh,
|
|
|
|
// so animate the shared mesh but ignore child
|
|
|
|
// so animate the shared mesh but ignore child
|
|
|
|
if (sharedMesh == null){ |
|
|
|
if (sharedMesh == null){ |
|
|
@ -147,10 +145,12 @@ public class SkeletonControl extends AbstractControl implements Cloneable { |
|
|
|
// if hardware skinning is supported, the matrices and weight buffer
|
|
|
|
// if hardware skinning is supported, the matrices and weight buffer
|
|
|
|
// will be sent by the SkinningShaderLogic object assigned to the shader
|
|
|
|
// will be sent by the SkinningShaderLogic object assigned to the shader
|
|
|
|
for (int i = 0; i < targets.length; i++) { |
|
|
|
for (int i = 0; i < targets.length; i++) { |
|
|
|
// only update targets with bone-vertex assignments
|
|
|
|
// NOTE: This assumes that code higher up
|
|
|
|
if (targets[i].getBuffer(Type.BoneIndex) != null) { |
|
|
|
// Already ensured those targets are animated
|
|
|
|
|
|
|
|
// otherwise a crash will happen in skin update
|
|
|
|
|
|
|
|
//if (isMeshAnimated(targets[i])) {
|
|
|
|
softwareSkinUpdate(targets[i], offsetMatrices); |
|
|
|
softwareSkinUpdate(targets[i], offsetMatrices); |
|
|
|
} |
|
|
|
//}
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
wasMeshUpdated = true; |
|
|
|
wasMeshUpdated = true; |
|
|
@ -195,11 +195,11 @@ public class SkeletonControl extends AbstractControl implements Cloneable { |
|
|
|
clone.setSpatial(clonedNode); |
|
|
|
clone.setSpatial(clonedNode); |
|
|
|
|
|
|
|
|
|
|
|
clone.skeleton = ctrl.getSkeleton(); |
|
|
|
clone.skeleton = ctrl.getSkeleton(); |
|
|
|
Mesh[] meshes = new Mesh[targets.length]; |
|
|
|
// Fix animated targets for the cloned node
|
|
|
|
for (int i = 0; i < meshes.length; i++) { |
|
|
|
clone.targets = findTargets(clonedNode); |
|
|
|
meshes[i] = ((Geometry) clonedNode.getChild(i)).getMesh(); |
|
|
|
|
|
|
|
} |
|
|
|
// Fix attachments for the cloned node
|
|
|
|
for (int i = meshes.length; i < clonedNode.getQuantity(); i++) { |
|
|
|
for (int i = 0; i < clonedNode.getQuantity(); i++) { |
|
|
|
// go through attachment nodes, apply them to correct bone
|
|
|
|
// go through attachment nodes, apply them to correct bone
|
|
|
|
Spatial child = clonedNode.getChild(i); |
|
|
|
Spatial child = clonedNode.getChild(i); |
|
|
|
if (child instanceof Node) { |
|
|
|
if (child instanceof Node) { |
|
|
@ -214,7 +214,7 @@ public class SkeletonControl extends AbstractControl implements Cloneable { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
clone.targets = meshes; |
|
|
|
|
|
|
|
return clone; |
|
|
|
return clone; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -348,7 +348,6 @@ public class SkeletonControl extends AbstractControl implements Cloneable { |
|
|
|
posBuf[idxPositions++] = rz; |
|
|
|
posBuf[idxPositions++] = rz; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fvb.position(fvb.position() - bufLength); |
|
|
|
fvb.position(fvb.position() - bufLength); |
|
|
|
fvb.put(posBuf, 0, bufLength); |
|
|
|
fvb.put(posBuf, 0, bufLength); |
|
|
|
fnb.position(fnb.position() - bufLength); |
|
|
|
fnb.position(fnb.position() - bufLength); |
|
|
|