Shader Class Reference

#include <Shader.h>

Inheritance diagram for Shader:

GRAObject GlobalShader LocalShader RadShader RTShader GLShader PhotonMapShader List of all members.

Public Member Functions

 Shader (ReflectionModel *m, DiffuseBRDF *db, SpecularBRDF *sb)
virtual ~Shader ()
virtual void setScene (Scene *o)
virtual void distributeEnergy (void)=0
virtual bool setRenderedShape (SceneGraphObject *pShape, const Matrix4 *pTrMat)
virtual Color3f * illuminatePoint (const Vector3 &location, const Vector3 &normal, const Vector3 &eyeDir, float eyeDist, double *pNV, const Matrix4 *pTrMat)=0

Protected Attributes

ReflectionModel_pReflectionModel
SceneGraphObject * _pShape
Scene_pScene
DiffuseBRDF * _pDefaultDiffBRDF
SpecularBRDF * _pDefaultSpecBRDF

Detailed Description

Shader works in the space of scene and is responsible for distribution of energy. It works in two modes: (1) view-independent global energy distribution in the whole scene and (2) computation of the final color of arbitrary point on surface, using precomputed global energy from the first stage

Protocol: shader.setScene(scene); shader.distributeEnergy(); // can do nothing // next calls are ususally invoked inside renderer: shader.setRenderedShape(shape, trMat); for (interesting points on object's surface) { shader.illuminatePoint(...,trMat); // the same trMat or NULL when // given vectors are already // transformed }

Definition at line 34 of file Shader.h.


Constructor & Destructor Documentation

Shader ReflectionModel m,
DiffuseBRDF *  db,
SpecularBRDF *  sb
[inline]
 

Constructor.

Parameters:
m reflection model
db default diffuse BRDF
sb default specular BRDF

Definition at line 50 of file Shader.h.

virtual ~Shader  )  [inline, virtual]
 

Destructor.

Definition at line 60 of file Shader.h.


Member Function Documentation

virtual void distributeEnergy void   )  [pure virtual]
 

View-independent global energy distribution in the whole scene (first stage of the global illumination process)

Implemented in LocalShader, PhotonMapShader, RadShader, and RTShader.

virtual Color3f* illuminatePoint const Vector3 &  location,
const Vector3 &  normal,
const Vector3 &  eyeDir,
float  eyeDist,
double *  pNV,
const Matrix4 *  pTrMat
[pure virtual]
 

View-restricted illumination of individual points on surface (second stage of the global illumination process). Two combinations of parametters are possible: 1) Vectors are not transformed and the transformation matrix is identical to the matrix of the setRenderedShape() function. 2) Vectors are already transformed and the matrix is NULL.

Parameters:
location point's location on surface (space coords.)
normal normalized normal vector
eyeDir normalized direction from towards viewer
eyeDist distance to viewer
pNV either cross-product of normal and eyeDir or NULL
pTrMat transformation matrix or NULL
Returns:
final color of the point on success, NULL otherwise

Implemented in GLShader, RadShader, and RTShader.

Referenced by RTRender::_render_pixel_point(), and RadShader::illuminatePoint().

virtual bool setRenderedShape SceneGraphObject *  pShape,
const Matrix4 *  pTrMat
[inline, virtual]
 

Sets the shape of interest used for per-surface point illumination, see illuminatePoint().

Parameters:
pShape shape of interest
pTrMat transformation matrix of the shape

Reimplemented in GLShader, PhotonMapShader, and RadShader.

Definition at line 85 of file Shader.h.

Referenced by GLRender::_render(), GLBVRender::_render(), RTRender::_render_pixel_point(), RadShader::setRenderedShape(), and PhotonMapShader::setRenderedShape().

virtual void setScene Scene o  )  [inline, virtual]
 

Sets the scene for energy distribution, see distributeEnergy().

Parameters:
o scene

Reimplemented in PhotonMapShader, and RadShader.

Definition at line 67 of file Shader.h.

Referenced by PhotonMapShader::setScene().


Member Data Documentation

DiffuseBRDF* _pDefaultDiffBRDF [protected]
 

Definition at line 39 of file Shader.h.

Referenced by PhotonMapShader::distributeEnergy().

SpecularBRDF* _pDefaultSpecBRDF [protected]
 

Definition at line 40 of file Shader.h.

Referenced by PhotonMapShader::distributeEnergy().

ReflectionModel* _pReflectionModel [protected]
 

Definition at line 36 of file Shader.h.

Referenced by RadShader::distributeEnergy(), and RTShader::illuminatePoint().

Scene* _pScene [protected]
 

Definition at line 38 of file Shader.h.

Referenced by PhotonMapShader::_create_maps_per_shape(), PhotonMapShader::_create_scene_maps(), PhotonMapShader::_emit_caustic_photon(), PhotonMapShader::_emit_global_photon(), PhotonMapShader::distributeEnergy(), and RadShader::setScene().

SceneGraphObject* _pShape [protected]
 

Definition at line 37 of file Shader.h.

Referenced by RTShader::illuminatePoint(), and GLShader::setRenderedShape().


The documentation for this class was generated from the following file:
Generated on Tue Nov 21 15:11:43 2006 for gra by  doxygen 1.4.6