16/shaders/bulb.frag

30 lines
474 B
GLSL
Raw Normal View History

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