Umasoft
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions | List of all members
vtMaterialArray Class Reference

#include <Material.h>

Inheritance diagram for vtMaterialArray:

Public Member Functions

int Find (vtMaterial *mat)
 
int AddTextureMaterial (osg::Image *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 osg::Image *image) const
 
void CopyFrom (vtMaterialArray *pFromMats)
 
void RemoveMaterial (vtMaterial *pMat)
 
int AppendMaterial (vtMaterial *pMat)
 Adds a material to this material array. More...
 

Detailed Description

Contains an array of materials. Provides useful methods for creating material easily.

Member Function Documentation

int vtMaterialArray::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
diffuseThe Diffuse color component of the material.
ambientThe Ambient color component of the material.
bCullingtrue to cull backfaces (only the front side of each polygon is rendered.)
bLightingtrue 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.
bWireframeTrue for a material which will render only the edges of polygons.
fAlphaAlpha value (opacity), ranges from 0 (completely transparent) to 1 (opaque). Default is 1. If transparency is not enabled, this value is ignored.
fEmissiveEmmisive 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 vtMaterialArray::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
diffuseThe Diffuse color component of the material.
bCullingtrue to cull backfaces (only the front side of each polygon is rendered.)
bLightingtrue 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.
bWireframeTrue for a material which will render only the edges of polygons.
fAlphaAlpha value (opacity), ranges from 0 (completely transparent) to 1 (opaque). Default is 1. If transparency is not enabled, this value is ignored.
fEmissiveEmmisive 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 vtMaterialArray::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
fOpacityRanges from 0 (fully transparent) to 1 (fully opaque).
int vtMaterialArray::AddTextureMaterial ( osg::Image *  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 osg::Image 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
pImageA valid image (bitmap) which you have created.
bCullingtrue to cull backfaces (only the front side of each polygon is rendered.)
bLightingtrue 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.
bTransptrue for a material with some transparency (default is false).
bAdditivetrue 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.
fAmbientAmbient 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.
fDiffuseDiffuse 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.
fAlphaAlpha value (opacity), ranges from 0 (completely transparent) to 1 (opaque). Default is 1. If transparency is not enabled, this value is ignored.
fEmissiveEmmisive 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.
bTexGentrue for materials whose texture mapping will be generated automatically. false if you will provide explicit UV values to drape your texture. Default is false.
bClamptrue for Texture Clamping, which prevents sub-texel interpolation at the edge of the texture. Default is false.
bMipMaptrue 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 vtMaterialArray::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.
int vtMaterialArray::AppendMaterial ( vtMaterial pMat)

Adds a material to this material array.

Adds a material to this material array.

Returns
The index of the material that was added.
void vtMaterialArray::CopyFrom ( vtMaterialArray pFrom)

Copies all the materials from one vtMaterialArray to another.

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

int vtMaterialArray::Find ( vtMaterial mat)

Find a material in this array, by pointer

int vtMaterialArray::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 vtMaterialArray::FindByImage ( const osg::Image *  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.

The documentation for this class was generated from the following files: