14/shaders/bulb.frag

25 lines
383 B
GLSL

#version 420 core
layout(std140, binding = 1) uniform Material
{
vec3 ka;
vec3 kd;
vec3 ks;
float p;
};
in vec3 pos_local;
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(ka, 1);
else
discard;
}