vtlib library
Public Member Functions | List of all members
vtMaterial Class Reference

Inherits StateSet.

Public Member Functions

void CopyFrom (vtMaterial *pFrom)
 
void SetDiffuse (float r, float g, float b, float a=1.0f)
 
RGBAf GetDiffuse () const
 
void SetSpecular (float r, float g, float b)
 
RGBf GetSpecular () const
 
void SetAmbient (float r, float g, float b)
 
RGBf GetAmbient () const
 
void SetEmission (float r, float g, float b)
 
RGBf GetEmission () const
 
void SetCulling (bool bCulling)
 
bool GetCulling () const
 
void SetLighting (bool bLighting)
 
bool GetLighting () const
 
void SetTransparent (bool bOn, bool bAdd=false)
 
bool GetTransparent () const
 
void SetWireframe (bool bOn)
 
bool GetWireframe () const
 
void SetTexture1D (osg::Image *pImage, int unit=0)
 
void SetTexture2D (osg::Image *pImage, int unit=0, bool bCompression=false)
 
osg::Image * GetTextureImage (int unit=0) const
 
void ModifiedTexture (int unit=0)
 
void SetClamp (bool bClamp, int unit=0)
 
bool GetClamp (int unit=0) const
 
void SetMipMap (bool bMipMap, int unit=0)
 
bool GetMipMap (int unit=0) const
 

Detailed Description

A material is a description of how geometry (typically, a surface) should be rendered. For a good description of how Materials work, see the opengl.org website or the OpenGL Red Book.

vtlib's concept of a material is slightly more broad than OpenGL's, because it includes texture and transparency (alpha). It maps closely to OSG's "state set", though that is even broader in scope.

Member Function Documentation

void vtMaterial::CopyFrom ( vtMaterial pFrom)

Copy this material from another.

RGBf vtMaterial::GetAmbient ( ) const

Get the ambient color of this material.

bool vtMaterial::GetClamp ( int  unit = 0) const

Get the texture clamping property of this material.

bool vtMaterial::GetCulling ( ) const

Get the backface culling property of this material.

RGBAf vtMaterial::GetDiffuse ( ) const

Get the diffuse color of this material.

RGBf vtMaterial::GetEmission ( ) const

Get the emissive color of this material.

bool vtMaterial::GetLighting ( ) const

Get the lighting property of this material.

bool vtMaterial::GetMipMap ( int  unit = 0) const

Get the texture mipmapping property of this material.

RGBf vtMaterial::GetSpecular ( ) const

Get the specular color of this material.

osg::Image * vtMaterial::GetTextureImage ( int  unit = 0) const

Returns the texture (image) associated with a material.

bool vtMaterial::GetTransparent ( ) const

Get the transparent property of this material.

bool vtMaterial::GetWireframe ( ) const

Get the wireframe property of this material.

void vtMaterial::ModifiedTexture ( int  unit = 0)

Call this method to tell vtlib that you have modified the contents of a texture so it needs to be sent again to the graphics card.

void vtMaterial::SetAmbient ( float  r,
float  g,
float  b 
)

Set the ambient color of this material.

void vtMaterial::SetClamp ( bool  bClamp,
int  unit = 0 
)

Set the texture clamping property for this material. Clamp=true prevents sub-texel interpolation at the edge of the texture. Default is false.

void vtMaterial::SetCulling ( bool  bCulling)

Set the backface culling property of this material.

void vtMaterial::SetDiffuse ( float  r,
float  g,
float  b,
float  a = 1.0f 
)

Set the diffuse color of this material.

Parameters
r,g,bThe rgb value (0.0 to 1.0) of this material
aFor a material with transparency enabled, the alpha component of the diffuse color determines the overall transparency of the material. This value ranges from 0 (totally transparent) to 1 (totally opaque.)
void vtMaterial::SetEmission ( float  r,
float  g,
float  b 
)

Set the emissive color of this material.

void vtMaterial::SetLighting ( bool  bLighting)

Set the lighting property of this material.

void vtMaterial::SetMipMap ( bool  bMipMap,
int  unit = 0 
)

Set the texture mipmapping property for this material. Mip-mapping provides 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.

void vtMaterial::SetSpecular ( float  r,
float  g,
float  b 
)

Set the specular color of this material.

void vtMaterial::SetTexture1D ( osg::Image *  pImage,
int  unit = 0 
)

Set the texture for this material.

void vtMaterial::SetTexture2D ( osg::Image *  pImage,
int  unit = 0,
bool  bCompression = false 
)

Set the texture for this material.

void vtMaterial::SetTransparent ( bool  bOn,
bool  bAdd = false 
)

Set the transparent property of this material.

Parameters
bOnTrue to turn on transparency (blending).
bAddTrue for additive blending.
void vtMaterial::SetWireframe ( bool  bOn)

Set the wireframe property of this material.

Parameters
bOnTrue to turn on wireframe.