Add a missed shader

This commit is contained in:
Benau 2016-06-26 07:16:07 +08:00
parent 416050a923
commit b467d0819d

View File

@ -6,11 +6,15 @@ uniform sampler2D Albedo;
uniform sampler2D SpecMap; uniform sampler2D SpecMap;
#endif #endif
uniform vec2 color_change;
in vec2 uv; in vec2 uv;
in vec4 color; in vec4 color;
out vec4 FragColor; out vec4 FragColor;
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue); vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue);
float rgbToValue(vec3 c);
vec3 hsvToRgb(vec3 c);
void main(void) void main(void)
{ {
@ -22,6 +26,13 @@ void main(void)
#else #else
vec4 col = texture(Albedo, uv); vec4 col = texture(Albedo, uv);
#endif #endif
if (color_change.x > 0)
{
vec3 new_color = hsvToRgb(vec3(color_change.x, color_change.y, rgbToValue(col.rgb)));
col = vec4(new_color.b, new_color.g, new_color.r, col.a);
}
col.xyz *= pow(color.xyz, vec3(2.2)); col.xyz *= pow(color.xyz, vec3(2.2));
float specmap = texture(SpecMap, uv).g; float specmap = texture(SpecMap, uv).g;
float emitmap = texture(SpecMap, uv).b; float emitmap = texture(SpecMap, uv).b;