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
3.0
PSp..om 13 years ago
parent 606b676d69
commit e6dc1b7183
  1. 7
      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;

Loading…
Cancel
Save