version 3.3

VRS::ShapeMaterialGL Class Reference

#include <vrs/opengl/shapematerialgl.h>

Inheritance diagram for VRS::ShapeMaterialGL:

VRS::MonoAttribute VRS::Attribute VRS::RenderObj VRS::SharedObj VRS::Visitable

List of all members.

Public Types

enum  Side { Front = 0, Back = 1 }
enum  MaterialComponent {
  Emission = 0, Ambient = 1, Diffuse = 2, AmbientAndDiffuse = 3,
  Specular = 4
}

Public Member Functions

 VRS_SERIALIZABLE_CLASS_ENUM (Side)
 VRS_SERIALIZABLE_CLASS_ENUM (MaterialComponent)
 ShapeMaterialGL (const Color &perVertexColor=Color(0.5), const Color &specular=Color(0.5), double shininess=115.0, MaterialComponent perVertexColorMapping=ShapeMaterialGL::AmbientAndDiffuse, const Color &ambient=Color(0.2), const Color &diffuse=Color(0.5), const Color &emission=Color(0.0), bool distinguishSides=false, bool enablePerVertexMaterial=true)
bool operator== (const ShapeMaterialGL &other) const
void setPerVertexColor (const Color &, Side=ShapeMaterialGL::Front)
Color getPerVertexColor (Side=ShapeMaterialGL::Front) const
void setAmbient (const Color &, Side=ShapeMaterialGL::Front)
Color getAmbient (Side=ShapeMaterialGL::Front) const
 sets/gets the ambient color
void setDiffuse (const Color &, Side=ShapeMaterialGL::Front)
Color getDiffuse (Side=ShapeMaterialGL::Front) const
 sets/gets the diffuse color
void setSpecular (const Color &, Side=ShapeMaterialGL::Front)
Color getSpecular (Side=ShapeMaterialGL::Front) const
 sets/gets the specular color
void setShininess (double, Side=ShapeMaterialGL::Front)
double getShininess (Side=ShapeMaterialGL::Front) const
 sets/gets the shininess color.
void setEmission (const Color &, Side=ShapeMaterialGL::Front)
Color getEmission (Side=ShapeMaterialGL::Front) const
 sets/gets the emission color
void setVertexColorMapping (MaterialComponent, Side=ShapeMaterialGL::Front)
MaterialComponent getVertexColorMapping (Side=ShapeMaterialGL::Front) const
void setDistinguishSides (bool onOff)
bool getDistinguishSides () const
bool isTransparent () const
void enablePerVertexColoring (bool enable=true)
bool isPerVertexColoringEnabled () const
 VRS_TYPEINFO (ShapeMaterialGL, MonoAttribute)
 VRS_SERIALIZABLE (ShapeMaterialGL)


Member Enumeration Documentation

Enumerator:
Front 
Back 

Enumerator:
Emission 
Ambient 
Diffuse 
AmbientAndDiffuse 
Specular 


Constructor & Destructor Documentation

VRS::ShapeMaterialGL::ShapeMaterialGL ( const Color perVertexColor = Color(0.5),
const Color specular = Color(0.5),
double  shininess = 115.0,
MaterialComponent  perVertexColorMapping = ShapeMaterialGL::AmbientAndDiffuse,
const Color ambient = Color(0.2),
const Color diffuse = Color(0.5),
const Color emission = Color(0.0),
bool  distinguishSides = false,
bool  enablePerVertexMaterial = true 
)

Sets the OpenGL material coefficients that are used to define the reflection properties of shapes. The default material is gray and has a noticible and sharp specular highlight. As a default, shapes (e.g. Polygonsets) can use per vertext material information. Remember, that if perVertexMaterial is enabled the color that is active in the moment of the vertex evaluation is used for the material mapping (after initialized with perVertexColor). It can not be overiden by the material component of the same type (e.g. for AmbientAndDiffuse -> ambient & diffuse) specified here. additionally.


Member Function Documentation

VRS::ShapeMaterialGL::VRS_SERIALIZABLE_CLASS_ENUM ( Side   ) 

VRS::ShapeMaterialGL::VRS_SERIALIZABLE_CLASS_ENUM ( MaterialComponent   ) 

bool VRS::ShapeMaterialGL::operator== ( const ShapeMaterialGL other  )  const

