LodGenerator now properly shift short indexes so that there is no negative value when assigned to an int and used as an index in an array

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10783 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
experimental
rem..om 11 years ago
parent a14b6a3a50
commit 3800db318c
  1. 4
      engine/src/tools/jme3tools/optimize/LodGenerator.java

@ -331,7 +331,9 @@ public class LodGenerator {
if (b instanceof IntBuffer) {
tri.vertexId[i] = ((IntBuffer) b).get();
} else {
tri.vertexId[i] = ((ShortBuffer) b).get();
//bit shift to avoid negative values due to conversion form short to int.
//we need an unsigned int here.
tri.vertexId[i] = ((ShortBuffer) b).get()& 0xffff;
}
// assert (tri.vertexId[i] < vertexLookup.size());
tri.vertex[i] = vertexLookup.get(tri.vertexId[i]);

Loading…
Cancel
Save