Mesh bufferList is now a SafeArrayList instead of an ArrayList

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8869 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent 538b6edd35
commit cbd1248302
  1. 16
      engine/src/android/com/jme3/renderer/android/OGLESShaderRenderer.java
  2. 9
      engine/src/core/com/jme3/scene/Mesh.java
  3. 7
      engine/src/lwjgl/com/jme3/renderer/lwjgl/LwjglRenderer.java

@ -59,6 +59,7 @@ import com.jme3.texture.Texture.WrapAxis;
import com.jme3.util.BufferUtils;
import com.jme3.util.ListMap;
import com.jme3.util.NativeObjectManager;
import com.jme3.util.SafeArrayList;
import java.nio.*;
import java.util.ArrayList;
import java.util.EnumSet;
@ -2610,9 +2611,8 @@ public class OGLESShaderRenderer implements Renderer {
updateBufferData(interleavedData);
}
ArrayList<VertexBuffer> buffersList = mesh.getBufferList();
for (int i = 0; i < buffersList.size(); i++){
VertexBuffer vb = buffersList.get(i);
for (VertexBuffer vb : mesh.getBufferList().getArray()){
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
@ -2642,9 +2642,7 @@ public class OGLESShaderRenderer implements Renderer {
}
// IntMap<VertexBuffer> buffers = mesh.getBuffers();
ArrayList<VertexBuffer> buffersList = mesh.getBufferList();
for (int i = 0; i < buffersList.size(); i++){
VertexBuffer vb = buffersList.get(i);
for (VertexBuffer vb : mesh.getBufferList().getArray()){
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers
@ -2694,15 +2692,13 @@ public class OGLESShaderRenderer implements Renderer {
updateBufferData(interleavedData);
}
//IntMap<VertexBuffer> buffers = mesh.getBuffers();
ArrayList<VertexBuffer> buffersList = mesh.getBufferList();
//IntMap<VertexBuffer> buffers = mesh.getBuffers(); ;
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
} else {
indices = mesh.getBuffer(Type.Index);// buffers.get(Type.Index.ordinal());
}
for (int i = 0; i < buffersList.size(); i++){
VertexBuffer vb = buffersList.get(i);
for (VertexBuffer vb : mesh.getBufferList().getArray()){
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers

@ -50,6 +50,7 @@ import com.jme3.scene.mesh.*;
import com.jme3.util.BufferUtils;
import com.jme3.util.IntMap;
import com.jme3.util.IntMap.Entry;
import com.jme3.util.SafeArrayList;
import java.io.IOException;
import java.nio.*;
import java.util.ArrayList;
@ -164,7 +165,7 @@ public class Mesh implements Savable, Cloneable {
private CollisionData collisionTree = null;
private ArrayList<VertexBuffer> buffersList = new ArrayList<VertexBuffer>(5);
private SafeArrayList<VertexBuffer> buffersList = new SafeArrayList<VertexBuffer>(VertexBuffer.class);
private IntMap<VertexBuffer> buffers = new IntMap<VertexBuffer>();
private VertexBuffer[] lodLevels;
private float pointSize = 1;
@ -201,7 +202,7 @@ public class Mesh implements Savable, Cloneable {
clone.meshBound = meshBound.clone();
clone.collisionTree = collisionTree != null ? collisionTree : null;
clone.buffers = buffers.clone();
clone.buffersList = new ArrayList<VertexBuffer>(buffersList);
clone.buffersList = new SafeArrayList<VertexBuffer>(VertexBuffer.class,buffersList);
clone.vertexArrayID = -1;
if (elementLengths != null) {
clone.elementLengths = elementLengths.clone();
@ -232,7 +233,7 @@ public class Mesh implements Savable, Cloneable {
clone.collisionTree = null; // it will get re-generated in any case
clone.buffers = new IntMap<VertexBuffer>();
clone.buffersList = new ArrayList<VertexBuffer>();
clone.buffersList = new SafeArrayList<VertexBuffer>(VertexBuffer.class);
for (Entry<VertexBuffer> ent : buffers){
VertexBuffer bufClone = ent.getValue().clone();
clone.buffers.put(ent.getKey(), bufClone);
@ -1129,7 +1130,7 @@ public class Mesh implements Savable, Cloneable {
return buffers;
}
public ArrayList<VertexBuffer> getBufferList(){
public SafeArrayList<VertexBuffer> getBufferList(){
return buffersList;
}

@ -58,8 +58,8 @@ import com.jme3.util.IntMap;
import com.jme3.util.IntMap.Entry;
import com.jme3.util.ListMap;
import com.jme3.util.NativeObjectManager;
import com.jme3.util.SafeArrayList;
import java.nio.*;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.logging.Level;
@ -2410,7 +2410,7 @@ public class LwjglRenderer implements Renderer {
}
//IntMap<VertexBuffer> buffers = mesh.getBuffers();
ArrayList<VertexBuffer> buffersList = mesh.getBufferList();
SafeArrayList<VertexBuffer> buffersList = mesh.getBufferList();
if (mesh.getNumLodLevels() > 0) {
indices = mesh.getLodLevel(lod);
@ -2419,8 +2419,7 @@ public class LwjglRenderer implements Renderer {
}
//for (Entry<VertexBuffer> entry : buffers) {
// VertexBuffer vb = entry.getValue();
for (int i = 0; i < buffersList.size(); i++){
VertexBuffer vb = buffersList.get(i);
for (VertexBuffer vb : mesh.getBufferList().getArray()){
if (vb.getBufferType() == Type.InterleavedData
|| vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers

Loading…
Cancel
Save