void VRS::ShapeMaterialGL::setPerVertexColor ( const Color ,
Side  = ShapeMaterialGL::Front 
)

Color VRS::ShapeMaterialGL::getPerVertexColor ( ShapeMaterialGL::Side  side = ShapeMaterialGL::Front  )  const [inline]

The per vertex color is a color component which cannot be only modified per scene graph node, but per vertex. To do so, it is necessary to render a shape which uses iterators for definition of its vertices (i.e., polygonset, polygonset or mesh). For these shapes, the color specified in its color-iterator for each vertex will be used as the color of one component of the current ShapeMaterialGL attribute. The value of perVertexColorMapping specifies which component is replaced by the perVertexColor.

void VRS::ShapeMaterialGL::setAmbient ( const Color ,
Side  = ShapeMaterialGL::Front 
)

Color VRS::ShapeMaterialGL::getAmbient ( ShapeMaterialGL::Side  side = ShapeMaterialGL::Front  )  const [inline]

sets/gets the ambient color

void VRS::ShapeMaterialGL::setDiffuse ( const Color ,
Side  = ShapeMaterialGL::Front 
)

Color VRS::ShapeMaterialGL::getDiffuse ( ShapeMaterialGL::Side  side = ShapeMaterialGL::Front  )  const [inline]

sets/gets the diffuse color

void VRS::ShapeMaterialGL::setSpecular ( const Color ,
Side  = ShapeMaterialGL::Front 
)

Color VRS::ShapeMaterialGL::getSpecular ( ShapeMaterialGL::Side  side = ShapeMaterialGL::Front  )  const [inline]

sets/gets the specular color

void VRS::ShapeMaterialGL::setShininess ( double  ,
Side  = ShapeMaterialGL::Front 
)

double VRS::ShapeMaterialGL::getShininess ( ShapeMaterialGL::Side  side = ShapeMaterialGL::Front  )  const [inline]

sets/gets the shininess color.

OpenGL mandates a shininess between 0.0 and 128.0

void VRS::ShapeMaterialGL::setEmission ( const Color ,
Side  = ShapeMaterialGL::Front 
)

Color VRS::ShapeMaterialGL::getEmission ( ShapeMaterialGL::Side  side = ShapeMaterialGL::Front  )  const [inline]

sets/gets the emission color

void VRS::ShapeMaterialGL::setVertexColorMapping ( MaterialComponent  ,
Side  = ShapeMaterialGL::Front 
)

ShapeMaterialGL::MaterialComponent VRS::ShapeMaterialGL::getVertexColorMapping ( ShapeMaterialGL::Side  side = ShapeMaterialGL::Front  )  const [inline]

Defines which color component(s) the perVertexColor will override, and which color component(s) iterators in polygon sets or meshes will overide the shape material attributes. Such a color iterator may overwrite the ambient, diffuse, ambient-and-diffuse, specular or emission color component(s) defined by the current material attribute. The remaining components are not changed by the color iterator.

void VRS::ShapeMaterialGL::setDistinguishSides ( bool  onOff  ) 

bool VRS::ShapeMaterialGL::getDistinguishSides (  )  const [inline]

If the flag is not set, the material settings of the front side are also applied to the back side of a shape. In the other case, front and back material properties may differ. Directly after invoking setDistinguishSides() with "true", the Back sides of the shape material object are guarentied to contain the former Front side values. Therefore, it only makes sense to change the back side material properties if the distinguishSides flag is set!

bool VRS::ShapeMaterialGL::isTransparent (  )  const

returns true iff an alpha value of any color is smaller than one

void VRS::ShapeMaterialGL::enablePerVertexColoring ( bool  enable = true  ) 

enable or disable the activation of per vertex color information. If disabled, only common material components are active and where not overriden from perVertexColor

bool VRS::ShapeMaterialGL::isPerVertexColoringEnabled (  )  const [inline]

VRS::ShapeMaterialGL::VRS_TYPEINFO ( ShapeMaterialGL  ,
MonoAttribute   
)

returns, if the per vertex coloring is active or not

VRS::ShapeMaterialGL::VRS_SERIALIZABLE ( ShapeMaterialGL   ) 


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

Generated on Tue May 22 06:00:24 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact