32 lines
755 B
GLSL
32 lines
755 B
GLSL
#version 420 core
|
|
|
|
in vec2 texCoord;
|
|
|
|
in float diffuse; // Диффузная составляющая
|
|
in float specular; // Зеркальная составляющая
|
|
|
|
layout(std140, binding = 1) uniform Material
|
|
{
|
|
vec3 ka;
|
|
vec3 kd;
|
|
vec3 ks;
|
|
float p;
|
|
} material_f;
|
|
|
|
layout(std140, binding = 2) uniform Light
|
|
{
|
|
vec3 position;
|
|
vec3 color;
|
|
} light_f;
|
|
|
|
uniform sampler2D tex_diffuse;
|
|
uniform sampler2D tex_ambient;
|
|
uniform sampler2D tex_specular;
|
|
|
|
out vec4 color;
|
|
|
|
void main()
|
|
{
|
|
color = vec4(light_f.color*material_f.ka, 1)*texture2D(tex_ambient, texCoord) + vec4(light_f.color*material_f.kd*diffuse, 1)*texture2D(tex_diffuse, texCoord) + vec4(light_f.color*material_f.ks*specular, 1)*texture2D(tex_specular, texCoord);
|
|
}
|
|
|