Fix Fitness
- compare both textures with the same side up - load target from the filename passed to the function
This commit is contained in:
parent
5c10ba4a78
commit
fb74671204
2 changed files with 5 additions and 5 deletions
|
|
@ -16,16 +16,16 @@ void main(void)
|
||||||
if (horizontal) {
|
if (horizontal) {
|
||||||
float posy = gl_FragCoord.y/size.y;
|
float posy = gl_FragCoord.y/size.y;
|
||||||
for (float x=0.0; x<=1.0; x+=(1.0/size.x)) {
|
for (float x=0.0; x<=1.0; x+=(1.0/size.x)) {
|
||||||
vec4 color = texture2D(curr, vec2(x, posy));
|
vec4 color = texture2D(curr, vec2(x, posy));
|
||||||
vec4 basecolor = texture2D(base, vec2(x, 1.0-posy));
|
vec4 basecolor = texture2D(base, vec2(x, posy));
|
||||||
color.rgb = abs(color.rgb - basecolor.rgb);
|
color.rgb = abs(color.rgb - basecolor.rgb);
|
||||||
total = total + color.r + color.g + color.b;
|
total = total + color.r + color.g + color.b;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
float posx = gl_FragCoord.x/size.x;
|
float posx = gl_FragCoord.x/size.x;
|
||||||
for (float y=0.0; y<=1.0; y+=(1.0/size.y)) {
|
for (float y=0.0; y<=1.0; y+=(1.0/size.y)) {
|
||||||
vec4 color = texture2D(curr, vec2(posx, y));
|
vec4 color = texture2D(curr, vec2(posx, y));
|
||||||
vec4 basecolor = texture2D(base, vec2(posx, 1.0-y));
|
vec4 basecolor = texture2D(base, vec2(posx, y));
|
||||||
color.rgb = abs(color.rgb - basecolor.rgb);
|
color.rgb = abs(color.rgb - basecolor.rgb);
|
||||||
total = total + color.r + color.g + color.b;
|
total = total + color.r + color.g + color.b;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ bool Fitness::loadTarget(std::string filename)
|
||||||
|
|
||||||
// load the image
|
// load the image
|
||||||
sf::Texture tex;
|
sf::Texture tex;
|
||||||
if (!tex.loadFromFile("tom-face.png")) {
|
if (!tex.loadFromFile(filename)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue