jme3-terrain: handle 2 more ByteBuffer cases

v3.3
Stephen Gold 5 years ago
parent c85e2bcfd4
commit 3a5f9661ab
  1. 3
      jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/UpdatedTerrainPatch.java
  2. 3
      jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/lodcalc/util/EntropyComputeUtil.java

@ -33,6 +33,7 @@ package com.jme3.terrain.geomipmap;
import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.VertexBuffer.Type;
import java.nio.Buffer; import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.nio.ShortBuffer; import java.nio.ShortBuffer;
@ -180,6 +181,8 @@ public class UpdatedTerrainPatch {
updatedPatch.getMesh().setBuffer(Type.Index, 3, (IntBuffer)newIndexBuffer); updatedPatch.getMesh().setBuffer(Type.Index, 3, (IntBuffer)newIndexBuffer);
else if (newIndexBuffer instanceof ShortBuffer) else if (newIndexBuffer instanceof ShortBuffer)
updatedPatch.getMesh().setBuffer(Type.Index, 3, (ShortBuffer)newIndexBuffer); updatedPatch.getMesh().setBuffer(Type.Index, 3, (ShortBuffer)newIndexBuffer);
else
updatedPatch.getMesh().setBuffer(Type.Index, 3, (ByteBuffer)newIndexBuffer);
} }
} }

@ -41,6 +41,7 @@ import com.jme3.scene.VertexBuffer;
import com.jme3.scene.VertexBuffer.Type; import com.jme3.scene.VertexBuffer.Type;
import com.jme3.util.BufferUtils; import com.jme3.util.BufferUtils;
import java.nio.Buffer; import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.nio.IntBuffer; import java.nio.IntBuffer;
import java.nio.ShortBuffer; import java.nio.ShortBuffer;
@ -78,6 +79,8 @@ public class EntropyComputeUtil {
terrainBlock.setBuffer(Type.Index, 3, (IntBuffer)lodIndices); terrainBlock.setBuffer(Type.Index, 3, (IntBuffer)lodIndices);
else if (lodIndices instanceof ShortBuffer) { else if (lodIndices instanceof ShortBuffer) {
terrainBlock.setBuffer(Type.Index, 3, (ShortBuffer) lodIndices); terrainBlock.setBuffer(Type.Index, 3, (ShortBuffer) lodIndices);
} else {
terrainBlock.setBuffer(Type.Index, 3, (ByteBuffer) lodIndices);
} }
// Recalculate collision mesh // Recalculate collision mesh

Loading…
Cancel
Save