#include <raytracer.h>
Inherited by PathTracer, and WhittedTracer.
Inheritance diagram for Raytracer:
Public Member Functions | |
Raytracer (Scene *scene, Image *img) | |
Creates a raytracer. | |
virtual | ~Raytracer () |
Destroys the raytracer and all the objects it contains. | |
void | computeImage () |
Raytraces the scene by calling tracePixel() for each pixel in the output image. | |
Protected Member Functions | |
virtual Color | tracePixel (int x, int y) |
Compute the color of the pixel at (x,y) by raytracing. | |
Ray | getShadowRay (const Intersection &is, PointLight *light) const |
Helper function that sets up a shadow ray from an intersection point to a point light source. | |
Ray | getReflectedRay (const Intersection &is) const |
Helper function that computes the reflected view direction and sets up a ray with the correct parameters. | |
Ray | getRefractedRay (const Intersection &is) const |
Helper function that computes the refracted direction and sets up a ray with the correct parameters. | |
Protected Attributes | |
Scene * | mScene |
Ptr to the scene. | |
Image * | mImage |
Ptr to the output image. | |
Camera * | mCamera |
Ptr to the camera used for rendering. |
When the function computeImage() is called, the image is raytraced by calling tracePixel() for each pixel in the output image. A very basic implementation of tracePixel is provided, but to implement more advanced algorithms (Whitted, Pathtracing), the tracePixel() function should be overridden in a sub class.