# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Attributes

# vl::Material Class Reference

RenderState wrapping the OpenGL function glMaterial() and glColorMaterial(), see also http://www.opengl.org/sdk/docs/man/xhtml/glMaterial.xml and http://www.opengl.org/sdk/docs/man/xhtml/glColorMaterial.xml for more information. More...

`#include <Shader.hpp>`

Inheritance diagram for vl::Material:

List of all members.

## Public Member Functions

| Material ()
virtual ERenderState | type () const
virtual void | apply (int index, const Camera *, OpenGLContext *ctx) const
| The parameter cameara is NULL if we are disabling the state, non-NULL if we are enabling it.
void | multiplyTransparency (float alpha)
float | getMinimumAlpha () const
void | setTransparency (float alpha)
void | setFrontTransparency (float alpha)
void | setBackTransparency (float alpha)
void | setFrontFlatColor (const fvec4 &color)
void | setBackFlatColor (const fvec4 &color)
void | setFlatColor (const fvec4 &color)
void | setAmbient (fvec4 color)
void | setDiffuse (fvec4 color)
void | setSpecular (fvec4 color)
void | setEmission (fvec4 color)
void | setShininess (float shininess)
void | setFrontAmbient (fvec4 color)
void | setFrontDiffuse (fvec4 color)
void | setFrontSpecular (fvec4 color)
void | setFrontEmission (fvec4 color)
void | setFrontShininess (float shininess)
fvec4 | frontAmbient () const
fvec4 | frontDiffuse () const
fvec4 | frontSpecular () const
fvec4 | frontEmission () const
float | frontShininess () const
void | setBackAmbient (fvec4 color)
void | setBackDiffuse (fvec4 color)
void | setBackSpecular (fvec4 color)
void | setBackEmission (fvec4 color)
void | setBackShininess (float shininess)
fvec4 | backAmbient () const
fvec4 | backDiffuse () const
fvec4 | backSpecular () const
fvec4 | backEmission () const
float | backShininess () const
void | setColorMaterial (EPolygonFace face, EColorMaterial color)
EPolygonFace | colorMaterialFace () const
EColorMaterial | colorMaterial () const
void | setColorMaterialEnabled (bool enabled)
bool | colorMaterialEnabled () const
virtual ref< RenderState > | clone () const

## Protected Attributes

fvec4 | mFrontAmbient
fvec4 | mFrontDiffuse
fvec4 | mFrontSpecular
fvec4 | mFrontEmission
fvec4 | mBackAmbient
fvec4 | mBackDiffuse
fvec4 | mBackSpecular
fvec4 | mBackEmission
float | mBackShininess
float | mFrontShininess
EPolygonFace | mColorMaterialFace
EColorMaterial | mColorMaterial
bool | mColorMaterialEnabled

## Detailed Description

RenderState wrapping the OpenGL function glMaterial() and glColorMaterial(), see also http://www.opengl.org/sdk/docs/man/xhtml/glMaterial.xml and http://www.opengl.org/sdk/docs/man/xhtml/glColorMaterial.xml for more information.

Under OpenGL ES 1.x the front material properties are used for both front and back faces.

See also:
  Shader, Effect, Actor, vl::EN_LIGHTING

Definition at line 774 of file Shader.hpp.

## Constructor & Destructor Documentation

Material::Material | ( | ) |

Definition at line 333 of file Shader.cpp.

References vl::CM_AMBIENT_AND_DIFFUSE, mBackAmbient, mBackDiffuse, mBackEmission, mBackShininess, mBackSpecular, mColorMaterial, mColorMaterialEnabled, mColorMaterialFace, mFrontAmbient, mFrontDiffuse, mFrontEmission, mFrontShininess, mFrontSpecular, vl::PF_FRONT_AND_BACK, and VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

virtual ERenderState vl::Material::type | ( | ) | const`[inline, virtual]`

Reimplemented from vl::RenderState.

Definition at line 780 of file Shader.hpp.

References vl::RS_Material.

void Material::apply | ( | int | index,
|  | const Camera * | camera,
|  | OpenGLContext * | ctx
| ) |  | const`[virtual]`

The parameter cameara is NULL if we are disabling the state, non-NULL if we are enabling it.

Implements vl::RenderState.

Definition at line 427 of file Shader.cpp.

