#include <material_phong.h>
Material for blin-phong lighting model class.
Definition at line 19 of file material_phong.h.
◆ material_phong() [1/3]
scl::material_phong::material_phong |
( |
| ) |
|
|
default |
Default material for blin-phong lighting model constructor.
◆ material_phong() [2/3]
Default material data defautl copy constructor.
◆ material_phong() [3/3]
scl::material_phong::material_phong |
( |
const vec3 & |
Diffuse, |
|
|
const vec3 & |
Specular, |
|
|
float |
Shininess |
|
) |
| |
|
inline |
- Material for blin-phong lighting model class contructor.
- Parameters
-
Diffuse | - Material diffuse lighting coefficient. |
Specular | - Material specular lighting coefficient. |
Shininess | - Material shiness exponent lighting coefficient. |
Definition at line 159 of file material_phong.h.
159 :
161 {
162 Data.Diffuse = Diffuse;
163 Data.Specular = Specular;
164 Data.Shininess = Shininess;
165
167 }
static shared< constant_buffer > Create(u32 Size)
material(shared< shader_program > Shader)
static shared< shader_program > GetPhongGeometryShader()
◆ Bind()
void scl::material_phong::Bind |
( |
| ) |
const |
|
inlineoverridevirtual |
- Bind material to current render stage function.
- Parameters
-
- Returns
- None.
Reimplemented from scl::material.
Definition at line 175 of file material_phong.h.
176 {
179
184 }
shared< shader_program > Shader
static const int TEXTURE_SLOT_MATERIAL_EMISSION_MAP
static const int TEXTURE_SLOT_MATERIAL_NORMAL_MAP
static const int BINDING_POINT_MATERIAL_DATA
static const int TEXTURE_SLOT_MATERIAL_DIFFUSE
static const int TEXTURE_SLOT_MATERIAL_SPECULAR
◆ Create()
- Material for blin-phong lighting model class contructor.
- Parameters
-
Specular | - Material specular lighting coefficient. |
Diffuse | - Material diffuse lighting coefficient. |
Shininess | - Material shiness exponent lighting coefficient. |
Definition at line 208 of file material_phong.h.
209 {
210 return CreateShared<material_phong>(Diffuse, Specular, Shininess);
211 }
◆ GetDiffuse()
const vec3 & scl::material_phong::GetDiffuse |
( |
| ) |
const |
|
inline |
Material shiness exponent lighting coefficient getter function.
Definition at line 47 of file material_phong.h.
47{ return Data.Diffuse; }
◆ GetDiffuseMapTexture()
const shared< texture_2d > & scl::material_phong::GetDiffuseMapTexture |
( |
| ) |
const |
|
inline |
Diffuse map getter function.
Definition at line 61 of file material_phong.h.
61{ return DiffuseMapTexture; }
◆ GetEmissionMapTexture()
const shared< texture_2d > & scl::material_phong::GetEmissionMapTexture |
( |
| ) |
const |
|
inline |
Emission map getter function.
Definition at line 65 of file material_phong.h.
65{ return EmissionMapTexture; }
◆ GetIsDiffuseMap()
bool scl::material_phong::GetIsDiffuseMap |
( |
| ) |
const |
|
inline |
Flag, showing whether diffuse map passing to shader getter function.
Definition at line 54 of file material_phong.h.
54{ return Data.IsDiffuseMap; }
◆ GetIsEmissionMap()
bool scl::material_phong::GetIsEmissionMap |
( |
| ) |
const |
|
inline |
Flag, showing whether normal map passing to shader getter function.
Definition at line 56 of file material_phong.h.
56{ return Data.IsEmissionMap; }
◆ GetIsNormalMap()
bool scl::material_phong::GetIsNormalMap |
( |
| ) |
const |
|
inline |
Flag, showing whether normal map passing to shader getter function.
Definition at line 58 of file material_phong.h.
58{ return Data.IsNormalMap; }
◆ GetIsSpecularMap()
bool scl::material_phong::GetIsSpecularMap |
( |
| ) |
const |
|
inline |
Flag, showing whether specular map passing to shader getter function.
Definition at line 52 of file material_phong.h.
52{ return Data.IsSpecularMap; }
◆ GetNormalMapTexture()
Normal map getter function.
Definition at line 67 of file material_phong.h.
67{ return NormalMapTexture; }
◆ GetShininess()
float scl::material_phong::GetShininess |
( |
| ) |
const |
|
inline |
Material diffuse lighting coefficient getter function.
Definition at line 49 of file material_phong.h.
49{ return Data.Shininess; }
◆ GetSpecular()
const vec3 & scl::material_phong::GetSpecular |
( |
| ) |
const |
|
inline |
Material for blin-phong lighing model data getter setter functions.
Material specular lighting coefficient getter function.
Definition at line 45 of file material_phong.h.
45{ return Data.Specular; }
◆ GetSpecularMapTexture()
const shared< texture_2d > & scl::material_phong::GetSpecularMapTexture |
( |
| ) |
const |
|
inline |
Specular map getter function.
Definition at line 63 of file material_phong.h.
63{ return SpecularMapTexture; }
◆ SetDiffuse()
void scl::material_phong::SetDiffuse |
( |
const vec3 & |
Diffuse | ) |
|
|
inline |
Diffuse coeffisient setter function.
Definition at line 70 of file material_phong.h.
70 {
71 if (DiffuseMapTexture)
72 {
73 DiffuseMapTexture->Free();
74 DiffuseMapTexture = nullptr;
75 }
76 Data.Diffuse = Diffuse;
77 Data.IsDiffuseMap = false;
78 DataBuffer->Update(&Data, sizeof(Data));
79 }
◆ SetDiffuseMapTexture()
void scl::material_phong::SetDiffuseMapTexture |
( |
shared< texture_2d > |
DiffuseMapTexture | ) |
|
|
inline |
Diffuse map setter function.
Definition at line 98 of file material_phong.h.
98 {
99 if (!DiffuseMapTexture) return;
100
101 if (this->DiffuseMapTexture) this->DiffuseMapTexture->Free();
102 this->DiffuseMapTexture = DiffuseMapTexture;
103 if (!Data.IsDiffuseMap)
104 {
105 Data.IsDiffuseMap = true;
106 DataBuffer->Update(&Data, sizeof(Data));
107 }
108 }
◆ SetEmissionMapTexture()
void scl::material_phong::SetEmissionMapTexture |
( |
shared< texture_2d > |
EmissionMapTexture | ) |
|
|
inline |
Emission map setter function.
Definition at line 122 of file material_phong.h.
122 {
123 if (!EmissionMapTexture) return;
124
125 if (this->EmissionMapTexture) this->EmissionMapTexture->Free();
126 this->EmissionMapTexture = EmissionMapTexture;
127 if (!Data.IsEmissionMap)
128 {
129 Data.IsEmissionMap = true;
130 DataBuffer->Update(&Data, sizeof(Data));
131 }
132 }
◆ SetNormalMapTexture()
void scl::material_phong::SetNormalMapTexture |
( |
shared< texture_2d > |
NormalMapTexture | ) |
|
|
inline |
Normal map setter function.
Definition at line 134 of file material_phong.h.
134 {
135 if (!NormalMapTexture) return;
136
137 if (this->NormalMapTexture) this->NormalMapTexture->Free();
138 this->NormalMapTexture = NormalMapTexture;
139 if (!Data.IsNormalMap)
140 {
141 Data.IsNormalMap = true;
142 DataBuffer->Update(&Data, sizeof(Data));
143 }
144 }
◆ SetShininess()
void scl::material_phong::SetShininess |
( |
float |
Shininess | ) |
|
|
inline |
Shiness exponent setter function.
Definition at line 92 of file material_phong.h.
92 {
93 Data.Shininess = Shininess;
94 DataBuffer->Update(&Data, sizeof(Data));
95 }
◆ SetSpecular()
void scl::material_phong::SetSpecular |
( |
const vec3 & |
Specular | ) |
|
|
inline |
Specular coefficient setter function.
Definition at line 81 of file material_phong.h.
81 {
82 if (SpecularMapTexture)
83 {
84 SpecularMapTexture->Free();
85 SpecularMapTexture = nullptr;
86 }
87 Data.Specular = Specular;
88 Data.IsSpecularMap = false;
89 DataBuffer->Update(&Data, sizeof(Data));
90 }
◆ SetSpecularMapTexture()
void scl::material_phong::SetSpecularMapTexture |
( |
shared< texture_2d > |
SpecularMapTexture | ) |
|
|
inline |
Specular map setter function.
Definition at line 110 of file material_phong.h.
110 {
111 if (!SpecularMapTexture) return;
112
113 if (this->SpecularMapTexture) this->SpecularMapTexture->Free();
114 this->SpecularMapTexture = SpecularMapTexture;
115 if (!Data.IsSpecularMap)
116 {
117 Data.IsSpecularMap = true;
118 DataBuffer->Update(&Data, sizeof(Data));
119 }
120 }
◆ Unbind()
void scl::material_phong::Unbind |
( |
| ) |
const |
|
inlineoverridevirtual |
- Unbind material from current render stage function.
- Parameters
-
- Returns
- None.
Reimplemented from scl::material.
Definition at line 192 of file material_phong.h.
193 {
195 if (DataBuffer != nullptr) DataBuffer->Unbind();
196 if (SpecularMapTexture && Data.IsSpecularMap) SpecularMapTexture->Unbind();
197 if (DiffuseMapTexture && Data.IsDiffuseMap) DiffuseMapTexture->Unbind();
198 if (NormalMapTexture && Data.IsNormalMap) NormalMapTexture->Unbind();
199 }
The documentation for this class was generated from the following file: