#version 460
#extension GL_GOOGLE_include_directive : enable
#include <light.h>
#include "shader-common-generic-lighting.h"
layout ( binding = BIND_TRANSFORM ) uniform Uni_Transform
{
mat4 eye_from_object; mat4 clip_from_eye; mat4 clip_from_object; mat4 object_from_eye; mat4 eye_from_clip; mat4 object_from_clip; };
layout (binding = BIND_MAT_COLOR ) uniform Uni_Mat
{
vec4 color_front, color_back;
};
#ifdef _VERTEX_SHADER_
layout ( location = LOC_IN_POS ) in vec4 in_vertex;
layout ( location = LOC_IN_NORMAL ) in vec3 in_normal;
layout ( location = LOC_IN_TCOOR ) in vec2 in_tcoor;
layout ( location = LOC_IN_COLOR ) in vec4 in_color;
layout ( location = 0 ) out VF
{
vec4 color;
vec2 texcoord;
} Out;
#endif
#ifdef _VERTEX_SHADER_
void
vs_main_classic()
{
gl_Position = clip_from_object * in_vertex;
vec4 vertex_e = eye_from_object * in_vertex;
vec3 normal_e = normalize( mat3(eye_from_object) * in_normal );
Out.color = generic_lighting( vertex_e, in_color, normal_e );
Out.texcoord = in_tcoor;
}
#endif
#ifdef _FRAGMENT_SHADER_
layout ( binding = BIND_TEXUNIT ) uniform sampler2D tex_unit_0;
layout ( location = 0 ) in VF
{
vec4 color;
vec2 texcoord;
} In;
layout ( location = 0 ) out vec4 out_frag_color;
void
fs_main_classic()
{
vec4 texel = texture(tex_unit_0,In.texcoord);
out_frag_color = texel * ( gl_FrontFacing ? In.color : color_back );
}
#endif