Fix to loading models with high number of vertices (greater than Shor.MAX_VALUE).

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7923 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
Kae..pl 14 years ago
parent 04d3509c58
commit 93530bc2d0
  1. 8
      engine/src/blender/com/jme3/scene/plugins/blender/helpers/v249/MeshHelper.java

@ -304,13 +304,13 @@ public class MeshHelper extends AbstractBlenderHelper {
// creating vertices indices for this mesh
List<Integer> indexList = meshEntry.getValue();
short[] indices = new short[indexList.size()];//TODO: check if the model doesn't have more than 32767 vertices
for (int i = 0; i < indexList.size(); ++i) {//if yes then mesh.getVertices method must be changed to accept other than ShortBuffer
indices[i] = indexList.get(i).shortValue();
int[] indices = new int[indexList.size()];
for (int i = 0; i < indexList.size(); ++i) {
indices[i] = indexList.get(i).intValue();
}
// setting vertices
mesh.setBuffer(Type.Index, 1, BufferUtils.createShortBuffer(indices));
mesh.setBuffer(Type.Index, 1, indices);
mesh.setBuffer(verticesBuffer);
mesh.setBuffer(verticesBind);

Loading…
Cancel
Save