vtMaterialArrayBase Class Reference
[Scene Graph]

Inheritance diagram for vtMaterialArrayBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

Contains an array of materials. Provides useful methods for creating material easily. This is the base class for vtMaterialArray, and provides most of the functionality for that class.


Public Member Functions

int AddTextureMaterial (class vtImage *pImage, bool bCulling, bool bLighting, bool bTransp=false, bool bAdditive=false, float fAmbient=0.0f, float fDiffuse=1.0f, float fAlpha=1.0f, float fEmissive=0.0f, bool bTexGen=false, bool bClamp=false, bool bMipMap=false)
int AddTextureMaterial2 (const char *fname, bool bCulling, bool bLighting, bool bTransp=false, bool bAdditive=false, float fAmbient=0.0f, float fDiffuse=1.0f, float fAlpha=1.0f, float fEmissive=0.0f, bool bTexGen=false, bool bClamp=false, bool bMipMap=false)
int AddRGBMaterial (const RGBf &diffuse, const RGBf &ambient, bool bCulling=true, bool bLighting=true, bool bWireframe=false, float fAlpha=1.0f, float fEmissive=0.0f)
int AddRGBMaterial1 (const RGBf &diffuse, bool bCulling=true, bool bLighting=true, bool bWireframe=false, float fAlpha=1.0f, float fEmissive=0.0f)
void AddShadowMaterial (float fOpacity)
int FindByDiffuse (const RGBAf &rgba) const
int FindByImage (const vtImage *image) const
void CopyFrom (vtMaterialArrayBase *pFromMats)


Member Function Documentation

int vtMaterialArrayBase::AddRGBMaterial const RGBf diffuse,
const RGBf ambient,
bool  bCulling = true,
bool  bLighting = true,
bool  bWireframe = false,
float  fAlpha = 1.0f,
float  fEmissive = 0.0f
 

Create and add a simple colored material. This method takes diffuse and ambient color and let you control several other aspects of the material.

Parameters:
diffuse The Diffuse color component of the material.
ambient The Ambient color component of the material.
bCulling true to cull backfaces (only the front side of each polygon is rendered.)
bLighting true to "light" the material. This means it will use the material's color values, and any active lights to determine the color of the drawn geometry. If false, then only the material's diffuse color is used, and it is not affected by any lights.
bWireframe True for a material which will render only the edges of polygons.
fAlpha Alpha value (opacity), ranges from 0 (completely transparent) to 1 (opaque). Default is 1. If transparency is not enabled, this value is ignored.
fEmissive Emmisive material value, ranges from 0 to 1 (default 0). If lighting is enabled, this value is added to the combined effect of each existing light. This is useful for geometry which is brighter than the existing light level, such as illuminated objects at night.
Returns:
The index of the added material.

int vtMaterialArrayBase::AddRGBMaterial1 const RGBf diffuse,
bool  bCulling = true,
bool  bLighting = true,
bool  bWireframe = false,
float  fAlpha = 1.0f,
float  fEmissive = 0.0f
 

Create and add a simple colored material. This method takes diffuse color and let you control several other aspects of the material. Ambient color will be assumed to a be a dimmer shade of the supplied diffuse color (diffuse / 4).

Parameters:
diffuse The Diffuse color component of the material.
bCulling true to cull backfaces (only the front side of each polygon is rendered.)
bLighting true to "light" the material. This means it will use the material's color values, and any active lights to determine the color of the drawn geometry. If false, then only the material's diffuse color is used, and it is not affected by any lights.
bWireframe True for a material which will render only the edges of polygons.
fAlpha Alpha value (opacity), ranges from 0 (completely transparent) to 1 (opaque). Default is 1. If transparency is not enabled, this value is ignored.
fEmissive Emmisive material value, ranges from 0 to 1 (default 0). If lighting is enabled, this value is added to the combined effect of each existing light. This is useful for geometry which is brighter than the existing light level, such as illuminated objects at night.
Returns:
The index of the added material.

