Visualization Library 2.1.0

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

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | List of all members
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:

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. More...
 
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 (const fvec4 &color)
 
void setDiffuse (const fvec4 &color)
 
void setSpecular (const fvec4 &color)
 
void setEmission (const fvec4 &color)
 
void setShininess (float shininess)
 
void setFrontAmbient (const fvec4 &color)
 
void setFrontDiffuse (const fvec4 &color)
 
void setFrontSpecular (const fvec4 &color)
 
void setFrontEmission (const fvec4 &color)
 
void setFrontShininess (float shininess)
 
const fvec4frontAmbient () const
 
const fvec4frontDiffuse () const
 
const fvec4frontSpecular () const
 
const fvec4frontEmission () const
 
float frontShininess () const
 
void setBackAmbient (const fvec4 &color)
 
void setBackDiffuse (const fvec4 &color)
 
void setBackSpecular (const fvec4 &color)
 
void setBackEmission (const fvec4 &color)
 
void setBackShininess (float shininess)
 
const fvec4backAmbient () const
 
const fvec4backDiffuse () const
 
const fvec4backSpecular () const
 
const fvec4backEmission () 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< RenderStateclone () const
 
- Public Member Functions inherited from vl::RenderStateNonIndexed
 RenderStateNonIndexed ()
 
- Public Member Functions inherited from vl::RenderState
 RenderState ()
 
- Public Member Functions inherited from vl::Object
 Object ()
 Constructor. More...
 
 Object (const Object &other)
 Copy constructor: copies the name, ref count mutex and user data. More...
 
Objectoperator= (const Object &other)
 Copy operator: copies the object's name, ref count mutex and user data. More...
 
const std::string & objectName () const
 The name of the object, by default set to the object's class name. More...
 
