71 if (DiffuseMapTexture)
73 DiffuseMapTexture->Free();
74 DiffuseMapTexture =
nullptr;
76 Data.Diffuse = Diffuse;
77 Data.IsDiffuseMap =
false;
78 DataBuffer->Update(&Data,
sizeof(Data));
82 if (SpecularMapTexture)
84 SpecularMapTexture->Free();
85 SpecularMapTexture =
nullptr;
87 Data.Specular = Specular;
88 Data.IsSpecularMap =
false;
89 DataBuffer->Update(&Data,
sizeof(Data));
93 Data.Shininess = Shininess;
94 DataBuffer->Update(&Data,
sizeof(Data));
99 if (!DiffuseMapTexture)
return;
101 if (this->DiffuseMapTexture) this->DiffuseMapTexture->Free();
102 this->DiffuseMapTexture = DiffuseMapTexture;
103 if (!Data.IsDiffuseMap)
105 Data.IsDiffuseMap =
true;
106 DataBuffer->Update(&Data,
sizeof(Data));
111 if (!SpecularMapTexture)
return;
113 if (this->SpecularMapTexture) this->SpecularMapTexture->Free();
114 this->SpecularMapTexture = SpecularMapTexture;
115 if (!Data.IsSpecularMap)
117 Data.IsSpecularMap =
true;
118 DataBuffer->Update(&Data,
sizeof(Data));
123 if (!EmissionMapTexture)
return;
125 if (this->EmissionMapTexture) this->EmissionMapTexture->Free();
126 this->EmissionMapTexture = EmissionMapTexture;
127 if (!Data.IsEmissionMap)
129 Data.IsEmissionMap =
true;
130 DataBuffer->Update(&Data,
sizeof(Data));
135 if (!NormalMapTexture)
return;
137 if (this->NormalMapTexture) this->NormalMapTexture->Free();
138 this->NormalMapTexture = NormalMapTexture;
139 if (!Data.IsNormalMap)
141 Data.IsNormalMap =
true;
142 DataBuffer->Update(&Data,
sizeof(Data));
162 Data.Diffuse = Diffuse;
163 Data.Specular = Specular;
164 Data.Shininess = Shininess;
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();
210 return CreateShared<material_phong>(Diffuse, Specular, Shininess);
Buffer interfaces implementation module.
static shared< constant_buffer > Create(u32 Size)
bool GetIsEmissionMap() const
bool GetIsDiffuseMap() const
const shared< texture_2d > & GetSpecularMapTexture() const
float GetShininess() const
void SetEmissionMapTexture(shared< texture_2d > EmissionMapTexture)
const vec3 & GetDiffuse() const
static shared< material_phong > Create(const vec3 &Diffuse, const vec3 &Specular, float Shininess)
material_phong(const vec3 &Diffuse, const vec3 &Specular, float Shininess)
const shared< texture_2d > & GetEmissionMapTexture() const
const vec3 & GetSpecular() const
void SetDiffuseMapTexture(shared< texture_2d > DiffuseMapTexture)
void SetDiffuse(const vec3 &Diffuse)
void SetSpecularMapTexture(shared< texture_2d > SpecularMapTexture)
const shared< texture_2d > & GetDiffuseMapTexture() const
bool GetIsNormalMap() const
bool GetIsSpecularMap() const
void Bind() const override
const shared< texture_2d > & GetNormalMapTexture() const
void SetShininess(float Shininess)
void SetSpecular(const vec3 &Specular)
material_phong(const material_phong &Other)=default
void SetNormalMapTexture(shared< texture_2d > NormalMapTexture)
void Unbind() const override
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
Mesh material class deinition module.
std::shared_ptr< T > shared
Render bridge class implementation module. Static class for making calls to low-level render api,...
Texture interface definition module.