17/shaders/bulb.frag

42 lines
812 B
GLSL
Raw Normal View History

2023-03-31 06:14:37 +00:00
#version 420 core
layout(std140, binding = 1) uniform Material
{
vec3 ka;
vec3 kd;
vec3 ks;
float p;
bool normalmapped;
bool parallaxmapped;
bool displacementmapped;
};
in vec3 pos_local;
layout(std140, binding = 4) uniform gamma
{
float inv_gamma;
};
2023-04-05 13:07:09 +00:00
layout (location = 1) out vec3 gNormal;
layout (location = 3) out vec4 gAmbientSpecular;
layout (location = 4) out uvec3 gID;
2023-03-31 06:14:37 +00:00
uniform float angle;
uniform vec3 direction;
2023-04-05 13:07:09 +00:00
uniform uvec3 ID = uvec3(0);
2023-03-31 06:14:37 +00:00
void main()
{
float cosA = dot(normalize(pos_local), normalize(direction));
if (degrees(acos(cosA)) <= angle)
2023-04-05 13:07:09 +00:00
gAmbientSpecular.rgb = pow(ka, vec3(inv_gamma));
2023-03-31 06:14:37 +00:00
else
discard;
2023-04-05 13:07:09 +00:00
gNormal = vec3(0);
// Сохранение идентификатора объекта
gID = ID;
2023-03-31 06:14:37 +00:00
}