You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
13 years ago
|
uniform float opacity; // painter opacity
|
||
|
uniform vec4 color; // painter color
|
||
|
uniform float time; // time in seconds since shader linkage
|
||
13 years ago
|
|
||
|
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;
|
||
|
|
||
13 years ago
|
const vec4 yellow = vec4(1.0, 1.0, 0.0, 1.0);
|
||
|
const vec4 red = vec4(1.0, 0.0, 0.0, 1.0);
|
||
|
const vec4 green = vec4(0.0, 1.0, 0.0, 1.0);
|
||
|
const vec4 blue = vec4(0.0, 0.0, 1.0, 1.0);
|
||
|
|
||
|
vec4 calcOutfitPixel()
|
||
13 years ago
|
{
|
||
13 years ago
|
vec4 pixel = texture2D(texture, textureCoords);
|
||
|
vec4 maskColor = texture2D(maskTexture, textureCoords);
|
||
13 years ago
|
|
||
13 years ago
|
vec4 outColor = vec4(1.0, 1.0, 1.0, 1.0);
|
||
|
if(maskColor == yellow)
|
||
13 years ago
|
outColor = headColor;
|
||
13 years ago
|
else if(maskColor == red)
|
||
13 years ago
|
outColor = bodyColor;
|
||
13 years ago
|
else if(maskColor == green)
|
||
13 years ago
|
outColor = legsColor;
|
||
13 years ago
|
else if(maskColor == blue)
|
||
13 years ago
|
outColor = feetColor;
|
||
|
|
||
13 years ago
|
return pixel * outColor;
|
||
13 years ago
|
}
|
||
13 years ago
|
|
||
13 years ago
|
void main()
|
||
|
{
|
||
13 years ago
|
gl_FragColor = calcOutfitPixel() * color * opacity;
|
||
13 years ago
|
}
|
||
13 years ago
|
|