Radium Engine  1.5.20
Loading...
Searching...
No Matches
BlinnPhongMaterialData.hpp
1#pragma once
2
3#include <Core/Asset/MaterialData.hpp>
4#include <Core/Utils/Color.hpp>
5#include <Core/Utils/Log.hpp>
6
7namespace Ra {
8namespace Core {
9namespace Asset {
10
11// RADIUM SUPPORTED MATERIALS
12class RA_CORE_API BlinnPhongMaterialData : public MaterialData
13{
14 public:
15 explicit BlinnPhongMaterialData( const std::string& name = "" );
16
18 inline void displayInfo() const final;
19
21 inline bool hasDiffuse() const;
22
23 inline bool hasSpecular() const;
24
25 inline bool hasShininess() const;
26
27 inline bool hasOpacity() const;
28
29 inline bool hasDiffuseTexture() const;
30
31 inline bool hasSpecularTexture() const;
32
33 inline bool hasShininessTexture() const;
34
35 inline bool hasNormalTexture() const;
36
37 inline bool hasOpacityTexture() const;
38
40 Core::Utils::Color m_diffuse;
41 Core::Utils::Color m_specular;
42 Scalar m_shininess;
43 Scalar m_opacity;
44 std::string m_texDiffuse;
45 std::string m_texSpecular;
46 std::string m_texShininess;
47 std::string m_texNormal;
48 std::string m_texOpacity;
49 bool m_hasDiffuse;
50 bool m_hasSpecular;
51 bool m_hasShininess;
52 bool m_hasOpacity;
53 bool m_hasTexDiffuse;
54 bool m_hasTexSpecular;
55 bool m_hasTexShininess;
56 bool m_hasTexNormal;
57 bool m_hasTexOpacity;
58};
59
63inline bool BlinnPhongMaterialData::hasDiffuse() const {
64 return m_hasDiffuse;
65}
66
67inline bool BlinnPhongMaterialData::hasSpecular() const {
68 return m_hasSpecular;
69}
70
71inline bool BlinnPhongMaterialData::hasShininess() const {
72 return m_hasShininess;
73}
74
75inline bool BlinnPhongMaterialData::hasOpacity() const {
76 return m_hasOpacity;
77}
78
79inline bool BlinnPhongMaterialData::hasDiffuseTexture() const {
80 return m_hasTexDiffuse;
81}
82
83inline bool BlinnPhongMaterialData::hasSpecularTexture() const {
84 return m_hasTexSpecular;
85}
86
87inline bool BlinnPhongMaterialData::hasShininessTexture() const {
88 return m_hasTexShininess;
89}
90
91inline bool BlinnPhongMaterialData::hasNormalTexture() const {
92 return m_hasTexNormal;
93}
94
95inline bool BlinnPhongMaterialData::hasOpacityTexture() const {
96 return m_hasTexOpacity;
97}
98
100inline void BlinnPhongMaterialData::displayInfo() const {
101 using namespace Core::Utils; // log
102 auto print = []( bool ok, const std::string& name, const auto& value ) {
103 if ( ok ) { LOG( logINFO ) << name << value; }
104 else { LOG( logINFO ) << name << "NO"; }
105 };
106
107 LOG( logINFO ) << "======== MATERIAL INFO ========";
108 print( hasDiffuse(), " Kd : ", m_diffuse.transpose() );
109 print( hasSpecular(), " Ks : ", m_specular.transpose() );
110 print( hasShininess(), " Ns : ", m_shininess );
111 print( hasOpacity(), " Opacity : ", m_opacity );
112 print( hasDiffuseTexture(), " Kd Texture : ", m_texDiffuse );
113 print( hasSpecularTexture(), " Ks Texture : ", m_texSpecular );
114 print( hasShininessTexture(), " Ns Texture : ", m_texShininess );
115 print( hasNormalTexture(), " Normal Texture : ", m_texNormal );
116 print( hasOpacityTexture(), " Alpha Texture : ", m_texOpacity );
117}
118
119} // namespace Asset
120} // namespace Core
121} // namespace Ra
hepler function to manage enum as underlying types in VariableSet
Definition Cage.cpp:3
STL namespace.