jme3-terrain: handle 2 more ByteBuffer cases

master
Stephen Gold 5 years ago
parent 6c5611d3e2
commit a6f2c12700
  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 java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
@ -180,6 +181,8 @@ public class UpdatedTerrainPatch {
updatedPatch.getMesh().setBuffer(Type.Index, 3, (IntBuffer)newIndexBuffer);
else if (newIndexBuffer instanceof ShortBuffer)
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.util.BufferUtils;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
@ -78,6 +79,8 @@ public class EntropyComputeUtil {
terrainBlock.setBuffer(Type.Index, 3, (IntBuffer)lodIndices);
else if (lodIndices instanceof ShortBuffer) {
terrainBlock.setBuffer(Type.Index, 3, (ShortBuffer) lodIndices);
} else {
terrainBlock.setBuffer(Type.Index, 3, (ByteBuffer) lodIndices);
}
// Recalculate collision mesh

Loading…
Cancel
Save