Add script to script call support. Add exception to catch out of bound index data when added to TriangleMeshBuilder.

This commit is contained in:
Jason Sams
2009-10-07 18:14:01 -07:00
parent dc2ccb82f9
commit bd2197fb00
3 changed files with 16 additions and 1 deletions

View File

@@ -290,6 +290,11 @@ public class SimpleMesh extends BaseObj {
}
public void addTriangle(int idx1, int idx2, int idx3) {
if((idx1 >= mVtxCount) || (idx1 < 0) ||
(idx2 >= mVtxCount) || (idx2 < 0) ||
(idx3 >= mVtxCount) || (idx3 < 0)) {
throw new IllegalStateException("Index provided greater than vertex count.");
}
if ((mIndexCount + 3) >= mIndexData.length) {
short t[] = new short[mIndexData.length * 2];
System.arraycopy(mIndexData, 0, t, 0, mIndexData.length);