diff options
Diffstat (limited to 'examples/qt3d/deferred-renderer-cpp/final_gl2.frag')
-rw-r--r-- | examples/qt3d/deferred-renderer-cpp/final_gl2.frag | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/examples/qt3d/deferred-renderer-cpp/final_gl2.frag b/examples/qt3d/deferred-renderer-cpp/final_gl2.frag deleted file mode 100644 index f384a2df4..000000000 --- a/examples/qt3d/deferred-renderer-cpp/final_gl2.frag +++ /dev/null @@ -1,36 +0,0 @@ -#version 110 - -uniform sampler2D color; -uniform sampler2D position; -uniform sampler2D normal; -uniform vec2 winSize; - -struct PointLight -{ - vec3 position; - vec3 direction; - vec4 color; - float intensity; -}; - -const int lightCount = 3; -uniform struct -{ - PointLight lights[lightCount]; -} pointLights; - -void main() -{ - vec2 texCoord = gl_FragCoord.xy / winSize; - vec4 col = texture2D(color, texCoord); - vec3 pos = texture2D(position, texCoord).xyz; - vec3 norm = texture2D(normal, texCoord).xyz; - - vec4 lightColor; - for (int i = 0; i < 3; i++) { - vec3 s = normalize(pointLights.lights[i].position - pos); - lightColor += pointLights.lights[i].color * (pointLights.lights[i].intensity * max(dot(s, norm), 0.0)); - } - lightColor /= float(lightCount); - gl_FragColor = col * lightColor; -} |