Added background to refinement shader

This commit is contained in:
Caesar2011
2016-09-12 19:13:19 +02:00
parent a1c76d1e7f
commit afb288cbf3
5 changed files with 31 additions and 18 deletions

View File

@@ -9,6 +9,7 @@ out vec3 color;
// Values that stay constant for the whole mesh.
uniform sampler2D trimap;
uniform sampler2D foreground;
uniform sampler2D background;
int IS_BACKGROUND = 0;
@@ -24,6 +25,10 @@ vec3 getForeColor(vec2 uvCoord) {
return texture(foreground, uvCoord).rgb;
}
vec3 getBackColor(vec2 uvCoord) {
return texture(background, uvCoord).rgb;
}
int getState(vec3 c) {
if (all(lessThanEqual(c, vec3(0.2f)))) {
return IS_BACKGROUND;
@@ -42,5 +47,9 @@ void main(){
if (status==IS_FOREGROUND) {
color = getForeColor(UV).rgb;
} else if (status==IS_BACKGROUND) {
color = getBackColor(UV).rgb;
} else {
// render undefined area
}
}