Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PainterMultitexture Class Reference

Implements the Painter visitor to draw a Model with detail and bumpmapping on the screen. More...

#include <PainterMultitexture.h>

Inheritance diagram for PainterMultitexture:

Painter List of all members.

Public Methods

 PainterMultitexture ()
 Initialize the object with defaults.

virtual void paintMesh (const Mesh &mesh, const Vector &eye, const Vector &light) const
 Draw the Mesh using multitextures.

virtual void paintTriangle (const Triangle &triangle, const Vector &eye, const Vector &light) const
 Draw a Triangle taking into account the texture coordinate perturbation.


Private Attributes

bool m_perturbTextureCoordinates
 If true, perturb the current texture coordinates towards the light.


Detailed Description

Implements the Painter visitor to draw a Model with detail and bumpmapping on the screen.

The drawing process uses the multitexture facilities of the card in order to render the detail and bumpmap layers.


Member Function Documentation

void PainterMultitexture::paintMesh const Mesh   mesh,
const Vector   eye,
const Vector   light
const [virtual]
 

Draw the Mesh using multitextures.

This method uses the multitexture facilities of the card:

  1. The first pass draws the bumpmap (emboss) layer by combining (in the multitexture combiners) the bumpmap and inverted bumpmap, producing the normalmap.
  2. The second pass draws the detail texture on top of the normalmap.

Reimplemented from Painter.

void PainterMultitexture::paintTriangle const Triangle   triangle,
const Vector   eye,
const Vector   light
const [virtual]
 

Draw a Triangle taking into account the texture coordinate perturbation.

For every vertex, compute the Vector connecting that vertex to the light. Bring that Vector into tangent space using Triangle#getObjectToTangentSpaceMatrix. Once in tangent space, the X and Y coordinates represent the amount by which the bumpmap texture should be perturbed before subtracted from itself in order to compute the heightmap.

This can be intuitively understood as follows: if the light is perpendicular to our texture (colinear with the face normal) at the current vertex, then the texture should not be perturbed at all: when the light (=normal) is brought into tangent space, it corresponds to the Z axis, that is to the vector (0, 0, 1). The X and Y coordinates of the light (=normal) do not perturb the texture.

Reimplemented from Painter.


Member Data Documentation

bool PainterMultitexture::m_perturbTextureCoordinates [mutable, private]
 

If true, perturb the current texture coordinates towards the light.

This value is set to true in paintMesh in order to perturb the current layer towards the light in such a way that, when it is blended against the layer underneath, it adds or subtracts to produce a normalmap.


The documentation for this class was generated from the following files:
Generated on Sat Mar 22 15:12:08 2003 for Bumpmap by doxygen1.3-rc2