C++ / OpenCL Raytracer
|
#include <ray_tracer.h>
Public Member Functions | |
RayTracer () | |
RayTracer (const SDim &dims, const int iRaysPerPixel=100) | |
RayTracer (const SDim &dims, const int iRaysPerPixel, Camera &cam) | |
virtual void | SetCamera (Vector3D lookFrom, Vector3D lookAt=Vector3D(0), Vector3D viewUp=Vector3D(0, 1, 0), double aperture=.1, double Fov=40) |
virtual void | AddItem (Object *object) |
virtual void | RandomScene () |
virtual void | ShowPerformance () |
virtual void | OpenImage () |
virtual Vector3D | Color (const Ray &r, int iDepth) |
virtual void | Render (const std::string &strFileName) |
virtual int | clRender (const std::string &strFileName) |
virtual void | ClearItems () |
Public Attributes | |
vList | m_list |
Vector list of objects to be rendered. | |
const SDim | m_dims |
Struct containing the dimensions of the desired output image {x, y} (in pixels) | |
int | m_iRaysPerPixel |
Number of anti-aliasing samples to take per pixel. | |
Camera | m_camera |
Camera object specifying the desired perspective of the output image. | |
Ray Tracing wrapper; intialization and calculation functions.
RayTracer::RayTracer | ( | ) |
Initiate a ray tracer instance
Example:
RayTracer();
|
inline |
Initiate a ray tracer instance
Example:
RayTracer(dimensions, 100);
Initiate a ray tracer instance
Example:
RayTracer(dimensions, 100, cam);
|
virtual |
Link renderable objects to ray tracer instance
Example:
ray_tracer->AddItem(&Sphere(Vector3D(0), 1, new Lambertian(Vector3D(1)));
|
virtual |
Remove all objects from ray tracer instance vector list
Example:
ray_tracer->ClearItems();
or
delete ray_tracer;
|
virtual |
Calculations and image output function for ray tracer instance.
Example:
ray_tracer->Render("image");
|
virtual |
Open image in default image viewer after rendering (Windows Only)
Example:
ray_tracer->OpenImage();
|
virtual |
Add a random set of objects to create a demo scene similar to the cover of Ray Tracing in One Weekend
Example:
ray_tracer->RandomScene();
|
virtual |
Calculations and image output function for ray tracer instance.
Example:
ray_tracer->Render("image");
|
virtual |
Specify the desired perspective of the output image for the instance. Only necessary if camera object not passed through inline initialization.
Example:
ray_tracer->SetCamera(Vector3D(10, 0, 0));
|
virtual |
Print performance data to console after image finishes rendering.
Example:
ray_tracer->ShowPerformance();