#version 330 core // Interpolated values from the vertex shaders in vec2 UV; // Ouput data out vec3 color; // Values that stay constant for the whole mesh. uniform sampler2D trimap; uniform sampler2D foreground; uniform sampler2D background; // Relative width/height of a pixel uniform float pixWidth; uniform float pixHeight; int IS_BACKGROUND = 0; int IS_UNDEFINED = 1; int IS_FOREGROUND = 2; int UNSET = -1; float M_PI= 3.14159; int suchbreich=20; //die anzahl der Pixel, die maximal in eine Richtung gegangen wird um einen Sicheren Pixel zu finden vec4 SicheresPixel[20]; //Speichert die das nachste Sichere Pixel, Array grosse=anzahl der Richtungen int anzahl_richtungen=20; //Speichert anzahl der Richtungen muss gleich der Array grosse von SicheresPixel sein vec3 getTriColor(vec2 uvCoord) { return texture(trimap, uvCoord).rgb; } 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; } else if (all(greaterThanEqual(c, vec3(0.8f)))) { return IS_FOREGROUND; } else { return IS_UNDEFINED; } } vec4 suche_Pixel_nach_winkel (vec2 uv, float winkel){ vec2 pix; float i=1; vec3 color_sichers_Pixel; while(i