3#include <Engine/RaEngine.hpp>
5#include <Core/Utils/Color.hpp>
6#include <Engine/Data/Material.hpp>
7#include <Engine/Data/Texture.hpp>
24namespace TextureSemantics {
26enum class BlinnPhongMaterial { TEX_DIFFUSE, TEX_SPECULAR, TEX_NORMAL, TEX_SHININESS, TEX_ALPHA };
52 void updateGL()
override;
53 void updateFromParameters()
override;
54 bool isTransparent()
const override;
61 static void registerMaterial();
67 static void unregisterMaterial();
71 inline void setColoredByVertexAttrib(
bool state )
override;
77 inline void setSpecularExponent( Scalar n );
78 inline void setRenderAsSplat(
bool state );
82 inline Scalar getSpecularExponent() {
return m_ns; }
83 inline bool isRenderAsSplat() {
return m_renderAsSplat; }
84 inline void setAlpha( Scalar a );
85 inline Scalar getAlpha() {
return m_alpha; }
88 Core::Utils::Color m_kd { 0.7, 0.7, 0.7, 1.0 };
89 Core::Utils::Color m_ks { 0.3, 0.3, 0.3, 1.0 };
91 Scalar m_alpha { 1.0 };
92 bool m_perVertexColor {
false };
93 bool m_renderAsSplat {
false };
94 static nlohmann::json s_parametersMetadata;
98 void updateRenderingParameters();
114 if ( state != m_perVertexColor ) {
115 m_perVertexColor = state;
120inline void BlinnPhongMaterial::setSpecularExponent( Scalar n ) {
135inline void BlinnPhongMaterial::setRenderAsSplat(
bool state ) {
136 if ( state != m_renderAsSplat ) {
137 m_renderAsSplat = state;
142inline void BlinnPhongMaterial::setAlpha( Scalar a ) {
represent material data loaded by a file loader. Material data must be identified by a unique name....
bool isColoredByVertexAttrib() const override
Indicates if the material takes the VERTEX_COLOR attribute into account.
void setColoredByVertexAttrib(bool state) override
Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry.
nlohmann::json getParametersMetadata() const override
Get a json containing metadata about the parameters.
Base class to manage a set of textures indexed by semantic (enum).
Base class for materials.
void needUpdate()
Mark the Material as needing update before the next OpenGL call.
Interface to define metadata (constraints, description, ...) for the editing of parameter set.
BlinnPhongMaterial
BlinnPhongMaterial's textures.
hepler function to manage enum as underlying types in VariableSet