Fixed normal transformation
This commit is contained in:
parent
defdf051ec
commit
8b5f33ee3f
4 changed files with 9 additions and 7 deletions
|
|
@ -32,6 +32,7 @@ void main() {
|
|||
vec3 reflectDir = reflect(-lightDir, norm);
|
||||
float spec = pow(max(dot(viewDir, reflectDir), 0.0), 2);
|
||||
vec3 specular = lightSpecular * spec * vec3(texture(diffuseSampler, TexCoords));
|
||||
//vec3 specular = lightSpecular * spec * vec3(1.0, 1.0, 1.0);
|
||||
|
||||
vec3 result = (ambient + diffuse + specular);
|
||||
outColor = vec4(result, 1.0);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ layout(location = 4) out vec2 TexCoords;
|
|||
void main() {
|
||||
mat4 transformation = transform.translation * transform.scale * transform.rotation;
|
||||
vec4 out_vec = proj.proj * view.view * transformation * vec4(vertPos, 1.0);
|
||||
FragPos = vec3(vec4(vertPos, 1.0));
|
||||
Normal = normal;
|
||||
FragPos = vec3(transformation * vec4(vertPos, 1.0));
|
||||
|
||||
Normal = mat3(transpose(inverse(transformation))) * normal;
|
||||
TexCoords = uv;
|
||||
gl_Position = vec4(out_vec.x, out_vec.y, out_vec.z, out_vec.w);
|
||||
gl_Position = out_vec;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue