public void store(ShadingState state, Vector3 dir, Color power, Color diffuse) { if (((state.getDiffuseDepth() == 0) && (state.getReflectionDepth() > 0 || state.getRefractionDepth() > 0))) { // this is a caustic photon Photon p = new Photon(state.getPoint(), dir, power); lock (lockObj) { storedPhotons++; photonList.Add(p); bounds.include(new Point3(p.x, p.y, p.z)); maxPower = Math.Max(maxPower, power.getMax()); } } }
public void traceReflectionPhoton(ShadingState previous, Ray r, Color power) { if (previous.getReflectionDepth() >= maxReflectionDepth) return; IntersectionState istate = previous.getIntersectionState(); scene.trace(r, istate); if (previous.getIntersectionState().hit()) { // create a new shading context ShadingState state = ShadingState.createReflectionBounceState(previous, r, 0); shadePhoton(state, power); } }
public Color traceReflection(ShadingState previous, Ray r, int i) { // limit path depth and disable caustic paths if (previous.getReflectionDepth() >= maxReflectionDepth || previous.getDiffuseDepth() > 0) return Color.BLACK; IntersectionState istate = previous.getIntersectionState(); istate.numReflectionRays++; scene.trace(r, istate); return istate.hit() ? shadeHit(ShadingState.createReflectionBounceState(previous, r, i)) : Color.BLACK; }