15/shaders/bulb.frag

30 lines
474 B
GLSL
Raw Normal View History

2023-01-15 19:09:29 +00:00
#version 420 core
layout(std140, binding = 1) uniform Material
{
vec3 ka;
vec3 kd;
vec3 ks;
float p;
};
in vec3 pos_local;
2023-01-16 16:08:26 +00:00
layout(std140, binding = 4) uniform gamma
{
float inv_gamma;
};
2023-01-15 19:09:29 +00:00
out vec4 color;
uniform float angle;
uniform vec3 direction;
void main()
{
float cosA = dot(normalize(pos_local), normalize(direction));
if (degrees(acos(cosA)) <= angle)
2023-01-16 16:08:26 +00:00
color = vec4(pow(ka, vec3(inv_gamma)), 1);
2023-01-15 19:09:29 +00:00
else
discard;
}