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