librtl

rtl_material Class Reference

Base class for all materials. More...

#include <material.h>

Inherits dyn_collectable.

Inherited by rtl_glass, rtl_jbt::material and rtl_softmat.

List of all members.

Public Members

Static Public Members

Protected Members


Detailed Description

Base class for all materials.

Materials provide the definition of surface detail for all objects. Additionally their specification is key to the illumination model. The spawn function causes additional rays to be spawned. So a render which wishes to use path tracing to integrate diffuse inter-reflections can be implemented by overriding this function.

Examples:
Polyhedrons, Simple, Soft and SuperEllipsoids.

Member Enumeration Type Documentation

enum rtl_material::Type

Type of material that this is. If Hall (not yet implemented) then Fresnel coefficients should exist and the illumination model should cast to a Hall material and use the fresnel values.

Enumeration values:


Member Function Documentation

rtl_material::rtl_material()

Default material.

rtl_material::rtl_material( const jColour& )

Default with a different colour for the diffuse property.

rtl_material::rtl_material( jFlt, jFlt, const jColour&, jFlt, const jColour&, jFlt, jFlt=0.1, jFlt=0.0 )

Sets material with kA, kD, Dclr, kS, Sclr, n, kR, kT.

void rtl_material::texture( rtl_texture* _tex )

Sets a texture that this material should use. This function should be avoided as the texture gets set by the rtl_world::add() function when the material is added to the scene. This function is provided for internal use. However if you are building a composite texture then the submaterial textures should be set through this function.

rtl_texture* rtl_material::texture()

Returns the texture form this material.

rtl_texture* rtl_material::texture()

Returns the texture form this material.

jFlt rtl_material::kA() const

Returns the ambient coefficient.

jFlt rtl_material::kD() const

Returns the diffuse coefficient.

jFlt rtl_material::kS() const

Returns the Specular coefficient.

jFlt rtl_material::n() const

Returns the specular exponent.

const jColour& rtl_material::kR() const

Returns the reflection colour.

const jColour& rtl_material::kT() const

Returns the transmission colour.

void rtl_material::kA( jFlt _ka )

Sets the ambient coefficient.

void rtl_material::kD( jFlt _kd )

Sets the diffuseness coefficient.

void rtl_material::kS( jFlt _ks )

Sets the specularity coefficient.

Examples:
Soft.

void rtl_material::kR( jFlt _kr )

Sets the reflection coefficient to a gray shade vector.

void rtl_material::kT( jFlt _kt )

Sets the transmission coefficient to a gray shade vector.

void rtl_material::kR( const jColour& _kr )

Sets the reflection coefficient.

Examples:
Soft.

void rtl_material::kT( const jColour& _kt )

Sets the transmission coefficient.

void rtl_material::n( jFlt _se )

Sets the specular exponent.

Examples:
Soft.

jFlt rtl_material::ior() const

Returns the index of refraction.

void rtl_material::ior( jFlt _ior )

Sets the index of refraction.

const jColour& rtl_material::diffuse() const

Returns the diffuse colour.

const jColour& rtl_material::specular() const

Returns the specular colour.

void rtl_material::diffuse( const jColour& _dclr )

Sets the diffuse colour.

void rtl_material::specular( const jColour& _sclr )

Sets the specular colour.

virtual void rtl_material::surface( rtl_ray& ray, const jVec3& pt, jNorm3& N ) [virtual]

Sets the surface so that the properties are appropriate to run the shading routine in the illumination model. This function should be overridden to implement the desired changes. Any of the protected attributes can be changed so that surface attributes depend on the intersection.

Reimplemented in rtl_softmat and rtl_jbt::material.

virtual jColour rtl_material::spawn( rtl_ray&, const jVec3&, const jNorm3& ) [virtual]

Implements surface property light transfer mechanism. Materials that are reflective or transmisive cause the recursive rays when this function is called. To implement some sort of distributed model for diffuse interreflections or path tracing, or scattering, override this method and go spawn appropriate rays.

virtual Type rtl_material::type() const [virtual]

Returns the type of material.

void rtl_material::assume( const rtl_material*, bool texture = true )

Copies the given materials attributes to this materials attributes.

void rtl_material::lerp( jFlt, const rtl_material*, const rtl_material* )

Performs a linear interpolation of the two materials by the given weight (0..1).

void rtl_material::trilerp( jFlt, const rtl_material*, jFlt, const rtl_material*, jFlt, const rtl_material* )

Performs a tri-linear interpolation of the three materials.

rtl_flags& rtl_material::flags()

Returns the flags for this object.

rtl_flags& rtl_material::flags()

Returns the flags for this object.

void rtl_material::setdefault() [protected]


Member Data Documentation

rtl_material rtl_material::Default [static]

The default material that is used for an objects' surface if none was specified.

jFlt rtl_material::ka [protected]

jFlt rtl_material::kd [protected]

jFlt rtl_material::ks [protected]

jFlt rtl_material::se [protected]

jFlt rtl_material::i_r [protected]

jColour rtl_material::dclr [protected]

jColour rtl_material::sclr [protected]

jColour rtl_material::kr [protected]

jColour rtl_material::kt [protected]

rtl_texture* rtl_material::tex [protected]

rtl_flags rtl_material::f [protected]


The documentation for this class was generated from the following file:
JSP / librtl v0.2 mtigges@cpsc.ucalgary.ca