* 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
This commit is contained in:
parent
c9046fa21c
commit
68da72cf66
@ -64,24 +64,25 @@ public class GeometryBatchFactory {
|
|||||||
|
|
||||||
private static void doTransformTangents(FloatBuffer inBuf, int offset, int components, FloatBuffer outBuf, Matrix4f transform) {
|
private static void doTransformTangents(FloatBuffer inBuf, int offset, int components, FloatBuffer outBuf, Matrix4f transform) {
|
||||||
Vector3f tan = new Vector3f();
|
Vector3f tan = new Vector3f();
|
||||||
float handedness;
|
|
||||||
|
|
||||||
// offset is given in element units
|
// offset is given in element units
|
||||||
// convert to be in component units
|
// convert to be in component units
|
||||||
offset *= components;
|
offset *= components;
|
||||||
|
|
||||||
for (int i = 0; i < inBuf.capacity() / components; i++) {
|
for (int i = 0; i < inBuf.capacity() / components; i++) {
|
||||||
tan.x = inBuf.get(i * 4 + 0);
|
tan.x = inBuf.get(i * components + 0);
|
||||||
tan.y = inBuf.get(i * 4 + 1);
|
tan.y = inBuf.get(i * components + 1);
|
||||||
tan.z = inBuf.get(i * 4 + 2);
|
tan.z = inBuf.get(i * components + 2);
|
||||||
handedness = inBuf.get(i * 4 + 3);
|
|
||||||
|
|
||||||
transform.multNormal(tan, tan);
|
transform.multNormal(tan, tan);
|
||||||
|
|
||||||
outBuf.put(offset + i * 4 + 0, tan.x);
|
outBuf.put(offset + i * components + 0, tan.x);
|
||||||
outBuf.put(offset + i * 4 + 1, tan.y);
|
outBuf.put(offset + i * components + 1, tan.y);
|
||||||
outBuf.put(offset + i * 4 + 2, tan.z);
|
outBuf.put(offset + i * components + 2, tan.z);
|
||||||
outBuf.put(offset + i * 4 + 3, handedness);
|
|
||||||
|
if (components == 4){
|
||||||
|
outBuf.put(offset + i * components + 3, inBuf.get(i * components + 3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user