Updated (multi) indirect draw example

This commit is contained in:
saschawillems 2016-08-01 21:43:47 +02:00
parent be68bc0a5a
commit 444c4b9c24
23 changed files with 1565 additions and 214 deletions

View file

@ -7,28 +7,24 @@ layout (binding = 1) uniform sampler2DArray samplerArray;
layout (location = 0) in vec3 inNormal;
layout (location = 1) in vec3 inColor;
layout (location = 2) in vec3 inEyePos;
layout (location = 3) in vec3 inLightVec;
layout (location = 4) in vec3 inUV;
layout (location = 2) in vec3 inUV;
layout (location = 3) in vec3 inViewVec;
layout (location = 4) in vec3 inLightVec;
layout (location = 0) out vec4 outFragColor;
void main()
void main()
{
vec4 color = texture(samplerArray, inUV) * vec4(inColor, 1.0);
vec4 color = texture(samplerArray, inUV);
if (color.a < 0.5)
{
discard;
}
vec3 N = normalize(inNormal);
vec3 L = normalize(vec3(1.0));
vec3 Eye = normalize(-inEyePos);
vec3 Reflected = normalize(reflect(-inLightVec, inNormal));
vec4 IAmbient = vec4(vec3(0.1), 1.0);
vec4 IDiffuse = vec4(1.0) * max(dot(inNormal, inLightVec), 0.0);
float specular = 0.75;
vec4 ISpecular = vec4(0.5, 0.5, 0.5, 1.0) * pow(max(dot(Reflected, Eye), 0.0), 32.0) * specular;
outFragColor = vec4((IAmbient + IDiffuse) * color + ISpecular);
}
vec3 L = normalize(inLightVec);
vec3 ambient = vec3(0.65);
vec3 diffuse = max(dot(N, L), 0.0) * inColor;
outFragColor = vec4((ambient + diffuse) * color.rgb, 1.0);
}