Inferno
public java v1 · immutablewhile(maxReflectionsLeft > 0 ){ Vec3 newOrigin = nearestHit.location; Vec3 newDirection = this.direction.minus(nearestHit.normal.times(this.direction.dot(nearestHit.normal)).times(2.0f)); Ray newRay = new Ray(newOrigin, newDirection); color = color.add(newRay.trace(nearestHit.object, maxReflectionsLeft).times(nearestHit.object.material.reflectance)); maxReflectionsLeft -= 1;}