Base lightrendering started, still some work to be done.
This commit is contained in:
@@ -306,6 +306,7 @@ void dd::Renderer::DrawScene(RenderQueue &objects, ShaderProgram &program)
|
||||
|
||||
glUniform1f(glGetUniformLocation(shaderProgramHandle, "MaterialShininess"), modelJob->Shininess);
|
||||
|
||||
//TODO: Make sure that a normal/specular is loaded in.
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, modelJob->DiffuseTexture);
|
||||
if (modelJob->NormalTexture != 0) {
|
||||
@@ -335,7 +336,11 @@ void dd::Renderer::DrawScene(RenderQueue &objects, ShaderProgram &program)
|
||||
glUniformMatrix4fv(glGetUniformLocation(shaderProgramHandle, "V"), 1, GL_FALSE, glm::value_ptr(viewMatrix));
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, spriteJob->Texture);
|
||||
glBindTexture(GL_TEXTURE_2D, spriteJob->DiffuseTexture);
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, spriteJob->NormalTexture);
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, spriteJob->SpecularTexture);
|
||||
|
||||
glBindVertexArray(m_ScreenQuad);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
Regular → Executable
+1
-1
@@ -65,7 +65,7 @@ void main()
|
||||
+ BoneWeights2[3] * Bones[int(BoneIndices2[3])];
|
||||
}
|
||||
|
||||
gl_Position = MVP * boneTransform * vec4(Position, 1.0);
|
||||
gl_Position = MVP * vec4(Position, 1.0);
|
||||
|
||||
Output.Position = (V * M * boneTransform * vec4(Position, 1.0)).xyz;
|
||||
Output.Normal = (inverse(transpose(V * M)) * boneTransform * vec4(Normal, 0.0)).xyz;
|
||||
|
||||
Regular → Executable
+2
-2
@@ -84,6 +84,6 @@ void main()
|
||||
|
||||
vec4 diffuseTexel = texture(DiffuseTexture, Input.TextureCoord);
|
||||
|
||||
//FragmentColor = phong(Input.Position, normalize(normal), specularTexel.rgb, specularTexel.a);
|
||||
FragmentColor = diffuseTexel;
|
||||
FragmentColor = phong(Input.Position, normalize(normal), specularTexel.rgb, specularTexel.a);
|
||||
//FragmentColor = diffuseTexel;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ dd::Texture::Texture(std::string path)
|
||||
std::unique_ptr<Image> image = std::make_unique<PNG>(path);
|
||||
|
||||
if (image->Width == 0 && image->Height == 0 || image->Format == Image::ImageFormat::Unknown) {
|
||||
image = std::make_unique<PNG>("Textures/ErrorTexture.png");
|
||||
image = std::make_unique<PNG>("Textures/Core/ErrorTexture.png");
|
||||
if (image->Width == 0 && image->Height == 0 || image->Format == Image::ImageFormat::Unknown) {
|
||||
LOG_ERROR("Couldn't even load the error texture. This is a dark day indeed.");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user