23 lines
560 B
GLSL
23 lines
560 B
GLSL
#version 450 core
|
|
layout (std140, binding = 1) uniform LightsBlock
|
|
{
|
|
vec4 posBool[20];
|
|
vec4 colRad[20];
|
|
} ;
|
|
uniform int lightID;
|
|
vec3 lightPos = posBool[lightID].xyz;
|
|
vec4 lumRad = colRad[lightID];
|
|
uniform sampler2D screenTexture;
|
|
in vec2 gTexPos;
|
|
out vec4 fColor;
|
|
void main()
|
|
{
|
|
vec3 distVec = texture(screenTexture,gTexPos).xyz - lightPos;
|
|
float dist = dot(distVec,distVec);
|
|
if (dist > lumRad.a) {discard;}
|
|
float x = 1 - dist / lumRad.a ;
|
|
vec3 c = (x * x * x) * lumRad.rgb ;
|
|
//fColor = vec4(c,0);
|
|
fColor = vec4(1,0,0,0);
|
|
}
|