Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

osgFX::BumpMapping Class Reference

This effect makes surfaces appear bumpy. More...

Inheritance diagram for osgFX::BumpMapping:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 BumpMapping ()
 BumpMapping (const BumpMapping &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 META_Effect (osgFX, BumpMapping,"Bump Mapping","This effect makes surfaces appear bumpy.Children nodes must use two textures,""one for diffuse color and one for the normal map(which can be created""from a height map with tools like nVIDIA's normal map generator).Furthermore,""tangent-space basis vectors must be created and assigned to each Geometry;this""can be done quickly by calling BumpMapping::prepareChildren().Note that both""diffuse and normal map textures must have corresponding UV maps defined in""Geometry objects.\n""This effect defines a preferred technique which uses ARB vertex &fragment""programs, and a fallback technique which doesn't use fragment programs.The""latter is more limited though since it can't handle ambient and specular""components.","Marco Jez")
int getLightNumber () const
 get the OpenGL light number

void setLightNumber (int n)
 set the OpenGL light number that will be used in lighting computations

int getDiffuseTextureUnit () const
 get the texture unit that contains diffuse color texture.

void setDiffuseTextureUnit (int n)
 set the texture unit that contains diffuse color texture.

int getNormalMapTextureUnit () const
 get the texture unit that contains normal map texture.

void setNormalMapTextureUnit (int n)
 set the texture unit that contains normal map texture.

osg::Texture2DgetOverrideDiffuseTexture ()
 get the diffuse color texture that overrides children's texture

const osg::Texture2DgetOverrideDiffuseTexture () const
 get the const diffuse color texture that overrides children's texture

void setOverrideDiffuseTexture (osg::Texture2D *texture)
 set the diffuse color texture that overrides children's texture

osg::Texture2DgetOverrideNormalMapTexture ()
 get the normal map texture that overrides children's texture

const osg::Texture2DgetOverrideNormalMapTexture () const
 get the const normal map texture that overrides children's texture

void setOverrideNormalMapTexture (osg::Texture2D *texture)
 set the normal map texture that overrides children's texture

void prepareGeometry (osg::Geometry *geo)
 prepare a Geometry for bump lighting.

void prepareNode (osg::Node *node)
 prepare a Node for bump lighting, calling prepareGeometry() for each Geometry

void prepareChildren ()
 prepare children for bump lighting.

void setUpDemo ()
 set up a demo environment with predefined diffuse and normal maps, as well as texture coordinates


Protected Member Functions

virtual ~BumpMapping ()
BumpMappingoperator= (const BumpMapping &)
bool define_techniques ()
 abstract method to be implemented in derived classes; its purpose if to create the techniques that can be used for obtaining the desired effect.


Detailed Description

This effect makes surfaces appear bumpy.

Children nodes must use two textures, one for diffuse color and one for the normal map (which can be created from a height map with tools like nVIDIA's normal map generator). Furthermore, tangent-space basis vectors must be created and assigned to each Geometry; this can be done quickly by calling BumpMapping::prepareChildren(). Note that both diffuse and normal map textures must have corresponding UV maps defined in Geometry objects. This effect defines a preferred technique which uses ARB vertex & fragment programs, and a fallback technique which doesn't use fragment programs. The latter is more limited though since it can't handle ambient and specular components.


Constructor & Destructor Documentation

osgFX::BumpMapping::BumpMapping  ) 
 

osgFX::BumpMapping::BumpMapping const BumpMapping copy,
const osg::CopyOp copyop = osg::CopyOp::SHALLOW_COPY
 

virtual osgFX::BumpMapping::~BumpMapping  )  [inline, protected, virtual]
 


Member Function Documentation

bool osgFX::BumpMapping::define_techniques  )  [protected, virtual]
 

abstract method to be implemented in derived classes; its purpose if to create the techniques that can be used for obtaining the desired effect.

You will usually call addTechnique() inside this method.

Implements osgFX::Effect.

int osgFX::BumpMapping::getDiffuseTextureUnit  )  const [inline]
 

get the texture unit that contains diffuse color texture.

Default is 1

int osgFX::BumpMapping::getLightNumber  )  const [inline]
 

get the OpenGL light number

int osgFX::BumpMapping::getNormalMapTextureUnit  )  const [inline]
 

get the texture unit that contains normal map texture.

Default is 0

const osg::Texture2D * osgFX::BumpMapping::getOverrideDiffuseTexture  )  const [inline]
 

get the const diffuse color texture that overrides children's texture

osg::Texture2D * osgFX::BumpMapping::getOverrideDiffuseTexture  )  [inline]
 

get the diffuse color texture that overrides children's texture

const osg::Texture2D * osgFX::BumpMapping::getOverrideNormalMapTexture  )  const [inline]
 

get the const normal map texture that overrides children's texture

osg::Texture2D * osgFX::BumpMapping::getOverrideNormalMapTexture  )  [inline]
 

get the normal map texture that overrides children's texture

osgFX::BumpMapping::META_Effect osgFX  ,
BumpMapping  ,
"Bump Mapping"  ,
"This effect makes surfaces appear bumpy.Children nodes must use two  textures,
""one for diffuse color and one for the normal map(which can be created""from a height map with tools like nVIDIA's normal map generator).  Furthermore,
""tangent-space basis vectors must be created and assigned to each Geometry;this""can be done quickly by calling BumpMapping::prepareChildren().Note that both""diffuse and normal map textures must have corresponding UV maps defined in""Geometry objects.\n""This effect defines a preferred technique which uses ARB vertex &fragment""  programs,
and a fallback technique which doesn't use fragment programs.The""latter is more limited though since it can't handle ambient and specular""components."  ,
"Marco Jez" 
 

BumpMapping& osgFX::BumpMapping::operator= const BumpMapping  )  [inline, protected]
 

void osgFX::BumpMapping::prepareChildren  ) 
 

prepare children for bump lighting.

Actually calls prepareNode() for each child

void osgFX::BumpMapping::prepareGeometry osg::Geometry geo  ) 
 

prepare a Geometry for bump lighting.

Tangent-space basis vectors are generated and attached to the geometry as vertex attribute arrays.

void osgFX::BumpMapping::prepareNode osg::Node node  ) 
 

prepare a Node for bump lighting, calling prepareGeometry() for each Geometry

void osgFX::BumpMapping::setDiffuseTextureUnit int  n  )  [inline]
 

set the texture unit that contains diffuse color texture.

Default is 1

void osgFX::BumpMapping::setLightNumber int  n  )  [inline]
 

set the OpenGL light number that will be used in lighting computations

void osgFX::BumpMapping::setNormalMapTextureUnit int  n  )  [inline]
 

set the texture unit that contains normal map texture.

Default is 0

void osgFX::BumpMapping::setOverrideDiffuseTexture osg::Texture2D texture  )  [inline]
 

set the diffuse color texture that overrides children's texture

void osgFX::BumpMapping::setOverrideNormalMapTexture osg::Texture2D texture  )  [inline]
 

set the normal map texture that overrides children's texture

void osgFX::BumpMapping::setUpDemo  )  [virtual]
 

set up a demo environment with predefined diffuse and normal maps, as well as texture coordinates

Reimplemented from osgFX::Effect.


The documentation for this class was generated from the following file:
Generated at Thu Nov 24 16:24:11 2005 for the OpenSceneGraph by doxygen 1.3.6.