void setObjectName (const char *name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setObjectName (const std::string &name)
 The name of the object, by default set to the object's class name in debug builds. More...
 
void setRefCountMutex (IMutex *mutex)
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () const
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
int referenceCount () const
 Returns the number of references of an object. More...
 
void incReference () const
 Increments the reference count of an object. More...
 
void decReference ()
 Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More...
 
void setAutomaticDelete (bool autodel_on)
 If set to true the Object is deleted when its reference count reaches 0. More...
 
bool automaticDelete () const
 If set to true the Object is deleted when its reference count reaches 0. More...
 
template<class T >
T * as ()
 Casts an Object to the specified class. More...
 
template<class T >
const T * as () const
 Casts an Object to the specified class. More...
 

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
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

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::Material ( )

Definition at line 333 of file Shader.cpp.

References vl::CM_AMBIENT_AND_DIFFUSE, and vl::PF_FRONT_AND_BACK.

Member Function Documentation

◆ apply()

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, vl::Log::error(), VL_CHECK_OGL, and VL_TRAP.

◆ backAmbient()

const fvec4& vl::Material::backAmbient ( ) const
inline

Definition at line 817 of file Shader.hpp.

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

◆ backDiffuse()

const fvec4& vl::Material::backDiffuse ( ) const
inline

Definition at line 818 of file Shader.hpp.

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

◆ backEmission()

const fvec4& vl::Material::backEmission ( ) const
inline

Definition at line 820 of file Shader.hpp.

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

◆ backShininess()

float vl::Material::backShininess ( ) const
inline

Definition at line 821 of file Shader.hpp.

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

◆ backSpecular()

const fvec4& vl::Material::backSpecular ( ) const
inline

Definition at line 819 of file Shader.hpp.

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

◆ clone()

virtual ref<RenderState> vl::Material::clone ( ) const
inlinevirtual

Implements vl::RenderState.

Definition at line 831 of file Shader.hpp.

◆ colorMaterial()

EColorMaterial vl::Material::colorMaterial ( ) const
inline

Definition at line 827 of file Shader.hpp.

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

◆ colorMaterialEnabled()

bool vl::Material::colorMaterialEnabled ( ) const
inline

Definition at line 829 of file Shader.hpp.

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

◆ colorMaterialFace()

EPolygonFace vl::Material::colorMaterialFace ( ) const
inline

Definition at line 826 of file Shader.hpp.

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

◆ frontAmbient()

const fvec4& vl::Material::frontAmbient ( ) const
inline

Definition at line 805 of file Shader.hpp.

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

◆ frontDiffuse()

const fvec4& vl::Material::frontDiffuse ( ) const
inline

Definition at line 806 of file Shader.hpp.

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

◆ frontEmission()

const fvec4& vl::Material::frontEmission ( ) const
inline

Definition at line 808 of file Shader.hpp.

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

◆ frontShininess()

float vl::Material::frontShininess ( ) const
inline

Definition at line 809 of file Shader.hpp.

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

◆ frontSpecular()

const fvec4& vl::Material::frontSpecular ( ) const
inline

Definition at line 807 of file Shader.hpp.

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

◆ getMinimumAlpha()

float Material::getMinimumAlpha ( ) const

Definition at line 353 of file Shader.cpp.

References vl::min().

◆ multiplyTransparency()

void Material::multiplyTransparency ( float  alpha)

Definition at line 365 of file Shader.cpp.

Referenced by vl::DaeLoader::setup_vl_Effect().

◆ setAmbient()

void vl::Material::setAmbient ( const fvec4 color)
inline

◆ setBackAmbient()

void vl::Material::setBackAmbient ( const fvec4 color)
inline

Definition at line 811 of file Shader.hpp.

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

◆ setBackDiffuse()

void vl::Material::setBackDiffuse ( const fvec4 color)
inline

Definition at line 812 of file Shader.hpp.

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

◆ setBackEmission()

void vl::Material::setBackEmission ( const fvec4 color)
inline

Definition at line 814 of file Shader.hpp.

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

◆ setBackFlatColor()

void Material::setBackFlatColor ( const fvec4 color)

Definition at line 411 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a().

◆ setBackShininess()

void vl::Material::setBackShininess ( float  shininess)
inline

Definition at line 815 of file Shader.hpp.

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

◆ setBackSpecular()

void vl::Material::setBackSpecular ( const fvec4 color)
inline

Definition at line 813 of file Shader.hpp.

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

◆ setBackTransparency()

void Material::setBackTransparency ( float  alpha)

Definition at line 393 of file Shader.cpp.

◆ setColorMaterial()

void vl::Material::setColorMaterial ( EPolygonFace  face,
EColorMaterial  color 
)
inline

Definition at line 825 of file Shader.hpp.

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

◆ setColorMaterialEnabled()

void vl::Material::setColorMaterialEnabled ( bool  enabled)
inline

◆ setDiffuse()

void vl::Material::setDiffuse ( const fvec4 color)
inline

◆ setEmission()

void vl::Material::setEmission ( const fvec4 color)
inline

◆ setFlatColor()

void Material::setFlatColor ( const fvec4 color)

Definition at line 421 of file Shader.cpp.

Referenced by vl::VectorGraphics::popScissor().

◆ setFrontAmbient()

void vl::Material::setFrontAmbient ( const fvec4 color)
inline

Definition at line 799 of file Shader.hpp.

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

◆ setFrontDiffuse()

void vl::Material::setFrontDiffuse ( const fvec4 color)
inline

Definition at line 800 of file Shader.hpp.

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

◆ setFrontEmission()

void vl::Material::setFrontEmission ( const fvec4 color)
inline

Definition at line 802 of file Shader.hpp.

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

◆ setFrontFlatColor()

void Material::setFrontFlatColor ( const fvec4 color)

Definition at line 401 of file Shader.cpp.

References vl::Vector4< T_Scalar >::a().

◆ setFrontShininess()

void vl::Material::setFrontShininess ( float  shininess)
inline

Definition at line 803 of file Shader.hpp.

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

◆ setFrontSpecular()

void vl::Material::setFrontSpecular ( const fvec4 color)
inline

Definition at line 801 of file Shader.hpp.

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

◆ setFrontTransparency()

void Material::setFrontTransparency ( float  alpha)

Definition at line 385 of file Shader.cpp.

◆ setShininess()

void vl::Material::setShininess ( float  shininess)
inline

◆ setSpecular()

void vl::Material::setSpecular ( const fvec4 color)
inline

◆ setTransparency()

void Material::setTransparency ( float  alpha)

Definition at line 377 of file Shader.cpp.

Referenced by vl::loadAC3D().

◆ type()

virtual ERenderState vl::Material::type ( ) const
inlinevirtual

Reimplemented from vl::RenderState.

Definition at line 780 of file Shader.hpp.

References vl::RS_Material.

Member Data Documentation

◆ mBackAmbient

fvec4 vl::Material::mBackAmbient
protected

Definition at line 843 of file Shader.hpp.

◆ mBackDiffuse

fvec4 vl::Material::mBackDiffuse
protected

Definition at line 844 of file Shader.hpp.

◆ mBackEmission

fvec4 vl::Material::mBackEmission
protected

Definition at line 846 of file Shader.hpp.

◆ mBackShininess

float vl::Material::mBackShininess
protected

Definition at line 847 of file Shader.hpp.

◆ mBackSpecular

fvec4 vl::Material::mBackSpecular
protected

Definition at line 845 of file Shader.hpp.

◆ mColorMaterial

EColorMaterial vl::Material::mColorMaterial
protected

Definition at line 851 of file Shader.hpp.

◆ mColorMaterialEnabled

bool vl::Material::mColorMaterialEnabled
protected

Definition at line 852 of file Shader.hpp.

◆ mColorMaterialFace

EPolygonFace vl::Material::mColorMaterialFace
protected

Definition at line 850 of file Shader.hpp.

◆ mFrontAmbient

fvec4 vl::Material::mFrontAmbient
protected

Definition at line 839 of file Shader.hpp.

◆ mFrontDiffuse

fvec4 vl::Material::mFrontDiffuse
protected

Definition at line 840 of file Shader.hpp.

◆ mFrontEmission

fvec4 vl::Material::mFrontEmission
protected

Definition at line 842 of file Shader.hpp.

◆ mFrontShininess

float vl::Material::mFrontShininess
protected

Definition at line 848 of file Shader.hpp.

◆ mFrontSpecular

fvec4 vl::Material::mFrontSpecular
protected

Definition at line 841 of file Shader.hpp.


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