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
This commit is contained in:
rem..om 2013-09-15 18:47:51 +00:00
parent a14b6a3a50
commit 3800db318c

View File

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