Fixed double TempVars locking in skeleton and bone when computing skinning matrices, thanks to cyuczieekc

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7301 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 14 years ago
parent d66a02eafc
commit 6c2eba12ec
  1. 10
      engine/src/core/com/jme3/animation/Bone.java
  2. 2
      engine/src/core/com/jme3/animation/Skeleton.java

@ -93,7 +93,6 @@ public final class Bone implements Savable {
private Quaternion worldRot = new Quaternion();
private Vector3f worldScale = new Vector3f();
/**
* Creates a new bone with the given name.
*
@ -104,7 +103,7 @@ public final class Bone implements Savable {
initialPos = new Vector3f();
initialRot = new Quaternion();
initialScale = new Vector3f(1,1,1);
initialScale = new Vector3f(1, 1, 1);
worldBindInversePos = new Vector3f();
worldBindInverseRot = new Quaternion();
@ -323,7 +322,7 @@ public final class Bone implements Savable {
* The skinning transform applies the animation of the bone to a vertex.
* @param m
*/
void getOffsetTransform(Matrix4f m, Quaternion tmp1, Vector3f tmp2, Vector3f tmp3) {
void getOffsetTransform(Matrix4f m, Quaternion tmp1, Vector3f tmp2, Vector3f tmp3, Matrix3f rotMat) {
//Computing scale
Vector3f scale = worldScale.mult(worldBindInverseScale, tmp3);
@ -337,12 +336,8 @@ public final class Bone implements Savable {
//populating the matrix
m.loadIdentity();
TempVars vars = TempVars.get();
assert vars.lock();
Matrix3f rotMat = vars.tempMat3;
m.setTransform(translate, scale, rotate.toRotationMatrix(rotMat));
assert vars.unlock();
}
/**
@ -377,7 +372,6 @@ public final class Bone implements Savable {
worldPos.set(translation);
worldRot.set(rotation);
}
protected Vector3f tmpVec = new Vector3f();
protected Quaternion tmpQuat = new Quaternion();

@ -213,7 +213,7 @@ public final class Skeleton implements Savable {
TempVars vars = TempVars.get();
assert vars.lock();
for (int i = 0; i < boneList.length; i++) {
boneList[i].getOffsetTransform(skinningMatrixes[i], vars.quat1, vars.vect1, vars.vect2);
boneList[i].getOffsetTransform(skinningMatrixes[i], vars.quat1, vars.vect1, vars.vect2, vars.tempMat3);
}
assert vars.unlock();
return skinningMatrixes;

Loading…
Cancel
Save