References vl::CM_AMBIENT_AND_DIFFUSE, colorMaterial(), colorMaterialFace(), vl::Log::error(), mBackAmbient, mBackDiffuse, mBackEmission, mBackShininess, mBackSpecular, mColorMaterialEnabled, mFrontAmbient, mFrontDiffuse, mFrontEmission, mFrontShininess, mFrontSpecular, vl::Vector4< T_Scalar >::ptr(), VL_CHECK_OGL, and VL_TRAP.

void Material::multiplyTransparency | ( | float | alpha ) |

Definition at line 365 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a(), mBackAmbient, mBackDiffuse, mBackEmission, mBackSpecular, mFrontAmbient, mFrontDiffuse, mFrontEmission, and mFrontSpecular.

float Material::getMinimumAlpha | ( | ) | const

Definition at line 353 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a(), mBackAmbient, mBackDiffuse, mBackEmission, mBackSpecular, mFrontAmbient, mFrontDiffuse, mFrontEmission, mFrontSpecular, and vl::min().

void Material::setTransparency | ( | float | alpha ) |

Definition at line 377 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a(), mBackAmbient, mBackDiffuse, mBackEmission, mBackSpecular, mFrontAmbient, mFrontDiffuse, mFrontEmission, and mFrontSpecular.

void Material::setFrontTransparency | ( | float | alpha ) |

Definition at line 385 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a(), mFrontAmbient, mFrontDiffuse, mFrontEmission, and mFrontSpecular.

Referenced by setFrontFlatColor().

void Material::setBackTransparency | ( | float | alpha ) |

Definition at line 393 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a(), mBackAmbient, mBackDiffuse, mBackEmission, and mBackSpecular.

Referenced by setBackFlatColor().

void Material::setFrontFlatColor | ( | const fvec4 & | color ) |

Definition at line 401 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a(), mFrontAmbient, mFrontDiffuse, mFrontEmission, mFrontShininess, mFrontSpecular, and setFrontTransparency().

Referenced by setFlatColor().

void Material::setBackFlatColor | ( | const fvec4 & | color ) |

Definition at line 411 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a(), mBackAmbient, mBackDiffuse, mBackEmission, mBackShininess, mBackSpecular, and setBackTransparency().

Referenced by setFlatColor().

void Material::setFlatColor | ( | const fvec4 & | color ) |

Definition at line 421 of file Shader.cpp.

References setBackFlatColor(), and setFrontFlatColor().

void vl::Material::setAmbient | ( | fvec4 | color ) | `[inline]`

Definition at line 793 of file Shader.hpp.

void vl::Material::setDiffuse | ( | fvec4 | color ) | `[inline]`

Definition at line 794 of file Shader.hpp.

void vl::Material::setSpecular | ( | fvec4 | color ) | `[inline]`

Definition at line 795 of file Shader.hpp.

void vl::Material::setEmission | ( | fvec4 | color ) | `[inline]`

Definition at line 796 of file Shader.hpp.

void vl::Material::setShininess | ( | float | shininess ) | `[inline]`

Definition at line 797 of file Shader.hpp.

void vl::Material::setFrontAmbient | ( | fvec4 | color ) | `[inline]`

Definition at line 799 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setFrontDiffuse | ( | fvec4 | color ) | `[inline]`

Definition at line 800 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setFrontSpecular | ( | fvec4 | color ) | `[inline]`

Definition at line 801 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setFrontEmission | ( | fvec4 | color ) | `[inline]`

Definition at line 802 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setFrontShininess | ( | float | shininess ) | `[inline]`

Definition at line 803 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

fvec4 vl::Material::frontAmbient | ( | ) | const`[inline]`

Definition at line 805 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

fvec4 vl::Material::frontDiffuse | ( | ) | const`[inline]`

Definition at line 806 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

fvec4 vl::Material::frontSpecular | ( | ) | const`[inline]`

Definition at line 807 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

fvec4 vl::Material::frontEmission | ( | ) | const`[inline]`

Definition at line 808 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

float vl::Material::frontShininess | ( | ) | const`[inline]`

Definition at line 809 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

void vl::Material::setBackAmbient | ( | fvec4 | color ) | `[inline]`

Definition at line 811 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setBackDiffuse | ( | fvec4 | color ) | `[inline]`

