tracer
Class Ray
java.lang.Object
tracer.Ray
- public class Ray
- extends java.lang.Object
Represents a ray: a ray can `trace' itself, calculating a color.
Method Summary |
boolean |
hit(Traceable ignoreObject)
Checks if the ray (origin + t*direction) hits the scene with 0 <= t <= 1. |
Vec3 |
localLight(IntersectionInfo info,
Light light)
Calculates the local light term, given an IntersectionInfo and a Light. |
Vec3 |
trace(Traceable currentObject,
int maxReflectionsLeft)
Does the actual `raytracing'. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
origin
public Vec3 origin
direction
public Vec3 direction
Ray
public Ray(Vec3 o,
Vec3 d)
localLight
public Vec3 localLight(IntersectionInfo info,
Light light)
- Calculates the local light term, given an IntersectionInfo and a Light.
This method does not do an occlusion test; do this yourself (e.g.
using a shadow feeler).
trace
public Vec3 trace(Traceable currentObject,
int maxReflectionsLeft)
- Does the actual `raytracing'. Returns the color this ray `hits.'
- Parameters:
currentObject
- This object is ignored in the intersection tests; in
effect, this object is `invisible' to the ray. This is useful for
reflection rays and shadow feelers: it avoids precision-errors by just
ignoring the object you've just bounced off of. If all objects are
convex (which they are in this tracer) this is actually not a hack but
completely correct.maxReflectionsLeft
- Maximum recursion depth for reflection
calculations .
hit
public boolean hit(Traceable ignoreObject)
- Checks if the ray (origin + t*direction) hits the scene with 0 <= t <= 1.
- Parameters:
ignoreObject
- Similar to trace's currentObject parameter.- See Also:
trace.