Renderable Class Reference

Defines an abstract interface that all primitives must implement. More...

#include <renderable.h>

Inheritance diagram for Renderable:

Inheritance graph
[legend]
Collaboration diagram for Renderable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual bool collides_with (const Ray &ray, double &t) const=0
virtual const Point3D get_center () const
virtual Magick::Color get_color (const Point3D &intersection_point) const
 Returns the color of the Renderable.
virtual Magick::Color get_color_contribution (const Point3D &intersection_point, const Ray &ray, Vector &reflect, Vector &refract)
virtual double get_diffuse (const Point3D &intersection_point) const
 Returns the diffusion factor of the primitive.
virtual Ray get_normal (const Point3D &p) const=0
virtual double get_opacity (const Point3D &intersection_point) const
 Returns the opacity level of this object.
virtual double get_reflection (const Point3D &intersection_point) const
 Returns the reflection coefficient. This is a number between 0 and 1.
virtual double get_reflectivity (const Point3D &intersection_point) const
 Returns the shinyness factor of the object. The higher the number the shinier.
virtual double get_refraction_index (const Point3D &intersection_point) const
 Returns the refraction index of this object.
virtual double get_specular (const Point3D &intersection_point) const
 Returns the specular coefficient. This is a number between 0 and 1.
bool initialize (xmlNode *node)
bool is_in_shadow (const Ray &ray_to_light, const Point3D intersection_point)
virtual bool is_light (const Point3D &intersection_point) const
 Returns if the primitive emits light.
virtual bool set_is_light (bool)
virtual ~Renderable ()

Protected Attributes

BumpMapm_bumpmap
Point3D m_center
bool m_center_material
Materialm_material

Private Member Functions

Ray get_final_normal (const Point3D &p)

Detailed Description

Defines an abstract interface that all primitives must implement.

Definition at line 11 of file renderable.h.


Constructor & Destructor Documentation

virtual Renderable::~Renderable (  )  [inline, virtual]

Definition at line 13 of file renderable.h.


Member Function Documentation

virtual bool Renderable::collides_with ( const Ray ray,
double &  t 
) const [pure virtual]

Does the ray passed in collide with this object?

Parameters:
ray The ray which is being traced.
t This is z-depth at which the ray collides with this object.
Returns:
True if the ray collides with this object.

Implemented in Plane, Polygon, and Sphere.

virtual const Point3D Renderable::get_center (  )  const [inline, virtual]

Return the center of the primitive.

Returns:
Center of the primitive

Definition at line 89 of file renderable.h.

References m_center.

Magick::Color Renderable::get_color ( const Point3D intersection_point  )  const [virtual]

Returns the color of the Renderable.

Definition at line 80 of file renderable.cpp.

References Material::get_color(), and m_material.

Referenced by get_color_contribution().

Here is the call graph for this function:

Here is the caller graph for this function:

Magick::Color Renderable::get_color_contribution ( const Point3D intersection_point,
const Ray ray,
Vector reflect,
Vector refract 
) [virtual]

Determine the contribution to lighting/color of the pixel based on the incoming ray and the intersection point.

Precondition:
If this method is called the ray does intersect with the surface.
Parameters:
intersection_point This is Point3D that describes the intersection point of ray and primitive.
ray This is the incoming ray.
reflect A reference to the reflection vector. This is here to avoid calculating it twice.
refract A reference to the refraction vector.
Returns:
The color which is the result of applying diffuse and specular lighting the the primitive.

Definition at line 112 of file renderable.cpp.

References Ray::direction(), dot_product(), get_color(), get_diffuse(), get_final_normal(), Scene::get_instance(), get_reflection(), get_reflectivity(), get_refraction_index(), Scene::get_scene(), is_in_shadow(), is_light(), and log_warn.

Referenced by trace_ray().

Here is the call graph for this function:

Here is the caller graph for this function:

double Renderable::get_diffuse ( const Point3D intersection_point  )  const [virtual]

Returns the diffusion factor of the primitive.

Definition at line 11 of file renderable.cpp.

References Material::get_diffuse(), m_center, m_center_material, and m_material.

Referenced by get_color_contribution().

Here is the call graph for this function:

Here is the caller graph for this function:

Ray Renderable::get_final_normal ( const Point3D p  )  [private]

Returns the final surface normal at point p, after being processed for bump-mapping.

Definition at line 99 of file renderable.cpp.

References get_normal(), m_bumpmap, and BumpMap::perturb_normal().

Referenced by get_color_contribution().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual Ray Renderable::get_normal ( const Point3D p  )  const [pure virtual]

