Fix Fitness

- compare both textures with the same side up
- load target from the filename passed to the function
This commit is contained in:
Joscha 2017-05-21 00:01:23 +00:00
parent 5c10ba4a78
commit fb74671204
2 changed files with 5 additions and 5 deletions

View file

@ -17,7 +17,7 @@ void main(void)
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;
} }
@ -25,7 +25,7 @@ void main(void)
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;
} }

View file

@ -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;
} }