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:
parent
a14b6a3a50
commit
3800db318c
@ -331,7 +331,9 @@ public class LodGenerator {
|
|||||||
if (b instanceof IntBuffer) {
|
if (b instanceof IntBuffer) {
|
||||||
tri.vertexId[i] = ((IntBuffer) b).get();
|
tri.vertexId[i] = ((IntBuffer) b).get();
|
||||||
} else {
|
} 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());
|
// assert (tri.vertexId[i] < vertexLookup.size());
|
||||||
tri.vertex[i] = vertexLookup.get(tri.vertexId[i]);
|
tri.vertex[i] = vertexLookup.get(tri.vertexId[i]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user