Clean up code; adding comments

This commit is contained in:
Caesar2011
2016-09-14 18:18:01 +02:00
parent 449060a463
commit 9cb2b0f8e8
4 changed files with 105 additions and 72 deletions

View File

@@ -8,7 +8,7 @@ layout(location = 0) out vec3 color;
//out vec3 color;
// Values that stay constant for the whole mesh.
uniform sampler2D myTextureSampler;
uniform sampler2D foreground;
// Relative width/height of a pixel
uniform float pixWidth;
@@ -27,14 +27,10 @@ int radius = 10;
vec3 getColor(vec2 uvCoord) {
return texture(myTextureSampler, uvCoord).rgb;
return texture(foreground, uvCoord).rgb;
}
bool isBackground(vec3 c) {
/*// 49,206, 11
if (all( lessThanEqual(c, vec3(51.0f/255.0f, 208.0f/255.0f, 13.0f/255.0f))) &&
all(greaterThanEqual(c, vec3(47.0f/255.0f, 204.0f/255.0f, 9.0f/255.0f)))*/
// 0, 255, 0
if (all( lessThanEqual(c, greenValue+difference)) &&
all(greaterThanEqual(c, greenValue-difference))
) {
@@ -74,10 +70,10 @@ void main(){
}
if (status == IS_BACKGROUND) {
color = vec3(0.0f);
color = vec3(0.0f); // black
} else if (status == IS_FOREGROUND) {
color = vec3(1.0f);
color = vec3(1.0f); // white
} else {
color = vec3(0.5f);
color = vec3(0.5f); // gray
}
}