Fixed NPE is B3D loader caused by the missing vertex normal; updated the example chest model - it's now has 2 meshes; Updated ModelAnimationDebug - it now uses the new chest model, renders the base with the static world renderer, and only the lid with the TESR.

This commit is contained in:
RainWarrior committed 2015-11-23 10:12:01 +03:00
1 parent 918d59d6a6
commit 9815d729b5
5 files changed
+49 -15

No files matched your search

@@ -636,13 +636,19 @@ public class B3DModel
Vector3f rPos = new Vector3f(newPos.x / newPos.w, newPos.y / newPos.w, newPos.z / newPos.w);
// normal
Matrix3f tm = new Matrix3f();
t.getRotationScale(tm);
tm.invert();
tm.transpose();
Vector3f normal = new Vector3f(this.normal), rNormal = new Vector3f();
tm.transform(normal, rNormal);
rNormal.normalize();
Vector3f rNormal = null;
if(this.normal != null)
{
Matrix3f tm = new Matrix3f();
t.getRotationScale(tm);
tm.invert();
tm.transpose();
Vector3f normal = new Vector3f(this.normal);
rNormal = new Vector3f();
tm.transform(normal, rNormal);
rNormal.normalize();
}
// texCoords TODO
return new Vertex(rPos, rNormal, color, texCoords);