GLShader Class Reference

#include <GLShader.h>

Inheritance diagram for GLShader:

LocalShader Shader GRAObject List of all members.

Public Types

enum  MeshMode {
  VERTICES, EDGES, FACETS, FACET_EDGES,
  FACET_CORNERS
}
enum  ShadingMode { COLOR, FLAT, SMOOTH, TEXTURE }
enum  FacetMode { AUTO, FRONT, BACK, FRONT_AND_BACK }

Public Member Functions

 GLShader (MeshMode mmode=FACETS, ShadingMode smode=SMOOTH, int density=1, FacetMode fmode=AUTO)
virtual ~GLShader ()
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)
virtual void setMeshDensity (int d)
virtual int getMeshDensity () const
virtual void distributeEnergy (void)
virtual void setScene (Scene *o)

Protected Member Functions

void _illum_vertices (Mesh &) const
void _illum_edges (Mesh &) const
void _illum_facets (GLenum, Mesh &) const
bool _use_precomputed_energy (PolygonalEnergy &) const

Protected Attributes

MeshMode _meshMode
ShadingMode _shadingMode
int _meshDensity
FacetMode _facetMode
bool _exploitEnergy
 whether to exploit precomputed energy coats
ReflectionModel_pReflectionModel
SceneGraphObject * _pShape
Scene_pScene
DiffuseBRDF * _pDefaultDiffBRDF
SpecularBRDF * _pDefaultSpecBRDF

Detailed Description

Local shader based on OpenGL.

Following combinations of mesh/shading/facet modes are currently supported. When FLAT shading mode is required then appropriate FACET mode is automaticaly selected.

VERTICES & (COLOR | SMOOTH) EDGES & (COLOR | SMOOTH) FACET* & (COLOR | FLAT | SMOOTH) & (AUTO | BACK | FRONT | FRONT_AND_BACK)

Definition at line 29 of file GLShader.h.


Member Enumeration Documentation

enum FacetMode
 

If MeshMode::FACET is used then the following restrictions can be applied to omit one-side facets.

Enumerator:
AUTO  get info from mesh
FRONT  show only front facets
BACK  show only back facets
FRONT_AND_BACK  show all facets

Definition at line 56 of file GLShader.h.

enum MeshMode
 

Type of mesh visualization.

Enumerator:
VERTICES  draw vertices only
EDGES  wire-frame mode
FACETS  filled facets
FACET_EDGES  edges of facates (possible hidden surface removal)
FACET_CORNERS  vertices of facets (possible hidden surface removal)

Definition at line 34 of file GLShader.h.

enum ShadingMode
 

Shading mode.

Enumerator:
COLOR  use basic RGB color
FLAT  use phong material and normals of facets
SMOOTH  use phong material and normals of vertices
TEXTURE  use phong material, normals of vertices and apply textures

Definition at line 45 of file GLShader.h.


Constructor & Destructor Documentation

GLShader MeshMode  mmode = FACETS,
ShadingMode  smode = SMOOTH,
int  density = 1,
FacetMode  fmode = AUTO
[inline]
 

Constructor.

Parameters:
mmode mesh mode
smode shading mode
density relative density of produced meshes
fmode facet mode

Definition at line 84 of file GLShader.h.

virtual ~GLShader  )  [inline, virtual]
 

Destructor.

Definition at line 102 of file GLShader.h.


Member Function Documentation

void _illum_edges Mesh &   )  const [protected]
 

Definition at line 29 of file GLShader.cc.

References GLShader::_shadingMode, GLShader::SMOOTH, and GLShader::TEXTURE.

Referenced by GLShader::setRenderedShape().

void _illum_facets GLenum  ,
Mesh & 
const [protected]
 

Definition at line 58 of file GLShader.cc.

References GLShader::_facetMode, GLShader::_shadingMode, GLShader::AUTO, GLShader::BACK, GLShader::FLAT, GLShader::FRONT, GLShader::FRONT_AND_BACK, GLShader::SMOOTH, and GLShader::TEXTURE.

Referenced by GLShader::setRenderedShape().

void _illum_vertices Mesh &   )  const [protected]
 

Definition at line 6 of file GLShader.cc.

References GLShader::_shadingMode, GLShader::SMOOTH, and GLShader::TEXTURE.

Referenced by GLShader::setRenderedShape().

bool _use_precomputed_energy PolygonalEnergy &   )  const [protected]
 

Definition at line 124 of file GLShader.cc.

Referenced by GLShader::setRenderedShape().

virtual void distributeEnergy void   )  [inline, virtual, inherited]
 

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

Implements Shader.

Definition at line 41 of file LocalShader.h.

virtual int getMeshDensity  )  const [inline, virtual]
 

Returns:
relative density of produced meshes

Definition at line 151 of file GLShader.h.

virtual Color3f* illuminatePoint const Vector3 &  location,
const Vector3 &  normal,
const Vector3 &  eyeDir,
float  eyeDist,
double *  pNV,
const Matrix4 *  pTrMat
[inline, 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 cross-product of normal and eyeDir, or NULL
pTrMat transformation matrix or NULL
Returns:
final color of the point on success, NULL otherwise

Implements Shader.

Definition at line 132 of file GLShader.h.

virtual void setMeshDensity int  d  )  [inline, virtual]
 

Sets relative density of produced meshes.

Parameters:
d relative density of produced meshes

Definition at line 146 of file GLShader.h.

bool setRenderedShape SceneGraphObject *  pShape,
const Matrix4 *  pTrMat
[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 from Shader.

Definition at line 163 of file GLShader.cc.

References LocalShader::_exploitEnergy, GLShader::_illum_edges(), GLShader::_illum_facets(), GLShader::_illum_vertices(), GLShader::_meshDensity, GLShader::_meshMode, Shader::_pShape, GLShader::_shadingMode, GLShader::_use_precomputed_energy(), GLShader::COLOR, GLShader::EDGES, GLShader::FACET_CORNERS, GLShader::FACET_EDGES, GLShader::FACETS, and GLShader::VERTICES.

virtual void setScene Scene o  )  [inline, virtual, inherited]
 

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

bool _exploitEnergy [protected, inherited]
 

whether to exploit precomputed energy coats

Definition at line 19 of file LocalShader.h.

Referenced by GLShader::setRenderedShape().

FacetMode _facetMode [protected]
 

Definition at line 67 of file GLShader.h.

Referenced by GLShader::_illum_facets().

int _meshDensity [protected]
 

Definition at line 66 of file GLShader.h.

Referenced by GLShader::setRenderedShape().

MeshMode _meshMode [protected]
 

Definition at line 64 of file GLShader.h.

Referenced by GLShader::setRenderedShape().

DiffuseBRDF* _pDefaultDiffBRDF [protected, inherited]
 

Definition at line 39 of file Shader.h.

Referenced by PhotonMapShader::distributeEnergy().

SpecularBRDF* _pDefaultSpecBRDF [protected, inherited]
 

Definition at line 40 of file Shader.h.

Referenced by PhotonMapShader::distributeEnergy().

ReflectionModel* _pReflectionModel [protected, inherited]
 

Definition at line 36 of file Shader.h.

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

Scene* _pScene [protected, inherited]
 

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, inherited]
 

Definition at line 37 of file Shader.h.

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

ShadingMode _shadingMode [protected]
 

Definition at line 65 of file GLShader.h.

Referenced by GLShader::_illum_edges(), GLShader::_illum_facets(), GLShader::_illum_vertices(), and GLShader::setRenderedShape().


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