fixes in uicreature rendering

This commit is contained in:
Eduardo Bart
2012-02-07 23:33:08 -02:00
parent 09b3aa82df
commit 619f751371
7 changed files with 60 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
Creature < UICreature
size: 66 66
size: 80 80
padding: 1
image-source: /core_styles/images/panel_flat.png
image-border: 1

View File

@@ -5,6 +5,7 @@ Color < ColorBox
Window
text: Select Outfit
size: 550 280
padding: 0 0 0 0
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
@@ -26,6 +27,8 @@ Window
anchors.top: name.bottom
anchors.left: name.left
margin-top: 5
padding: 16 4 4 16
fixed-creature-size: true
ButtonBox
id: head

View File

@@ -11,6 +11,7 @@ uniform vec4 bodyColor;
uniform vec4 legsColor;
uniform vec4 feetColor;
vec4 calcOutfitPixel()
{
vec4 pixel = texture2D(texture, textureCoords);
@@ -29,6 +30,31 @@ vec4 calcOutfitPixel()
return pixel * outColor;
}
/*
// optimized to handle antialising
vec4 calcOutfitPixel()
{
vec4 pixel = texture2D(texture, textureCoords);
vec4 maskColor = texture2D(maskTexture, textureCoords);
const vec4 white = vec4(1,1,1,1);
float headFactor = 0.0;
if(maskColor.r > 0.1 && maskColor.g > 0.1) {
headFactor = min(maskColor.r, maskColor.g);
maskColor.r -= headFactor;
maskColor.g -= headFactor;
}
float tot = headFactor + maskColor.r + maskColor.g + maskColor.b;
vec4 outColor = headFactor * headColor + bodyColor * maskColor.r + legsColor * maskColor.g + feetColor * maskColor.b;
if(tot < 1.0)
outColor += white * (1.0 - tot);
outColor.a = 1.0;
return pixel * outColor;
}
*/
void main()
{
gl_FragColor = calcOutfitPixel() * color * opacity;