2011-12-28 20:38:29 +01:00
|
|
|
uniform float opacity; // painter opacity
|
|
|
|
uniform vec4 color; // painter color
|
|
|
|
uniform float time; // time in seconds since shader linkage
|
2011-12-08 18:28:29 +01:00
|
|
|
|
|
|
|
uniform sampler2D texture; // outfit texture
|
|
|
|
varying vec2 textureCoords; // outfit texture coords
|
|
|
|
uniform sampler2D maskTexture; // outfit color mask
|
|
|
|
|
|
|
|
uniform vec4 headColor;
|
|
|
|
uniform vec4 bodyColor;
|
|
|
|
uniform vec4 legsColor;
|
|
|
|
uniform vec4 feetColor;
|
|
|
|
|
2011-12-23 00:30:19 +01:00
|
|
|
vec4 calcOutfitPixel()
|
2011-12-08 18:28:29 +01:00
|
|
|
{
|
2011-12-23 00:30:19 +01:00
|
|
|
vec4 pixel = texture2D(texture, textureCoords);
|
|
|
|
vec4 maskColor = texture2D(maskTexture, textureCoords);
|
2011-12-08 18:28:29 +01:00
|
|
|
|
2011-12-23 00:30:19 +01:00
|
|
|
vec4 outColor = vec4(1.0, 1.0, 1.0, 1.0);
|
2012-01-30 07:27:21 +01:00
|
|
|
if(maskColor.r > 0.1 && maskColor.g > 0.1)
|
2011-12-08 18:28:29 +01:00
|
|
|
outColor = headColor;
|
2012-01-30 07:27:21 +01:00
|
|
|
else if(maskColor.r > 0.1)
|
2011-12-08 18:28:29 +01:00
|
|
|
outColor = bodyColor;
|
2012-01-30 07:27:21 +01:00
|
|
|
else if(maskColor.g > 0.1)
|
2011-12-08 18:28:29 +01:00
|
|
|
outColor = legsColor;
|
2012-01-30 07:27:21 +01:00
|
|
|
else if(maskColor.b > 0.1)
|
2011-12-08 18:28:29 +01:00
|
|
|
outColor = feetColor;
|
|
|
|
|
2011-12-23 00:30:19 +01:00
|
|
|
return pixel * outColor;
|
2011-12-08 18:28:29 +01:00
|
|
|
}
|
2011-12-23 00:30:19 +01:00
|
|
|
|
2011-12-08 18:28:29 +01:00
|
|
|
void main()
|
|
|
|
{
|
2011-12-23 00:30:19 +01:00
|
|
|
gl_FragColor = calcOutfitPixel() * color * opacity;
|
2011-12-08 18:28:29 +01:00
|
|
|
}
|
2011-12-28 20:38:29 +01:00
|
|
|
|