18/shaders/bulb.frag

42 lines
812 B
GLSL
Raw Normal View History

2023-06-13 06:46:56 +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;
};
layout (location = 1) out vec3 gNormal;
layout (location = 3) out vec4 gAmbientSpecular;
layout (location = 4) out uvec3 gID;
uniform float angle;
uniform vec3 direction;
uniform uvec3 ID = uvec3(0);
void main()
{
float cosA = dot(normalize(pos_local), normalize(direction));
if (degrees(acos(cosA)) <= angle)
gAmbientSpecular.rgb = pow(ka, vec3(inv_gamma));
else
discard;
gNormal = vec3(0);
// Сохранение идентификатора объекта
gID = ID;
}