diff --git a/src/java/com/threerings/jme/model/SkinMesh.java b/src/java/com/threerings/jme/model/SkinMesh.java index 469460d03..c54d5c344 100644 --- a/src/java/com/threerings/jme/model/SkinMesh.java +++ b/src/java/com/threerings/jme/model/SkinMesh.java @@ -263,7 +263,7 @@ public class SkinMesh extends ModelMesh _vertex.addLocal( xform.mult(_overtex, _tmp).multLocal(weight)); _normal.addLocal( - xform.multAcross(_onormal, _tmp).multLocal(weight)); + multNormal(_onormal, xform, _tmp).multLocal(weight)); } BufferUtils.setInBuffer(_vertex, vbuf, idx); BufferUtils.setInBuffer(_normal, nbuf, idx); @@ -272,6 +272,23 @@ public class SkinMesh extends ModelMesh updateModelBound(); } + /** + * Multiplies a normal vector by the 3x3 rotation submatrix of the given + * matrix. + * + * @param store the vector in which to store the result + * @return the result vector + */ + protected static Vector3f multNormal ( + Vector3f normal, Matrix4f matrix, Vector3f store) + { + float nx = normal.x, ny = normal.y, nz = normal.z; + store.x = nx * matrix.m00 + ny * matrix.m01 + nz * matrix.m02; + store.y = nx * matrix.m10 + ny * matrix.m11 + nz * matrix.m12; + store.z = nx * matrix.m20 + ny * matrix.m21 + nz * matrix.m22; + return store; + } + /** The groups of vertices influenced by different sets of bones. */ protected WeightGroup[] _weightGroups;