reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

material parameter properties that can be applied to vertices in the OpenGL lighting model used in determining both the intensity and color of reflected light based on the lighting model in use and if the vertices are on a front or back sided face More...

#include <ofMaterialBaseTypes.h>

Inheritance diagram for ofBaseMaterial:
ofMaterial

Public Member Functions

virtual ~ofBaseMaterial ()
 
virtual ofFloatColor getDiffuseColor () const =0
 
virtual ofFloatColor getAmbientColor () const =0
 
virtual ofFloatColor getSpecularColor () const =0
 
virtual ofFloatColor getEmissiveColor () const =0
 
virtual float getShininess () const =0
 
virtual void begin () const =0
 begin using this material's properties
 
virtual void end () const =0
 end using this material's properties
 
virtual const ofShadergetShader (int textureTarget, bool geometryHasColor, ofGLProgrammableRenderer &renderer) const =0
 create and return a shader used to implement the materials effect for a given renderer
 
virtual void setCustomShader (std::shared_ptr< ofShader > aCustomShader)=0
 set a custom shader controlled by the user.
 
virtual void uploadMatrices (const ofShader &shader, ofGLProgrammableRenderer &renderer) const
 upload the given renderer's normal matrix to the material shader
 
virtual void updateMaterial (const ofShader &shader, ofGLProgrammableRenderer &renderer) const =0
 update the material properties to the material shader
 
virtual void updateLights (const ofShader &shader, ofGLProgrammableRenderer &renderer) const =0
 update the given renderer's lights to the material shader
 
virtual void updateShadows (const ofShader &shader, ofGLProgrammableRenderer &renderer) const =0
 update the given renderer's shadows to the material shader
 
virtual void updateEnvironmentMaps (const ofShader &shader, ofGLProgrammableRenderer &renderer) const =0
 update the given renderer's environment maps / cube maps to the material shader
 
virtual bool isBound () const
 when begin() is called, the material is set to bound by the renderer.\nSet to unbound via renderer when end() is called.
 

Protected Member Functions

virtual void bind (ofGLProgrammableRenderer &renderer) const
 set to bound. Later used if certain properties are set so the shader can be updated without calling end(), set var and then begin() again.
 
virtual void unbind (ofGLProgrammableRenderer &renderer) const
 unbind the shader.
 

Protected Attributes

bool mBound = false
 

Friends

class ofGLProgrammableRenderer
 

Detailed Description

material parameter properties that can be applied to vertices in the OpenGL lighting model used in determining both the intensity and color of reflected light based on the lighting model in use and if the vertices are on a front or back sided face

Constructor & Destructor Documentation

◆ ~ofBaseMaterial()

virtual ofBaseMaterial::~ofBaseMaterial ( )
inlinevirtual

Member Function Documentation

◆ begin()

virtual void ofBaseMaterial::begin ( ) const
pure virtual

begin using this material's properties

Implemented in ofMaterial.

◆ bind()

virtual void ofBaseMaterial::bind ( ofGLProgrammableRenderer renderer) const
inlineprotectedvirtual

set to bound. Later used if certain properties are set so the shader can be updated without calling end(), set var and then begin() again.

◆ end()

virtual void ofBaseMaterial::end ( ) const
pure virtual

end using this material's properties

Implemented in ofMaterial.

◆ getAmbientColor()

virtual ofFloatColor ofBaseMaterial::getAmbientColor ( ) const
pure virtual
Returns
the ambient reflectance

Implemented in ofMaterial.

◆ getDiffuseColor()

virtual ofFloatColor ofBaseMaterial::getDiffuseColor ( ) const
pure virtual
Returns
the diffuse reflectance

Implemented in ofMaterial.

◆ getEmissiveColor()

virtual ofFloatColor ofBaseMaterial::getEmissiveColor ( ) const
pure virtual
Returns
the emitted light intensity

Implemented in ofMaterial.

◆ getShader()

virtual const ofShader & ofBaseMaterial::getShader ( int  textureTarget,
bool  geometryHasColor,
ofGLProgrammableRenderer renderer 
) const
pure virtual

create and return a shader used to implement the materials effect for a given renderer

Parameters
textureTargetan implementation-specific value to specify the type of shader to use
rendererprogrammable renderer instance to create the material shader for

◆ getShininess()

virtual float ofBaseMaterial::getShininess ( ) const
pure virtual
Returns
the specular exponent

Implemented in ofMaterial.

◆ getSpecularColor()

virtual ofFloatColor ofBaseMaterial::getSpecularColor ( ) const
pure virtual
Returns
the specular reflectance

Implemented in ofMaterial.

◆ isBound()

bool ofBaseMaterial::isBound ( ) const
virtual

when begin() is called, the material is set to bound by the renderer.\nSet to unbound via renderer when end() is called.

Returns
is the shader bound to a renderer.

◆ setCustomShader()

virtual void ofBaseMaterial::setCustomShader ( std::shared_ptr< ofShader aCustomShader)
pure virtual

set a custom shader controlled by the user.

Parameters
aCustomShaderthe material shader, created and maintained by the user

Implemented in ofMaterial.

◆ unbind()

virtual void ofBaseMaterial::unbind ( ofGLProgrammableRenderer renderer) const
inlineprotectedvirtual

unbind the shader.

Reimplemented in ofMaterial.

◆ updateEnvironmentMaps()

virtual void ofBaseMaterial::updateEnvironmentMaps ( const ofShader shader,
ofGLProgrammableRenderer renderer 
) const
pure virtual

update the given renderer's environment maps / cube maps to the material shader

Parameters
shaderthe material shader, created by getShader()
rendererprogrammable renderer instance that uses the material shader

◆ updateLights()

virtual void ofBaseMaterial::updateLights ( const ofShader shader,
ofGLProgrammableRenderer renderer 
) const
pure virtual

update the given renderer's lights to the material shader

Parameters
shaderthe material shader, created by getShader()
rendererprogrammable renderer instance that uses the material shader

◆ updateMaterial()

virtual void ofBaseMaterial::updateMaterial ( const ofShader shader,
ofGLProgrammableRenderer renderer 
) const
pure virtual

update the material properties to the material shader

Parameters
shaderthe material shader, created by getShader()
rendererprogrammable renderer instance that uses the material shader

◆ updateShadows()

virtual void ofBaseMaterial::updateShadows ( const ofShader shader,
ofGLProgrammableRenderer renderer 
) const
pure virtual

update the given renderer's shadows to the material shader

Parameters
shaderthe material shader, created by getShader()
rendererprogrammable renderer instance that uses the material shader

◆ uploadMatrices()

void ofBaseMaterial::uploadMatrices ( const ofShader shader,
ofGLProgrammableRenderer renderer 
) const
virtual

upload the given renderer's normal matrix to the material shader

Parameters
shaderthe material shader, created by getShader()
rendererprogrammable renderer instance that uses the material shader

Reimplemented in ofMaterial.

Friends And Related Symbol Documentation

◆ ofGLProgrammableRenderer

friend class ofGLProgrammableRenderer
friend

Member Data Documentation

◆ mBound

bool ofBaseMaterial::mBound = false
mutableprotected

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