Scene Class Reference

#include <scene.h>

Collaboration diagram for Scene:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void add_bumpmap (std::string name, BumpMap *bumpmap)
 Add a bump map to the scene.
void add_material (std::string name, Material *material)
 Add a material to the available materials.
void add_primitive (Renderable *prim)
 Add a primitive to the scene.
Renderablefind_collision (const Ray &ray, double &dist) const
BumpMapget_bumpmap (std::string name)
Point3D get_camera () const
Magick::Color get_color (std::string name)
std::string get_geometry ()
Materialget_material (std::string name)
int get_max_recurse_depth () const
 Get the max recursion depth for this image.
std::string get_output_filename () const
std::vector< Renderable * > * get_scene ()
 Return the scene's collection of Renderables.
int get_subpixel_sqrt () const
 Get the square root of the number of sibpixels in the image.
int get_viewport_pixel_height () const
 Get the viewport height in pixels.
int get_viewport_pixel_width () const
 Get the viewport width in pixels.
void set_camera (double x, double y, double z)
void set_max_recurse_depth (int recurse_depth)
 ~et the max recursion depth for this image.
void set_output_filename (std::string fname)
void set_pixel_height (int pxheight)
void set_pixel_width (int pxwidth)
void set_subpixel_sqrt (int subpx_sqrt)
 ~Scene ()
 Destructor.

Static Public Member Functions

static Sceneget_instance (std::string scene_file_name="")

Protected Member Functions

 Scene ()
 Loads a scene from the XML file named by scene_file_name.

Protected Attributes

Point3D camera
 This is the point which describes the camera or eye which is looking into the scene.
std::map< std::string, BumpMap * > m_bumpmaps
 This is a map of bump maps available for the scene.
std::map< std::string, Material * > m_materials
 This is a map of all materials available for the scene.
int max_depth
 This is the maximum levels of recursion allowed for this scene.
std::string output_filename
 This is the name of the rendered image file.
int pixel_height
 This is the height, in pixels, of the rendered image.
int pixel_width
 This is the width, in pixels, of the rendered image.
std::vector< Renderable * > scene
 This is the scene, which is a collection of Renderables.
int subpixels
 This number is squared and determines the number of subpixels to render.

Static Protected Attributes

static Sceneinst = NULL
 This is the instance of the Scene class.

Detailed Description

Scene represents everything to be rendered. This includes light sources, the camera, the objects to render, as well as a dictionary of colors and materials.

Definition at line 24 of file scene.h.


Constructor & Destructor Documentation

Scene::Scene (  )  [protected]

Loads a scene from the XML file named by scene_file_name.

Definition at line 30 of file scene.cpp.

Scene::~Scene (  ) 

Destructor.

Definition at line 42 of file scene.cpp.

References scene.


Member Function Documentation

void Scene::add_bumpmap ( std::string  name,
BumpMap bumpmap 
) [inline]

Add a bump map to the scene.

Definition at line 127 of file scene.h.

References m_bumpmaps.

Referenced by SceneParser::parse_bumpmaps().

Here is the caller graph for this function:

void Scene::add_material ( std::string  name,
Material material 
) [inline]

Add a material to the available materials.

Definition at line 121 of file scene.h.

References m_materials.

Referenced by SceneParser::parse_materials().

Here is the caller graph for this function:

void Scene::add_primitive ( Renderable prim  )  [inline]

Add a primitive to the scene.

Definition at line 124 of file scene.h.

References scene.

Referenced by SceneParser::parse_light_sources(), and SceneParser::parse_objects().

Here is the caller graph for this function:

Renderable * Scene::find_collision ( const Ray ray,
double &  dist 
) const

Determine which Renderable in the scene is intersected by the ray, if any.

Parameters:
ray The ray that is being traced into the scene.
dist [out] This is the distance along ray that the intersection occurs.
Returns:
The primitive intersected at distance indicated by dist. If no Renderable is intersected, this method returns NULL.

Definition at line 48 of file scene.cpp.

References scene.

Referenced by Renderable::is_in_shadow(), and trace_ray().

Here is the caller graph for this function:

BumpMap* Scene::get_bumpmap ( std::string  name  )  [inline]

Return the bumpmap named by the parameter. The bumpmap is defined in the scene definition file.

Definition at line 131 of file scene.h.

References m_bumpmaps.

Referenced by Renderable::initialize(), and Polygon::Polygon().

Here is the caller graph for this function:

Point3D Scene::get_camera (  )  const [inline]

Return the point from which all rays originate.

Returns:
The point which all rays originate.

Definition at line 86 of file scene.h.

References camera.

Referenced by main().

Here is the caller graph for this function:

Magick::Color Scene::get_color ( std::string  name  )  [inline]

Return the color named by the parameter. The color's name is defined in the scene definition file.

Definition at line 114 of file scene.h.

Referenced by MarbleMaterial::get_color().

Here is the caller graph for this function:

std::string Scene::get_geometry (  ) 

Return the size of the image as an X11 geometry string. This is needed by ImageMagick.

Definition at line 65 of file scene.cpp.

References pixel_height, and pixel_width.

Referenced by main().

Here is the caller graph for this function:

static Scene* Scene::get_instance ( std::string  scene_file_name = ""  )  [static]

Returns or creates the single instance of the scene definition.

Parameters:
scene_file_name The name of the file which contains the XML definition of the scene. This is ignored on all but the first use of get_intance().

