#include <scene.h>
Public Member Functions | |
Scene () | |
Initializes an empty scene. | |
~Scene () | |
Destroys the scene and all its nodes. | |
void | add (Node *node, Node *parent=0) |
Adds a node to the scene hierarchy. | |
void | prepare () |
Prepare scene for raytracing. | |
void | setBackground (const Color &c) |
Sets the background color to c. | |
void | setBackground (LightProbe *lp) |
Sets the current light probe to use for the background to lp. | |
Color | getBackground (const Vector &d) const |
Returns the background color in direction d. | |
bool | intersect (const Ray &ray) |
Returns true if the given ray intersects the scene. | |
bool | intersect (const Ray &ray, Intersection &is) |
Returns true if the given ray intersects the scene. | |
int | getNumberOfCameras () const |
Returns the number of cameras in the scene. | |
Camera * | getCamera (int i) const |
Returns a pointer to camera number i (starting at 0). | |
int | getNumberOfLights () const |
Returns the number of lights (PointLight) in the scene. | |
PointLight * | getLight (int i) const |
Returns a pointer to light number i (starting at 0). |
Scene objects (primitives, light sources, cameras) are added to the scene with the add() function, and internally stored in a scene graph. Before any operations can be performed on the scene, the prepare() function should be called. This function prepares the scene hierarchy for rendering by computing all transform matrices, setting up an acceleration data structure, and caching necessary data. A ray can be intersected tested against the scene by calling the intersect() functions.