vtlib library
|
Inherits vector< vtMaterialPtr >, and Referenced.
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 bCompression=false) |
int | AddRGBMaterial (const RGBf &diffuse, bool bCulling=true, bool bLighting=true, bool bWireframe=false, float fAlpha=1.0f, float fEmissive=0.0f) |
int | FindByDiffuse (const RGBAf &rgba) const |
int | FindByImage (const osg::Image *image) const |
void | CopyFrom (vtMaterialArray *pFromMats) |
int | AppendMaterial (vtMaterial *pMat) |
Adds a material to this material array. More... | |
Contains an array of materials. Provides useful methods for creating material easily.
int vtMaterialArray::AddRGBMaterial | ( | 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).
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. |
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 | bCompression = 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.
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. |
bCompression | For textured materials, requests texture compression. |
int vtMaterialArray::AppendMaterial | ( | vtMaterial * | pMat | ) |
Adds a material to this material array.
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.
int vtMaterialArray::FindByImage | ( | const osg::Image * | image | ) | const |
Find a material in an array by looking for a specific texture image.