Radium Engine  1.5.0
Ra::Engine::Data::BlinnPhongMaterial Class Referencefinal

#include <Engine/Data/BlinnPhongMaterial.hpp>

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

Public Types

enum class  TextureSemantic {
  TEX_DIFFUSE , TEX_SPECULAR , TEX_NORMAL , TEX_SHININESS ,
  TEX_ALPHA
}
 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

EIGEN_MAKE_ALIGNED_OPERATOR_NEW BlinnPhongMaterial (const std::string &instanceName)
 
 ~BlinnPhongMaterial () override
 
void updateGL () override
 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.
 
void updateFromParameters () override
 Update the attributes of the ShaderParameterProvider to their actual values stored in the renderParameters.
 
bool isTransparent () const override
 
void addTexture (const TextureSemantic &semantic, Texture *texture)
 
TexturegetTexture (const TextureSemantic &semantic) const
 
nlohmann::json getParametersMetadata () const override
 
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.
 
TextureParametersaddTexture (const TextureSemantic &semantic, const TextureParameters &texture)
 
- 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 MaterialAspectgetMaterialAspect () const
 
std::list< std::string > getPropertyList () const override
 
void needUpdate ()
 
- Public Member Functions inherited from Ra::Engine::Data::ShaderParameterProvider
virtual RenderParametersgetParameters ()
 
virtual const RenderParametersgetParameters () const
 

Static Public Member Functions

static void registerMaterial ()
 
static void unregisterMaterial ()
 
- Static Public Member Functions inherited from Ra::Engine::Data::ParameterSetEditingInterface
static void loadMetaData (const std::string &basename, nlohmann::json &destination)
 Load the ParameterSet description.
 

Public Attributes

Core::Utils::Color m_kd { 0.7, 0.7, 0.7, 1.0 }
 
Core::Utils::Color m_ks { 0.3, 0.3, 0.3, 1.0 }
 
Scalar m_ns { 64.0 }
 
Scalar m_alpha { 1.0 }
 
bool m_perVertexColor { false }
 
bool m_renderAsSplat { false }
 

Friends

class BlinnPhongMaterialConverter
 

Additional Inherited Members

- 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 }
 

Detailed Description

Implementation of the Blinn-Phong Material BSDF.

Todo:
due to "Material.glsl" interface modification, must test this version with all plugins, apps, ... that uses Radium Renderer

Definition at line 29 of file BlinnPhongMaterial.hpp.

Constructor & Destructor Documentation

◆ BlinnPhongMaterial()

Ra::Engine::Data::BlinnPhongMaterial::BlinnPhongMaterial ( const std::string &  instanceName)
explicit

Construct a named Blinn-Phongmaterial

Parameters
instanceNameThe name of this instance of the material

Definition at line 19 of file BlinnPhongMaterial.cpp.

◆ ~BlinnPhongMaterial()

Ra::Engine::Data::BlinnPhongMaterial::~BlinnPhongMaterial ( )
override

Destructor.

Note
The material does not have ownership on its texture. This destructor do not delete the associated textures.

Definition at line 22 of file BlinnPhongMaterial.cpp.

Member Function Documentation

◆ addTexture() [1/2]

TextureParameters & Ra::Engine::Data::BlinnPhongMaterial::addTexture ( const TextureSemantic semantic,
const TextureParameters texture 
)
inline

Add an new texture, from a TextureData, to control the specified BSDF parameter.

Parameters
semanticThe texture semantic
textureThe texture to use (file)
Returns
the corresponding TextureData struct

Definition at line 165 of file BlinnPhongMaterial.hpp.

◆ addTexture() [2/2]

void Ra::Engine::Data::BlinnPhongMaterial::addTexture ( const TextureSemantic semantic,
Texture texture 
)
inline

Add an already existing texture to control the specified BSDF parameter.

Parameters
semanticThe texture semantic
textureThe texture to use

Definition at line 142 of file BlinnPhongMaterial.hpp.

◆ getParametersMetadata()

nlohmann::json Ra::Engine::Data::BlinnPhongMaterial::getParametersMetadata ( ) const
inlineoverridevirtual

Get a json containing metadata about the parameters of the material.

Returns
the metadata in json format

Implements Ra::Engine::Data::ParameterSetEditingInterface.

Definition at line 182 of file BlinnPhongMaterial.hpp.

◆ getTexture()

Texture * Ra::Engine::Data::BlinnPhongMaterial::getTexture ( const TextureSemantic semantic) const
inline

Get the texture associated to the given semantic.

Parameters
semantic
Returns

Definition at line 173 of file BlinnPhongMaterial.hpp.

◆ isTransparent()

bool Ra::Engine::Data::BlinnPhongMaterial::isTransparent ( ) const
overridevirtual

Test if material is transperent.

Returns
true if the material is transparent

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

Definition at line 83 of file BlinnPhongMaterial.cpp.

+ Here is the call graph for this function:

◆ registerMaterial()

void Ra::Engine::Data::BlinnPhongMaterial::registerMaterial ( )
static

Register the material in the material library. After registration, the material could be instantiated by any Radium system, renderer, plugin, ...

Definition at line 87 of file BlinnPhongMaterial.cpp.

+ Here is the call graph for this function:

◆ setColoredByVertexAttrib()

void Ra::Engine::Data::BlinnPhongMaterial::setColoredByVertexAttrib ( bool  )
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 186 of file BlinnPhongMaterial.hpp.

+ Here is the call graph for this function:

◆ unregisterMaterial()

void Ra::Engine::Data::BlinnPhongMaterial::unregisterMaterial ( )
static

Remove the material from the material library. After removal, the material is no more available, ...

Definition at line 145 of file BlinnPhongMaterial.cpp.

+ Here is the call graph for this function:

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