Fix to loading meshes that contain many vertices.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9225 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
50f266f843
commit
2bc7128eb6
@ -31,6 +31,14 @@
|
|||||||
*/
|
*/
|
||||||
package com.jme3.scene.plugins.blender.meshes;
|
package com.jme3.scene.plugins.blender.meshes;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.jme3.asset.BlenderKey.FeaturesToLoad;
|
import com.jme3.asset.BlenderKey.FeaturesToLoad;
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.FastMath;
|
import com.jme3.math.FastMath;
|
||||||
@ -57,10 +65,6 @@ import com.jme3.scene.plugins.blender.textures.TextureHelper;
|
|||||||
import com.jme3.scene.plugins.blender.textures.UVCoordinatesGenerator;
|
import com.jme3.scene.plugins.blender.textures.UVCoordinatesGenerator;
|
||||||
import com.jme3.texture.Texture;
|
import com.jme3.texture.Texture;
|
||||||
import com.jme3.util.BufferUtils;
|
import com.jme3.util.BufferUtils;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.FloatBuffer;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that is used in mesh calculations.
|
* A class that is used in mesh calculations.
|
||||||
@ -300,12 +304,13 @@ public class MeshHelper extends AbstractBlenderHelper {
|
|||||||
// generating meshes
|
// generating meshes
|
||||||
//FloatBuffer verticesColorsBuffer = this.createFloatBuffer(verticesColors);
|
//FloatBuffer verticesColorsBuffer = this.createFloatBuffer(verticesColors);
|
||||||
ByteBuffer verticesColorsBuffer = createByteBuffer(verticesColors);
|
ByteBuffer verticesColorsBuffer = createByteBuffer(verticesColors);
|
||||||
|
verticesAmount = vertexList.size();
|
||||||
for (Entry<Integer, List<Integer>> meshEntry : meshesMap.entrySet()) {
|
for (Entry<Integer, List<Integer>> meshEntry : meshesMap.entrySet()) {
|
||||||
Mesh mesh = new Mesh();
|
Mesh mesh = new Mesh();
|
||||||
|
|
||||||
// creating vertices indices for this mesh
|
// creating vertices indices for this mesh
|
||||||
List<Integer> indexList = meshEntry.getValue();
|
List<Integer> indexList = meshEntry.getValue();
|
||||||
if(verticesAmount < Short.MAX_VALUE * 2) {
|
if(verticesAmount <= Short.MAX_VALUE) {
|
||||||
short[] indices = new short[indexList.size()];
|
short[] indices = new short[indexList.size()];
|
||||||
for (int i = 0; i < indexList.size(); ++i) {
|
for (int i = 0; i < indexList.size(); ++i) {
|
||||||
indices[i] = indexList.get(i).shortValue();
|
indices[i] = indexList.get(i).shortValue();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user