From e6dc1b71830cb758e3164543dc14b62a3ac5f70d Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Thu, 19 Jan 2012 06:08:50 +0000 Subject: [PATCH] Modified GeometryBatchFactory to be thread safe from other readers of the meshes upon which it is operating. At least in theory. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9099 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/tools/jme3tools/optimize/GeometryBatchFactory.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java index 2e703065e..65adbe23d 100644 --- a/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java +++ b/engine/src/tools/jme3tools/optimize/GeometryBatchFactory.java @@ -178,11 +178,11 @@ public class GeometryBatchFactory { } } } else if (Type.Position.ordinal() == bufType) { - FloatBuffer inPos = (FloatBuffer) inBuf.getData(); + FloatBuffer inPos = (FloatBuffer) inBuf.getDataReadOnly(); FloatBuffer outPos = (FloatBuffer) outBuf.getData(); doTransformVerts(inPos, globalVertIndex, outPos, worldMatrix); } else if (Type.Normal.ordinal() == bufType || Type.Tangent.ordinal() == bufType) { - FloatBuffer inPos = (FloatBuffer) inBuf.getData(); + FloatBuffer inPos = (FloatBuffer) inBuf.getDataReadOnly(); FloatBuffer outPos = (FloatBuffer) outBuf.getData(); doTransformNorms(inPos, globalVertIndex, outPos, worldMatrix); } else { @@ -229,8 +229,7 @@ public class GeometryBatchFactory { numOfVertices = g.getVertexCount(); } for (int i = 0; i < lodLevels; i++) { - ShortBuffer buffer = (ShortBuffer) g.getMesh().getLodLevel(i).getData(); - buffer.rewind(); + ShortBuffer buffer = (ShortBuffer) g.getMesh().getLodLevel(i).getDataReadOnly(); //System.out.println("buffer: " + buffer.capacity() + " limit: " + lodSize[i] + " " + index); for (int j = 0; j < buffer.capacity(); j++) { lodData[i][bufferPos[i] + j] = buffer.get() + numOfVertices * curGeom;