Clean up project
This commit is contained in:
@@ -8,13 +8,13 @@ out vec3 color;
|
||||
|
||||
// Values that stay constant for the whole mesh.
|
||||
uniform sampler2D myTextureSampler;
|
||||
//uniform float pixWidth;
|
||||
//uniform float pixHeight;
|
||||
|
||||
|
||||
|
||||
|
||||
// Relative width/height of a pixel
|
||||
uniform float pixWidth;
|
||||
uniform float pixHeight;
|
||||
|
||||
|
||||
// Pixel state
|
||||
int IS_BACKGROUND = 0;
|
||||
int IS_UNDEFINED = 1;
|
||||
int IS_FOREGROUND = 2;
|
||||
@@ -37,30 +37,27 @@ bool isBackground(vec3 c) {
|
||||
}
|
||||
|
||||
void main(){
|
||||
float pixWidth = 0.001174f;
|
||||
float pixHeight = 0.002083f;
|
||||
int status = UNSET;
|
||||
float pw = pixWidth;
|
||||
float ph = pixHeight;
|
||||
|
||||
// Output color = color of the texture at the specified UV
|
||||
for(int w=-5;w<=5;w++){
|
||||
for(int h=-5;h<=5;h++){
|
||||
if (w+h==-10) { // first pixel
|
||||
if (isBackground(getColor(UV+vec2(pixWidth*w,pixHeight*h)))) {
|
||||
if (isBackground(getColor(UV+vec2(pixWidth*w, pixHeight*h)))) {
|
||||
status = IS_BACKGROUND;
|
||||
} else {
|
||||
status = IS_FOREGROUND;
|
||||
}
|
||||
} else { // other pixels
|
||||
if (isBackground(getColor(UV+vec2(pixWidth*w,pixHeight*h)))) {
|
||||
if (isBackground(getColor(UV+vec2(pixWidth*w, pixHeight*h)))) {
|
||||
if (status != IS_BACKGROUND) {
|
||||
status = IS_UNDEFINED;
|
||||
w=100000;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (status != IS_FOREGROUND) {
|
||||
status = IS_UNDEFINED;
|
||||
w=100000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user