boolean shadowTrace(Ray ray) { for (int i = 0; i < numObjects; i++) // Spheres only for now if (spheres[i].shadowHit(ray, 0.00001, 10000000, 0)) if (scene.spheresOnly) { for (PMesh.SurfCell s = shapes[i].surfHead; s != null; s = s.next) for (PMesh.PolyCell poly = s.polyHead; poly != null; poly = poly.next) if (poly.numVerts == 3) { Double3D v[] = new Double3D[3]; int j = 0; for (PMesh.VertListCell vert = poly.vert; vert != null; vert = vert.next) v[j++] = shapes[i].vertArray.get(vert.vert).viewPos; // Increment j in the line post access if (Triangle.shadowHit(v[0], v[1], v[2], ray, 0.00001, 10000000, 0)) return false; } else System.out.println( "Need to intersect polygon with " + poly.numVerts + " vertices."); } else return false; return true; }