2017-12-25 01:00:10 -05:00
|
|
|
in vec3 normal;
|
|
|
|
in vec2 uv;
|
|
|
|
in vec2 uv_two;
|
|
|
|
|
|
|
|
layout(location = 0) out vec4 o_diffuse_color;
|
2018-02-06 23:49:45 -05:00
|
|
|
layout(location = 1) out vec4 o_normal_color;
|
2017-12-25 01:00:10 -05:00
|
|
|
|
|
|
|
#stk_include "utils/encode_normal.frag"
|
2017-12-29 05:10:51 -05:00
|
|
|
#stk_include "utils/sp_texture_sampling.frag"
|
2017-12-25 01:00:10 -05:00
|
|
|
|
|
|
|
void main(void)
|
|
|
|
{
|
2018-01-21 21:43:22 -05:00
|
|
|
vec4 color = sampleTextureLayer0(uv);
|
|
|
|
vec4 layer_two_tex = sampleTextureLayer1(uv_two);
|
2017-12-25 01:00:10 -05:00
|
|
|
layer_two_tex.rgb = layer_two_tex.a * layer_two_tex.rgb;
|
|
|
|
|
|
|
|
vec3 final_color = layer_two_tex.rgb + color.rgb * (1.0 - layer_two_tex.a);
|
|
|
|
|
|
|
|
#if defined(Advanced_Lighting_Enabled)
|
2018-01-21 21:43:22 -05:00
|
|
|
vec4 layer_2 = sampleTextureLayer2(uv);
|
2018-02-06 23:49:45 -05:00
|
|
|
o_diffuse_color = vec4(final_color, layer_2.z);
|
|
|
|
|
|
|
|
o_normal_color.xy = 0.5 * EncodeNormal(normalize(normal)) + 0.5;
|
|
|
|
o_normal_color.zw = layer_2.xy;
|
|
|
|
#else
|
|
|
|
o_diffuse_color = vec4(final_color, 1.0);
|
2017-12-25 01:00:10 -05:00
|
|
|
#endif
|
2018-02-06 23:49:45 -05:00
|
|
|
|
2017-12-25 01:00:10 -05:00
|
|
|
}
|