Definition at line 812 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setBackSpecular | ( | fvec4 | color ) | `[inline]`

Definition at line 813 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setBackEmission | ( | fvec4 | color ) | `[inline]`

Definition at line 814 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

void vl::Material::setBackShininess | ( | float | shininess ) | `[inline]`

Definition at line 815 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

fvec4 vl::Material::backAmbient | ( | ) | const`[inline]`

Definition at line 817 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

fvec4 vl::Material::backDiffuse | ( | ) | const`[inline]`

Definition at line 818 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

fvec4 vl::Material::backSpecular | ( | ) | const`[inline]`

Definition at line 819 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

fvec4 vl::Material::backEmission | ( | ) | const`[inline]`

Definition at line 820 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

float vl::Material::backShininess | ( | ) | const`[inline]`

Definition at line 821 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

void vl::Material::setColorMaterial | ( | EPolygonFace | face,
|  | EColorMaterial | color
| ) |  | `[inline]`

Definition at line 825 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

EPolygonFace vl::Material::colorMaterialFace | ( | ) | const`[inline]`

Definition at line 826 of file Shader.hpp.

Referenced by apply(), and vl::VLXClassWrapper_Material::exportMaterial().

EColorMaterial vl::Material::colorMaterial | ( | ) | const`[inline]`

Definition at line 827 of file Shader.hpp.

Referenced by apply(), and vl::VLXClassWrapper_Material::exportMaterial().

void vl::Material::setColorMaterialEnabled | ( | bool | enabled ) | `[inline]`

Definition at line 828 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::importMaterial().

bool vl::Material::colorMaterialEnabled | ( | ) | const`[inline]`

Definition at line 829 of file Shader.hpp.

Referenced by vl::VLXClassWrapper_Material::exportMaterial().

virtual ref<RenderState> vl::Material::clone | ( | ) | const`[inline, virtual]`

Implements vl::RenderState.

Definition at line 831 of file Shader.hpp.

## Member Data Documentation

fvec4 vl::Material::mFrontAmbient`[protected]`

Definition at line 839 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setFrontFlatColor(), setFrontTransparency(), and setTransparency().

fvec4 vl::Material::mFrontDiffuse`[protected]`

Definition at line 840 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setFrontFlatColor(), setFrontTransparency(), and setTransparency().

fvec4 vl::Material::mFrontSpecular`[protected]`

Definition at line 841 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setFrontFlatColor(), setFrontTransparency(), and setTransparency().

fvec4 vl::Material::mFrontEmission`[protected]`

Definition at line 842 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setFrontFlatColor(), setFrontTransparency(), and setTransparency().

fvec4 vl::Material::mBackAmbient`[protected]`

Definition at line 843 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setBackFlatColor(), setBackTransparency(), and setTransparency().

fvec4 vl::Material::mBackDiffuse`[protected]`

Definition at line 844 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setBackFlatColor(), setBackTransparency(), and setTransparency().

fvec4 vl::Material::mBackSpecular`[protected]`

Definition at line 845 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setBackFlatColor(), setBackTransparency(), and setTransparency().

fvec4 vl::Material::mBackEmission`[protected]`

Definition at line 846 of file Shader.hpp.

Referenced by apply(), getMinimumAlpha(), Material(), multiplyTransparency(), setBackFlatColor(), setBackTransparency(), and setTransparency().

float vl::Material::mBackShininess`[protected]`

Definition at line 847 of file Shader.hpp.

Referenced by apply(), Material(), and setBackFlatColor().

float vl::Material::mFrontShininess`[protected]`

Definition at line 848 of file Shader.hpp.

Referenced by apply(), Material(), and setFrontFlatColor().

EPolygonFace vl::Material::mColorMaterialFace`[protected]`

Definition at line 850 of file Shader.hpp.

Referenced by Material().

EColorMaterial vl::Material::mColorMaterial`[protected]`

Definition at line 851 of file Shader.hpp.

Referenced by Material().

bool vl::Material::mColorMaterialEnabled`[protected]`

Definition at line 852 of file Shader.hpp.

Referenced by apply(), and Material().

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Shader.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/Shader.cpp

Visualization Library v2011.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:51.
Permission is granted to use this page to write and publish articles regarding Visualization Library.