Use heightmap class

This commit is contained in:
saschawillems 2016-10-20 21:30:37 +02:00
parent 0c8cc73864
commit 298f7a9415
6 changed files with 49 additions and 81 deletions

View file

@ -37,9 +37,11 @@ void main()
}
vec3 N = normalize(inNormal);
N = normalize((inNormal - 0.5) * 2.0);
vec3 L = normalize(inLightVec);
vec3 R = reflect(-L, N);
vec3 diffuse = max(dot(N, L), 0.25) * color.rgb;
outFragColor = vec4(diffuse, 1.0);
// outFragColor = vec4(color.rgb, 1.0);
}

View file

@ -4,8 +4,8 @@
#extension GL_ARB_shading_language_420pack : enable
layout (location = 0) in vec3 inPos;
layout (location = 1) in vec2 inUV;
layout (location = 2) in vec3 inNormal;
layout (location = 1) in vec3 inNormal;
layout (location = 2) in vec2 inUV;
layout (binding = 0) uniform UBO
{
@ -36,7 +36,7 @@ void main()
gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
vec3 lightPos = vec3(0.0, -5.0f, 0.0f);
vec3 lightPos = vec3(0.0, 50.0f, 0.0f);
outLightVec = lightPos - inPos.xyz;
outViewVec = ubo.viewPos.xyz - worldPos.xyz;
}