From 02bcb358a398a3f21708361175d7f30592b57f70 Mon Sep 17 00:00:00 2001 From: "rem..om" Date: Sun, 30 Oct 2011 22:10:34 +0000 Subject: [PATCH] - Fixed max components calculation for temp float array - Uncommented Normals transforms (doh!) git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8553 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/scene/BatchNode.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/engine/src/core/com/jme3/scene/BatchNode.java b/engine/src/core/com/jme3/scene/BatchNode.java index a0ae9a66f..2581ff513 100644 --- a/engine/src/core/com/jme3/scene/BatchNode.java +++ b/engine/src/core/com/jme3/scene/BatchNode.java @@ -146,9 +146,9 @@ public class BatchNode extends Node implements Savable { doTransformVerts(buf, bg.startIndex, bg.startIndex + bg.getVertexCount(), buf, bg.cachedOffsetMat); mesh.getBuffer(VertexBuffer.Type.Position).updateData(buf); -// buf = (FloatBuffer) mesh.getBuffer(VertexBuffer.Type.Normal).getData(); -// doTransformNorm(buf, 0, bg.startIndex, bg.startIndex + bg.getVertexCount(), buf, bg.cachedOffsetMat); -// mesh.getBuffer(VertexBuffer.Type.Normal).updateData(buf); + buf = (FloatBuffer) mesh.getBuffer(VertexBuffer.Type.Normal).getData(); + doTransformNorm(buf, bg.startIndex, bg.startIndex + bg.getVertexCount(), buf, bg.cachedOffsetMat); + mesh.getBuffer(VertexBuffer.Type.Normal).updateData(buf); if (mesh.getBuffer(VertexBuffer.Type.Tangent) != null) { @@ -403,6 +403,8 @@ public class BatchNode extends Node implements Savable { formatForBuf[VertexBuffer.Type.Index.ordinal()] = VertexBuffer.Format.UnsignedShort; } + int maxElemCount = 0; + int elements = 0; // generate output buffers based on retrieved info for (int i = 0; i < compsForBuf.length; i++) { if (compsForBuf[i] == 0) { @@ -412,10 +414,15 @@ public class BatchNode extends Node implements Savable { Buffer data; if (i == VertexBuffer.Type.Index.ordinal()) { data = VertexBuffer.createBuffer(formatForBuf[i], compsForBuf[i], totalTris); + elements = compsForBuf[i]* totalTris; } else { data = VertexBuffer.createBuffer(formatForBuf[i], compsForBuf[i], totalVerts); + elements = compsForBuf[i]* totalVerts; } + if(maxElemCount