jme3-terrain: handle 2 more ByteBuffer cases

This commit is contained in:
Stephen Gold 2020-04-15 13:32:19 -07:00
parent c85e2bcfd4
commit 3a5f9661ab
2 changed files with 6 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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