Radium Engine  1.5.0
Ra::Engine::Data::Material Class Reference

#include <Engine/Data/Material.hpp>

+ Inheritance diagram for Ra::Engine::Data::Material:
+ Collaboration diagram for Ra::Engine::Data::Material:

Public Types

enum class  MaterialAspect { MAT_OPAQUE , MAT_TRANSPARENT , MAT_DENSITY }
 

Public Member Functions

const std::string & getInstanceName () const
 
const std::string & getMaterialName () const
 
void setMaterialAspect (const MaterialAspect &aspect)
 
const MaterialAspectgetMaterialAspect () const
 
virtual bool isTransparent () const
 
std::list< std::string > getPropertyList () const override
 
virtual void setColoredByVertexAttrib (bool)
 Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry. More...
 
virtual bool isColoredByVertexAttrib () const
 Indicates if the material takes the VERTEX_COLOR attribute into account.
 
void needUpdate ()
 
- Public Member Functions inherited from Ra::Engine::Data::ShaderParameterProvider
virtual RenderParametersgetParameters ()
 
virtual const RenderParametersgetParameters () const
 
virtual void updateGL ()=0
 Update the OpenGL states used by the ShaderParameterProvider. These state could be the ones from an associated material (textures, precomputed tables or whatever data associated to the material) or some parameters that are specific to the provider semantic.
 
virtual void updateFromParameters ()
 Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParameters.
 

Protected Member Functions

 Material (const std::string &instanceName, const std::string &materialName, MaterialAspect aspect=MaterialAspect::MAT_OPAQUE)
 
void setMaterialName (std::string newName)
 

Protected Attributes

std::string m_instanceName {}
 Material instance name.
 
MaterialAspect m_aspect { MaterialAspect::MAT_OPAQUE }
 Material aspect.
 
bool m_isDirty { true }
 

Detailed Description

Base class for materials/ Do not assume a given Material representation but only make the difference between opaque and transparent materials.

Definition at line 23 of file Material.hpp.

Member Enumeration Documentation

◆ MaterialAspect

Identifies the type of the material. MAT_OPAQUE and MAT_TRANSPARENT implements the GLSL "surfacic" BSDF interface MAT_DENSITY implements the GLSL "volumetric" interface

Enumerator
MAT_TRANSPARENT 

<- The material is either OPAQUE or TRANSPARENT

MAT_DENSITY 

<- The material is TRANSPARENT

<- The material implements the VOLUME interface

Definition at line 31 of file Material.hpp.

Constructor & Destructor Documentation

◆ Material()

Ra::Engine::Data::Material::Material ( const std::string &  instanceName,
const std::string &  materialName,
MaterialAspect  aspect = MaterialAspect::MAT_OPAQUE 
)
explicitprotected

Creates a named material with the given aspect

Parameters
instanceName
materialName
aspect

Definition at line 6 of file Material.cpp.

Member Function Documentation

◆ getInstanceName()

const std::string& Ra::Engine::Data::Material::getInstanceName ( ) const
inline
Returns
the name of the material instance

Definition at line 62 of file Material.hpp.

◆ getMaterialAspect()

const MaterialAspect& Ra::Engine::Data::Material::getMaterialAspect ( ) const
inline

Get the aspect (MAT_OPAQUE or MAT_TRANSPARENT) of the material.

Returns
the current aspect of the Material

Definition at line 79 of file Material.hpp.

◆ getMaterialName()

const std::string& Ra::Engine::Data::Material::getMaterialName ( ) const
inline
Returns
the name of the material, can be used a UUID
Note
the material name is expected to be used to define the ShaderConfiguration name

Definition at line 68 of file Material.hpp.

◆ getPropertyList()

std::list< std::string > Ra::Engine::Data::Material::getPropertyList ( ) const
overridevirtual

Get the list of properties the material migh use in a shader. each property will be added to the shader used for rendering this material under the form "#define theProperty". Shaders that support the given property could then fully render the material. Others migh render the meterial eroneously.

The default implementation returns an empty list.

Todo:

: Validate this proposal

: make the property list modifiable as well

Reimplemented from Ra::Engine::Data::ShaderParameterProvider.

Definition at line 18 of file Material.cpp.

+ Here is the call graph for this function:

◆ isTransparent()

bool Ra::Engine::Data::Material::isTransparent ( ) const
virtual

Test if material is transperent.

Returns
true if the material is transparent

Reimplemented in Ra::Engine::Data::VolumetricMaterial, and Ra::Engine::Data::BlinnPhongMaterial.

Definition at line 14 of file Material.cpp.

◆ needUpdate()

void Ra::Engine::Data::Material::needUpdate ( )
inline

Mark the Material as needing update before the next OpenGL call

Definition at line 116 of file Material.hpp.

◆ setColoredByVertexAttrib()

virtual void Ra::Engine::Data::Material::setColoredByVertexAttrib ( bool  )
inlinevirtual

Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry.

Parameters
stateactivate (true) or deactivate (false) VERTEX_COLOR attribute usage

Any material that support per-vertex color parameterization should implement this method accordingly

Reimplemented in Ra::Engine::Data::SimpleMaterial, and Ra::Engine::Data::BlinnPhongMaterial.

Definition at line 106 of file Material.hpp.

◆ setMaterialAspect()

void Ra::Engine::Data::Material::setMaterialAspect ( const MaterialAspect aspect)
inline

set the aspect (MAT_OPAQUE or MAT_TRANSPARENT) of the material.

Parameters
aspect

Definition at line 73 of file Material.hpp.

◆ setMaterialName()

void Ra::Engine::Data::Material::setMaterialName ( std::string  newName)
inlineprotected

Change the Material Name

Note
This method should be used carefully as the name is a key for render technique factory

Definition at line 54 of file Material.hpp.

Member Data Documentation

◆ m_isDirty

bool Ra::Engine::Data::Material::m_isDirty { true }
protected

Dirty mark : true if the openGL state of the material need to be updated before next draw call

Definition at line 125 of file Material.hpp.


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