Fix lighting: Normalmatrix was never applied
This commit is contained in:
@@ -13,6 +13,8 @@ struct Material {
|
||||
sampler2D texture_specular1;
|
||||
sampler2D texture_normal0;
|
||||
sampler2D texture_normal1;
|
||||
sampler2D texture_height0;
|
||||
sampler2D texture_height1;
|
||||
sampler2D texture_gloss0;
|
||||
sampler2D texture_gloss1;
|
||||
float shininess;
|
||||
@@ -73,7 +75,7 @@ void main() {
|
||||
|
||||
vec3 fragmentColor = vec3(0.0f);
|
||||
|
||||
vec3 normal = normalize(v_normal);
|
||||
vec3 normal = normalize(u_normalMatrix * v_normal);
|
||||
vec3 viewDir = normalize(u_viewPosition - v_fragmentPosition);
|
||||
|
||||
fragmentColor += directionalLightContribution(u_directionalLight, normal, viewDir);
|
||||
|
||||
@@ -4,13 +4,8 @@ layout(location = 0) in vec3 a_position;
|
||||
layout(location = 1) in vec2 a_texCoord;
|
||||
layout(location = 2) in vec4 a_color;
|
||||
|
||||
out vec4 v_color;
|
||||
out vec2 v_texCoord;
|
||||
|
||||
uniform mat4 u_modelViewProjMatrix;
|
||||
|
||||
void main() {
|
||||
gl_Position = u_modelViewProjMatrix * vec4(a_position, 1.0f);
|
||||
v_texCoord = a_texCoord;
|
||||
v_color = a_color;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user