void vtMaterialArrayBase::AddShadowMaterial float  fOpacity  ) 
 

Create and add a "shadow" material, which is a black material with transparency, suitable for drawing a shadow under an object.

Parameters:
fOpacity Ranges from 0 (fully transparent) to 1 (fully opaque).

int vtMaterialArrayBase::AddTextureMaterial class vtImage pImage,
bool  bCulling,
bool  bLighting,
bool  bTransp = false,
bool  bAdditive = false,
float  fAmbient = 0.0f,
float  fDiffuse = 1.0f,
float  fAlpha = 1.0f,
float  fEmissive = 0.0f,
bool  bTexGen = false,
bool  bClamp = false,
bool  bMipMap = false
 

Create and add a simple textured material. This method takes a vtImage and let you control many other aspects of the material. Only the first three parameters are required, the rest will be assumed with default values if desired.

Parameters:
pImage A valid image (bitmap) which you have created.
bCulling true to cull backfaces (only the front side of each polygon is rendered.)
bLighting true to "light" the material. This means it will use the material's color values, and any active lights to determine the color of the drawn geometry. If false, then only the material's diffuse color is used, and it is not affected by any lights.
bTransp true for a material with some transparency (default is false).
bAdditive true for an additive material (default is false). This means that the rendered color will be added to, rather than replace, the rendering surface. This is useful for some effects such as drawing stars against a twilight sky, in which the light of a dim star should be added to the background sky.
fAmbient Ambient material value, ranges from 0 to 1 (default 0). If lighting is enabled, this determines how this material is affected by the Ambient component of each existing light.
fDiffuse Diffuse material value, ranges from 0 to 1 (default 1). If lighting is enabled, this determines how this material is affected by the Diffuse component of each existing light. If lighting is not enabled, this indicates the exact lighting value to use for the material.
fAlpha Alpha value (opacity), ranges from 0 (completely transparent) to 1 (opaque). Default is 1. If transparency is not enabled, this value is ignored.
fEmissive Emmisive material value, ranges from 0 to 1 (default 0). If lighting is enabled, this value is added to the combined effect of each existing light. This is useful for geometry which is brighter than the existing light level, such as illuminated objects at night.
bTexGen true for materials whose texture mapping will be generated automatically. false if you will provide explicit UV values to drape your texture. Default is false.
bClamp true for Texture Clamping, which prevents sub-texel interpolation at the edge of the texture. Default is false.
bMipMap true for Mip-mapping, which provided smoother interpolation of the textured geometry when it is under-sampled (generally when it is in the distance.) Useful for avoiding unpleasant aliasing artifacts, but costs 1/3 more texture memory.
Returns:
The index of the added material.

int vtMaterialArrayBase::AddTextureMaterial2 const char *  fname,
bool  bCulling,
bool  bLighting,
bool  bTransp = false,
bool  bAdditive = false,
float  fAmbient = 0.0f,
float  fDiffuse = 1.0f,
float  fAlpha = 1.0f,
float  fEmissive = 0.0f,
bool  bTexGen = false,
bool  bClamp = false,
bool  bMipMap = false
 

Create and add a simple textured material. This method takes a a filename of the texture image to use.

See AddTextureMaterial() for a description of the parameters, which lets you control many other aspects of the material.

Returns:
The index of the added material if successful, or -1 on failure.

void vtMaterialArrayBase::CopyFrom vtMaterialArrayBase pFrom  ) 
 

Copies all the materials from one vtMaterialArray to another.

The materials copied from the source are simply appending to this array.

int vtMaterialArrayBase::FindByDiffuse const RGBAf rgba  )  const
 

Find a material in an array by looking for a specific diffuse color.

Returns:
The index of the material if found, otherwise -1.

int vtMaterialArrayBase::FindByImage const vtImage image  )  const
 

Find a material in an array by looking for a specific texture image.

Returns:
The index of the material if found, otherwise -1.


Generated on Tue Apr 22 10:11:07 2008 for vtlib library by  doxygen 1.4.5