#include <sglMaterial.hpp>
Inheritance diagram for sglMaterial::
Public Types | |
enum | SideEnum { eFRONT = GL_FRONT, eBACK = GL_BACK, eFRONT_AND_BACK = GL_FRONT_AND_BACK } |
enum | ColorModeEnum { eOFF = 0, eAMBIENT = GL_AMBIENT, eDIFFUSE = GL_DIFFUSE, eSPECULAR = GL_SPECULAR, eAMBIENT_AND_DIFFUSE = GL_AMBIENT_AND_DIFFUSE, eEMISSION = GL_EMISSION } |
Public Methods | |
sglMaterial () | |
virtual | ~sglMaterial () |
void | setAmbient (float r, float g, float b, SideEnum side=eFRONT_AND_BACK) |
void | getFrontAmbient (float &r, float &g, float &b) const |
void | getBackAmbient (float &r, float &g, float &b) const |
void | setDiffuse (float r, float g, float b, SideEnum side=eFRONT_AND_BACK) |
void | getFrontDiffuse (float &r, float &g, float &b) const |
void | getBackDiffuse (float &r, float &g, float &b) const |
void | setSpecular (float r, float g, float b, SideEnum side=eFRONT_AND_BACK) |
void | getFrontSpecular (float &r, float &g, float &b) const |
void | getBackSpecular (float &r, float &g, float &b) const |
void | setEmission (float r, float g, float b, SideEnum side=eFRONT_AND_BACK) |
void | getFrontEmission (float &r, float &g, float &b) const |
void | getBackEmission (float &r, float &g, float &b) const |
void | setAlpha (float alpha, SideEnum side=eFRONT_AND_BACK) |
float | getFrontAlpha () const |
float | getBackAlpha () const |
void | setShininess (float shininess, SideEnum side=eFRONT_AND_BACK) |
float | getFrontShininess () const |
float | getBackShininess () const |
void | setColorMaterial (SideEnum side, ColorModeEnum mode) |
void | getColorMaterial (SideEnum &side, ColorModeEnum &mode) const |
void | apply (sglCurrState *curr_state) const |
virtual bool | getSorted () const |
virtual void | printInfo (ostream &ostrm, const char *indent_string) const |
Using color material enables one of the color components to track the vertex color of the geometry (if present) rather than a constant color specified by the components described above. To do this, the sglMaterial::setColorMaterial(..) member function is called with one of the SideEnum and ColorModeEnum tokens.
The default constructor initializes the object to match the OpenGL defaults for materials as follows (for both front and back):
Example:
sglMaterial *statelet = new sglMaterial; statelet->setAmbient(0.f, 0.f, 0.f); // FRONT_AND_BACK statelet->setAmbient(0.f, 0.f, 0.f, sglMaterial::eBACK); // BACK only statelet->setDiffuse(1.f, 1.f, 1.f); statelet->setSpecular(1.f, 1.f, 1.f); statelet->setAlpha(1.0f); statelet->setShininess(64.0f); // overrides the call to setAmbient and setDiffuse for the front side statelet->setColorMaterial(sglMaterial::eFRONT, sglMaterial::eAMBIENT_AND_DIFFUSE);
Definition at line 82 of file sglMaterial.hpp.
|
Tokens to define which face a parameter is to be applied to.
Definition at line 86 of file sglMaterial.hpp. |
|
Color component tokens used for color material specification.
Definition at line 99 of file sglMaterial.hpp. |
|
Default constructor. Initializes to the default OpenGL material parameters. |
|
virtual destructor.
|
|
Set the ambient color components
|
|
Query the ambient color components for the front face.
|
|
Query the ambient color components for the back face.
|
|
Set the diffuse color components
|
|
Query the diffuse color components for the front face.
|
|
Query the diffuse color components for the back face.
|
|
Set the specular color components
|
|
Query the specular color components for the front face.
|
|
Query the specular color components for the back face.
|
|
Set the emissive color components
|
|
Query the emissive color components for the front face.
|
|
Query the emissive color components for the back face.
|
|
Set the alpha component (opacity) of the material.
|
|
Query the alpha value for the front face.
Definition at line 236 of file sglMaterial.hpp. |
|
Query the alpha value for the back face.
Definition at line 241 of file sglMaterial.hpp. |
|
Set the shininess factor, the specular exponent (used with specular color component to define the specular highlights), for either side.
|
|
Query the shininess (specular exponent) of the front face material.
Definition at line 255 of file sglMaterial.hpp. |
|
Query the shininess (specular exponent) of the back face material.
Definition at line 260 of file sglMaterial.hpp. |
|
Specify the color material mode for a given side.
|
|
Query the current color material state.
Definition at line 281 of file sglMaterial.hpp. |
|
Apply this state change to the current rendering state.
Reimplemented from sglStatelet. |
|
Query the sorting mode for this statelet.
Reimplemented from sglStatelet. Definition at line 288 of file sglMaterial.hpp. |
|
Output the state of this node to the specified ostream.
Reimplemented from sglStatelet. |