Radium Engine  1.5.20
Loading...
Searching...
No Matches
Ra::Engine::Data::SimpleMaterial Class Reference

Base implementation for simple, monocolored, materials. More...

#include <Engine/Data/SimpleMaterial.hpp>

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

Public Types

using TextureSemantic = TextureSemantics::SimpleMaterial
 
- Public Types inherited from Ra::Engine::Data::Material
enum class  MaterialAspect { MAT_OPAQUE , MAT_TRANSPARENT , MAT_DENSITY }
 Identifies the type of the material. More...
 

Public Member Functions

 SimpleMaterial (const std::string &instanceName, const std::string &materialName, MaterialAspect aspect=MaterialAspect::MAT_OPAQUE)
 Construct a named material.
 
void updateGL () override final
 Update the openGL state of the material.
 
void setColoredByVertexAttrib (bool state) override
 Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry.
 
bool isColoredByVertexAttrib () const override
 Indicates if the material takes the VERTEX_COLOR attribute into account.
 
void setColor (Core::Utils::Color c)
 
- Public Member Functions inherited from Ra::Engine::Data::Material
virtual ~Material ()=default
 
const std::stringgetInstanceName () const
 
const std::stringgetMaterialName () const
 
void setMaterialAspect (const MaterialAspect &aspect)
 
const MaterialAspectgetMaterialAspect () const
 Get the aspect (MAT_OPAQUE or MAT_TRANSPARENT) of the material.
 
virtual bool isTransparent () const
 
std::list< std::stringgetPropertyList () const override
 Get the list of properties the material migh use in a shader.
 
void needUpdate ()
 Mark the Material as needing update before the next OpenGL call.
 
- Public Member Functions inherited from Ra::Engine::Data::ShaderParameterProvider
virtual RenderParametersgetParameters ()
 
virtual const RenderParametersgetParameters () 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.
 
- Public Member Functions inherited from Ra::Engine::Data::MaterialTextureSet< TextureSemantics::SimpleMaterial >
void addTexture (const TextureSemantics::SimpleMaterial &semantic, const TextureManager::TextureHandle &texture)
 
void addTexture (const TextureSemantics::SimpleMaterial &semantic, const TextureParameters &texture)
 Add texture to TextureManager fisrt, then to the texture set.
 
TexturegetTexture (const TextureSemantics::SimpleMaterial &semantic) const
 Texture getter from semantic.
 

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)
 Creates a named material with the given aspect.
 
void setMaterialName (std::string newName)
 Change the material name.
 
bool isDirty ()
 Return dirty state.
 
void setDirty ()
 Set dirty state to true.
 
void setClean ()
 Set dirty state to false.
 

Detailed Description

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 29 of file SimpleMaterial.hpp.

Member Typedef Documentation

◆ TextureSemantic

Constructor & Destructor Documentation

◆ SimpleMaterial()

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

Construct a named material.

Parameters
nameThe name of the material

Definition at line 10 of file SimpleMaterial.cpp.

Member Function Documentation

◆ isColoredByVertexAttrib()

bool Ra::Engine::Data::SimpleMaterial::isColoredByVertexAttrib ( ) const
inlineoverridevirtual

Indicates if the material takes the VERTEX_COLOR attribute into account.

Reimplemented from Ra::Engine::Data::Material.

Definition at line 50 of file SimpleMaterial.hpp.

◆ loadMetaData()

void Ra::Engine::Data::SimpleMaterial::loadMetaData ( nlohmann::json & destination)
staticprotected

Load the material parameter description.

Definition at line 35 of file SimpleMaterial.cpp.

+ Here is the call graph for this function:

◆ setColor()

void Ra::Engine::Data::SimpleMaterial::setColor ( Core::Utils::Color c)
inline

Definition at line 52 of file SimpleMaterial.hpp.

◆ setColoredByVertexAttrib()

void Ra::Engine::Data::SimpleMaterial::setColoredByVertexAttrib ( bool state)
inlineoverridevirtual

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 from Ra::Engine::Data::Material.

Definition at line 71 of file SimpleMaterial.hpp.

+ Here is the call graph for this function:

◆ updateGL()

void Ra::Engine::Data::SimpleMaterial::updateGL ( )
finaloverridevirtual

Update the openGL state of the material.

This state only consists on associated textures.

Implements Ra::Engine::Data::ShaderParameterProvider.

Definition at line 28 of file SimpleMaterial.cpp.

+ Here is the call graph for this function:

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