Referenced by CheckeredMaterial::createCheckeredMaterial(), NoiseMaterial::createNoiseMaterial(), NoiseMaterial::get_color(), MarbleMaterial::get_color(), Renderable::get_color_contribution(), Renderable::initialize(), Renderable::is_in_shadow(), main(), make_marble_material(), make_noise_material(), new_checker_material(), SceneParser::parse(), Plane::Plane(), Polygon::Polygon(), trace_ray(), and trace_rays().

Here is the caller graph for this function:

Material* Scene::get_material ( std::string  name  )  [inline]

Return the material named by the parameter. The material is defined in the scene definition file.

Definition at line 118 of file scene.h.

References m_materials.

Referenced by CheckeredMaterial::createCheckeredMaterial(), NoiseMaterial::createNoiseMaterial(), Renderable::initialize(), make_marble_material(), make_noise_material(), new_checker_material(), and Polygon::Polygon().

Here is the caller graph for this function:

int Scene::get_max_recurse_depth (  )  const [inline]

Get the max recursion depth for this image.

Definition at line 108 of file scene.h.

References max_depth.

Referenced by trace_ray().

Here is the caller graph for this function:

std::string Scene::get_output_filename (  )  const [inline]

Return the filename for the rendered image.

Returns:
The rendered image filename.

Definition at line 92 of file scene.h.

References output_filename.

Referenced by main().

Here is the caller graph for this function:

std::vector<Renderable *>* Scene::get_scene (  )  [inline]

Return the scene's collection of Renderables.

Definition at line 72 of file scene.h.

References scene.

Referenced by Renderable::get_color_contribution().

Here is the caller graph for this function:

int Scene::get_subpixel_sqrt (  )  const [inline]

Get the square root of the number of sibpixels in the image.

Definition at line 104 of file scene.h.

References subpixels.

Referenced by trace_rays().

Here is the caller graph for this function:

int Scene::get_viewport_pixel_height (  )  const [inline]

Get the viewport height in pixels.

Definition at line 100 of file scene.h.

References pixel_height.

Referenced by main(), trace_ray(), and trace_rays().

Here is the caller graph for this function:

int Scene::get_viewport_pixel_width (  )  const [inline]

Get the viewport width in pixels.

Definition at line 96 of file scene.h.

References pixel_width.

Referenced by main(), trace_ray(), and trace_rays().

Here is the caller graph for this function:

void Scene::set_camera ( double  x,
double  y,
double  z 
) [inline]

Definition at line 87 of file scene.h.

References camera.

Referenced by SceneParser::parse_camera().

Here is the caller graph for this function:

void Scene::set_max_recurse_depth ( int  recurse_depth  )  [inline]

~et the max recursion depth for this image.

Definition at line 110 of file scene.h.

References MAX_DEPTH, and max_depth.

Referenced by SceneParser::parse_meta().

Here is the caller graph for this function:

void Scene::set_output_filename ( std::string  fname  )  [inline]

Definition at line 93 of file scene.h.

References output_filename.

Referenced by SceneParser::parse_meta().

Here is the caller graph for this function:

void Scene::set_pixel_height ( int  pxheight  )  [inline]

Definition at line 101 of file scene.h.

References pixel_height.

Referenced by SceneParser::parse_meta().

Here is the caller graph for this function:

void Scene::set_pixel_width ( int  pxwidth  )  [inline]

Definition at line 97 of file scene.h.

References pixel_width.

Referenced by SceneParser::parse_meta().

Here is the caller graph for this function:

void Scene::set_subpixel_sqrt ( int  subpx_sqrt  )  [inline]

Definition at line 105 of file scene.h.

References subpixels.

Referenced by SceneParser::parse_meta().

Here is the caller graph for this function:


Member Data Documentation

Point3D Scene::camera [protected]

This is the point which describes the camera or eye which is looking into the scene.

Definition at line 39 of file scene.h.

Referenced by get_camera(), and set_camera().

Scene * Scene::inst = NULL [static, protected]

This is the instance of the Scene class.

Definition at line 27 of file scene.h.

std::map<std::string, BumpMap *> Scene::m_bumpmaps [protected]

This is a map of bump maps available for the scene.

Definition at line 36 of file scene.h.

Referenced by add_bumpmap(), and get_bumpmap().

std::map<std::string, Material *> Scene::m_materials [protected]

This is a map of all materials available for the scene.

Definition at line 33 of file scene.h.

Referenced by add_material(), and get_material().

int Scene::max_depth [protected]

This is the maximum levels of recursion allowed for this scene.

Definition at line 54 of file scene.h.

Referenced by get_max_recurse_depth(), and set_max_recurse_depth().

std::string Scene::output_filename [protected]

This is the name of the rendered image file.

Definition at line 48 of file scene.h.

Referenced by get_output_filename(), and set_output_filename().

int Scene::pixel_height [protected]

This is the height, in pixels, of the rendered image.

Definition at line 45 of file scene.h.

Referenced by get_geometry(), get_viewport_pixel_height(), and set_pixel_height().

int Scene::pixel_width [protected]

This is the width, in pixels, of the rendered image.

Definition at line 42 of file scene.h.

Referenced by get_geometry(), get_viewport_pixel_width(), and set_pixel_width().

std::vector<Renderable *> Scene::scene [protected]

This is the scene, which is a collection of Renderables.

Definition at line 30 of file scene.h.

Referenced by add_primitive(), find_collision(), get_scene(), and ~Scene().

int Scene::subpixels [protected]

This number is squared and determines the number of subpixels to render.

Definition at line 51 of file scene.h.

Referenced by get_subpixel_sqrt(), and set_subpixel_sqrt().


The documentation for this class was generated from the following files:
Generated on Tue Oct 30 22:12:24 2007 for mbrt by  doxygen 1.5.2