Radium Engine
1.5.0
|
#include <Engine/Data/SimpleMaterial.hpp>
Public Types | |
enum class | TextureSemantic { TEX_COLOR , TEX_MASK } |
Semantic of the texture : define which BSDF parameter is controled by the texture. | |
Public Types inherited from Ra::Engine::Data::Material | |
enum class | MaterialAspect { MAT_OPAQUE , MAT_TRANSPARENT , MAT_DENSITY } |
Public Member Functions | |
SimpleMaterial (const std::string &instanceName, const std::string &materialName, MaterialAspect aspect=MaterialAspect::MAT_OPAQUE) | |
~SimpleMaterial () override | |
void | updateGL () override final |
TextureParameters & | addTexture (const TextureSemantic &semantic, const TextureParameters &texture) |
void | addTexture (const TextureSemantic &semantic, Texture *texture) |
Texture * | getTexture (const TextureSemantic &semantic) const |
void | setColoredByVertexAttrib (bool state) override |
Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry. More... | |
bool | isColoredByVertexAttrib () const override |
Indicates if the material takes the VERTEX_COLOR attribute into account. | |
Public Member Functions inherited from Ra::Engine::Data::Material | |
const std::string & | getInstanceName () const |
const std::string & | getMaterialName () const |
void | setMaterialAspect (const MaterialAspect &aspect) |
const MaterialAspect & | getMaterialAspect () const |
virtual bool | isTransparent () const |
std::list< std::string > | getPropertyList () const override |
void | needUpdate () |
Public Member Functions inherited from Ra::Engine::Data::ShaderParameterProvider | |
virtual RenderParameters & | getParameters () |
virtual const RenderParameters & | getParameters () const |
virtual void | updateFromParameters () |
Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParameters. | |
Public Member Functions inherited from Ra::Engine::Data::ParameterSetEditingInterface | |
virtual nlohmann::json | getParametersMetadata () const =0 |
Get a json containing metadata about the parameters. More... | |
Public Attributes | |
Core::Utils::Color | m_color { 0.9, 0.9, 0.9, 1.0 } |
The base color of the material. | |
bool | m_perVertexColor { false } |
Static Protected Member Functions | |
static void | loadMetaData (nlohmann::json &destination) |
Load the material parameter description. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Ra::Engine::Data::ParameterSetEditingInterface | |
static void | loadMetaData (const std::string &basename, nlohmann::json &destination) |
Load the ParameterSet description. | |
Protected Member Functions inherited from Ra::Engine::Data::Material | |
Material (const std::string &instanceName, const std::string &materialName, MaterialAspect aspect=MaterialAspect::MAT_OPAQUE) | |
void | setMaterialName (std::string newName) |
Protected Attributes inherited from Ra::Engine::Data::Material | |
std::string | m_instanceName {} |
Material instance name. | |
MaterialAspect | m_aspect { MaterialAspect::MAT_OPAQUE } |
Material aspect. | |
bool | m_isDirty { true } |
Base implementation for simple, monocolored, materials. This material could not be used as is. Only derived class could be used by a renderer.
Definition at line 19 of file SimpleMaterial.hpp.
|
explicit |
Construct a named material
name | The name of the material |
Definition at line 10 of file SimpleMaterial.cpp.
|
override |
Destructor.
Definition at line 15 of file SimpleMaterial.cpp.
|
inline |
Add an new texture, from a TextureParameters, to control the specified BSDF parameter. The textures will be finalized (i.e loaded from a file if needed and transformed to OpenGL texture) only when needed by the updateGL method.
semantic | The texture semantic |
texture | The texture to use (Descriptor of the texture by its parameters) |
Definition at line 111 of file SimpleMaterial.hpp.
|
inline |
Add an already existing texture to control the specified BSDF parameter.
semantic | The texture semantic |
texture | The texture to use |
Definition at line 103 of file SimpleMaterial.hpp.
|
inline |
Get the texture associated to the given semantic.
semantic |
Definition at line 119 of file SimpleMaterial.hpp.
|
inlineoverridevirtual |
Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry.
state | activate (true) or deactivate (false) VERTEX_COLOR attribute usage |
Any material that support per-vertex color parameterization should implement this method accordingly
Reimplemented from Ra::Engine::Data::Material.
Definition at line 128 of file SimpleMaterial.hpp.
|
finaloverridevirtual |
Update the openGL state of the material. This state only consists on associated textures.
Implements Ra::Engine::Data::ShaderParameterProvider.
Definition at line 32 of file SimpleMaterial.cpp.
bool Ra::Engine::Data::SimpleMaterial::m_perVertexColor { false } |
Indicates if the material will takes its base color from vertices' attributes.
Definition at line 80 of file SimpleMaterial.hpp.