#include <Material.h>
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... | |
Contains an array of materials. Provides useful methods for creating material easily.
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.
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. |
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).
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. |
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.
fOpacity | Ranges 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.
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. |
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.
int vtMaterialArray::AppendMaterial | ( | vtMaterial * | pMat) |
Adds a material to this material array.
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.