From 68da72cf66f61382a181724c6c1ff2aae0c85929 Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sat, 25 Feb 2012 21:25:22 +0000 Subject: [PATCH] * Actually fixed the issue with the tangents this time .. (TestTextureAtlas runs) git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9206 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../optimize/GeometryBatchFactory.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java index ed1a3e4ce..34c3dc83d 100644 --- a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java +++ b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java @@ -64,24 +64,25 @@ public class GeometryBatchFactory { private static void doTransformTangents(FloatBuffer inBuf, int offset, int components, FloatBuffer outBuf, Matrix4f transform) { Vector3f tan = new Vector3f(); - float handedness; // offset is given in element units // convert to be in component units offset *= components; for (int i = 0; i < inBuf.capacity() / components; i++) { - tan.x = inBuf.get(i * 4 + 0); - tan.y = inBuf.get(i * 4 + 1); - tan.z = inBuf.get(i * 4 + 2); - handedness = inBuf.get(i * 4 + 3); + tan.x = inBuf.get(i * components + 0); + tan.y = inBuf.get(i * components + 1); + tan.z = inBuf.get(i * components + 2); transform.multNormal(tan, tan); - outBuf.put(offset + i * 4 + 0, tan.x); - outBuf.put(offset + i * 4 + 1, tan.y); - outBuf.put(offset + i * 4 + 2, tan.z); - outBuf.put(offset + i * 4 + 3, handedness); + outBuf.put(offset + i * components + 0, tan.x); + outBuf.put(offset + i * components + 1, tan.y); + outBuf.put(offset + i * components + 2, tan.z); + + if (components == 4){ + outBuf.put(offset + i * components + 3, inBuf.get(i * components + 3)); + } } }