mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-16 16:12:35 +00:00
Restructured deferred lighting/rendering
This commit is contained in:
35
shaders/fragment/deferred_lighting.glsl
Normal file
35
shaders/fragment/deferred_lighting.glsl
Normal file
@@ -0,0 +1,35 @@
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
@include "light_struct"
|
||||
const int DIRECTIONAL = 0;
|
||||
const int POINT = 1;
|
||||
const int SPOT = 2;
|
||||
|
||||
in vec2 outTexCoords;
|
||||
flat in Light outLight;
|
||||
|
||||
uniform sampler2D diffuse, position, texcoord, normal, depth;
|
||||
|
||||
vec4 directionalLight(Light light) {
|
||||
return vec4(0,0,0,0);
|
||||
}
|
||||
|
||||
vec4 calculateLighting(Light light) {
|
||||
vec4 result = vec4(0,0,0,0);
|
||||
|
||||
switch(light.type) {
|
||||
case DIRECTIONAL: {
|
||||
result = directionalLight(light);
|
||||
}
|
||||
default: {
|
||||
result = vec4(1,1,1,1);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void main() {
|
||||
FragColor = texture(diffuse, outTexCoords) * calculateLighting(outLight);
|
||||
}
|
||||
Reference in New Issue
Block a user