Returns the surface normal at point p. Derived classes should override this to provide the correct surface normal for the given point.

Implemented in Plane, Polygon, and Sphere.

Referenced by ImageMap::get_color(), and get_final_normal().

Here is the caller graph for this function:

double Renderable::get_opacity ( const Point3D intersection_point  )  const [virtual]

Returns the opacity level of this object.

Definition at line 64 of file renderable.cpp.

References Material::get_opacity(), m_center, m_center_material, and m_material.

Referenced by trace_ray().

Here is the call graph for this function:

Here is the caller graph for this function:

double Renderable::get_reflection ( const Point3D intersection_point  )  const [virtual]

Returns the reflection coefficient. This is a number between 0 and 1.

Definition at line 28 of file renderable.cpp.

References Material::get_reflection(), m_center, m_center_material, and m_material.

Referenced by get_color_contribution(), and trace_ray().

Here is the call graph for this function:

Here is the caller graph for this function:

double Renderable::get_reflectivity ( const Point3D intersection_point  )  const [virtual]

Returns the shinyness factor of the object. The higher the number the shinier.

Definition at line 45 of file renderable.cpp.

References Material::get_reflectivity(), m_center, m_center_material, and m_material.

Referenced by get_color_contribution().

Here is the call graph for this function:

Here is the caller graph for this function:

double Renderable::get_refraction_index ( const Point3D intersection_point  )  const [virtual]

Returns the refraction index of this object.

Definition at line 72 of file renderable.cpp.

References Material::get_refraction_index(), m_center, m_center_material, and m_material.

Referenced by get_color_contribution().

Here is the call graph for this function:

Here is the caller graph for this function:

double Renderable::get_specular ( const Point3D intersection_point  )  const [virtual]

Returns the specular coefficient. This is a number between 0 and 1.

Definition at line 53 of file renderable.cpp.

References m_center_material.

bool Renderable::initialize ( xmlNode *  node  ) 

Perform common initialization. This method is not declared virtual as it should never be overridden.

Definition at line 199 of file renderable.cpp.

References Scene::get_bumpmap(), Scene::get_instance(), Scene::get_material(), get_properties(), log_debug, log_err, m_bumpmap, m_center_material, and m_material.

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

Here is the call graph for this function:

Here is the caller graph for this function:

bool Renderable::is_in_shadow ( const Ray ray_to_light,
const Point3D  intersection_point 
) [inline]

Definition at line 73 of file renderable.h.

References Scene::find_collision(), Scene::get_instance(), INF, and is_light().

Referenced by get_color_contribution().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Renderable::is_light ( const Point3D intersection_point  )  const [virtual]

Returns if the primitive emits light.

Definition at line 85 of file renderable.cpp.

References Material::is_light(), m_center, m_center_material, and m_material.

Referenced by get_color_contribution(), and is_in_shadow().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Renderable::set_is_light ( bool   )  [virtual]

Definition at line 93 of file renderable.cpp.

References m_material, and Material::set_is_light().

Referenced by SceneParser::parse_light_sources().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

BumpMap* Renderable::m_bumpmap [protected]

Bump map associated with primitive. May be null. Bump maps are associated with the primitive and not the material as they affect the "structure" of the object as opposed to simply the coloring and shading of the object.

Definition at line 113 of file renderable.h.

Referenced by get_final_normal(), initialize(), Plane::Plane(), and Polygon::Polygon().

Point3D Renderable::m_center [protected]

"Center" of object. Some objects do not have a true center, such as a plane, but to simplify the lighting algorithm we need to move this to Renderable. This might also be useful in the future for centering textures or materials around.

Definition at line 106 of file renderable.h.

Referenced by Sphere::collides_with(), get_center(), get_diffuse(), Sphere::get_normal(), get_opacity(), get_reflection(), get_reflectivity(), get_refraction_index(), is_light(), and Sphere::Sphere().

bool Renderable::m_center_material [protected]

Material centering policy. When set to true, materials will be centered to the center of the primitive.

Definition at line 118 of file renderable.h.

Referenced by get_diffuse(), get_opacity(), get_reflection(), get_reflectivity(), get_refraction_index(), get_specular(), initialize(), and is_light().

Material* Renderable::m_material [protected]

Material of the object. Materials may be simple materials, such as a solid color, or they may be complicated composites, such as checkered marble, but one primitive only considers itself to have one material.

Definition at line 99 of file renderable.h.

Referenced by get_color(), get_diffuse(), get_opacity(), get_reflection(), get_reflectivity(), get_refraction_index(), initialize(), is_light(), Plane::Plane(), Polygon::Polygon(), and set_is_light().


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