Radium Engine
1.5.20
Loading...
Searching...
No Matches
SimpleMaterial.hpp
1
#pragma once
2
3
#include <Engine/RaEngine.hpp>
4
5
#include <Core/Utils/Color.hpp>
6
#include <Engine/Data/Material.hpp>
7
#include <Engine/Data/Texture.hpp>
8
9
#include <string>
10
11
namespace
Ra
{
12
namespace
Engine {
13
namespace
Data {
14
20
namespace
TextureSemantics {
22
enum class
SimpleMaterial
{ TEX_COLOR, TEX_MASK };
23
}
// namespace TextureSemantics
24
29
class
RA_ENGINE_API
SimpleMaterial
:
public
Material
,
30
public
ParameterSetEditingInterface
,
31
public
MaterialTextureSet
<TextureSemantics::SimpleMaterial>
32
{
33
public
:
34
using
TextureSemantic
=
TextureSemantics::SimpleMaterial
;
38
explicit
SimpleMaterial
(
const
std::string
& instanceName,
39
const
std::string
& materialName,
40
MaterialAspect
aspect = MaterialAspect::MAT_OPAQUE );
41
46
void
updateGL()
override
final
;
47
48
inline
void
setColoredByVertexAttrib(
bool
state )
override
;
49
50
inline
bool
isColoredByVertexAttrib
()
const override
{
return
m_perVertexColor; }
51
52
inline
void
setColor(
Core::Utils::Color
c ) {
53
m_color =
std::move
( c );
54
needUpdate();
55
}
56
57
protected
:
59
static
void
loadMetaData( nlohmann::json& destination );
60
61
private
:
64
void
updateRenderingParameters();
66
Core::Utils::Color
m_color { 0.9, 0.9, 0.9, 1.0 };
68
bool
m_perVertexColor {
false
};
69
};
70
71
inline
void
SimpleMaterial::setColoredByVertexAttrib
(
bool
state ) {
72
if
( state != m_perVertexColor ) {
73
m_perVertexColor = state;
74
needUpdate
();
75
}
76
}
77
78
}
// namespace Data
79
}
// namespace Engine
80
}
// namespace Ra
std::string
Ra::Core::Utils::ColorBase< Scalar >
Ra::Engine::Data::MaterialTextureSet
Base class to manage a set of textures indexed by semantic (enum).
Definition
MaterialTextureSet.hpp:14
Ra::Engine::Data::Material
Base class for materials.
Definition
Material.hpp:24
Ra::Engine::Data::Material::needUpdate
void needUpdate()
Mark the Material as needing update before the next OpenGL call.
Definition
Material.hpp:98
Ra::Engine::Data::Material::MaterialAspect
MaterialAspect
Identifies the type of the material.
Definition
Material.hpp:31
Ra::Engine::Data::ParameterSetEditingInterface
Interface to define metadata (constraints, description, ...) for the editing of parameter set.
Definition
RenderParameters.hpp:149
Ra::Engine::Data::SimpleMaterial
Base implementation for simple, monocolored, materials.
Definition
SimpleMaterial.hpp:32
Ra::Engine::Data::SimpleMaterial::isColoredByVertexAttrib
bool isColoredByVertexAttrib() const override
Indicates if the material takes the VERTEX_COLOR attribute into account.
Definition
SimpleMaterial.hpp:50
Ra::Engine::Data::SimpleMaterial::setColoredByVertexAttrib
void setColoredByVertexAttrib(bool state) override
Makes the Material take its base color from the VERTEX_COLOR attribute of the rendered geometry.
Definition
SimpleMaterial.hpp:71
std::move
T move(T... args)
Ra::Engine::Data::TextureSemantics::SimpleMaterial
SimpleMaterial
SimpleMaterial's textures.
Definition
SimpleMaterial.hpp:22
Ra
hepler function to manage enum as underlying types in VariableSet
Definition
Cage.cpp:3
src
Engine
Data
SimpleMaterial.hpp
Generated by
1.12.0