Skip to content

Commit 32101f2

Browse files
committed
fragmetnFlat missing code
1 parent 74da228 commit 32101f2

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

src/components/textures/shaders/fragmentFlat.glsl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,20 @@ uniform float cScale;
1717
uniform vec2 latBounds;
1818
uniform vec2 lonBounds;
1919
uniform int maskValue;
20-
2120
#define epsilon 0.0001
21+
#define PI 3.14159265
22+
23+
vec2 realCoords(vec2 uv){
24+
vec2 normalizedLon = lonBounds/2./PI+0.5;
25+
vec2 normalizedLat = latBounds/PI+0.5;
26+
float lonScale = normalizedLon.y-normalizedLon.x;
27+
float latScale = normalizedLat.y-normalizedLat.x;
28+
29+
float u = uv.x * lonScale + normalizedLon.x;
30+
float v = uv.y * latScale + normalizedLat.x;
31+
32+
return vec2(u, v);
33+
}
2234

2335
float sample1(vec2 p, int index) { // Shader doesn't support dynamic indexing so we gotta use switching
2436
if (index == 0) return texture(map[0], p).r;
@@ -44,8 +56,8 @@ void main(){
4456
float mask = texture(maskTexture, maskUV).r;
4557
bool cond = maskValue == 1 ? mask<0.5 : mask>=0.5;
4658
if (cond){
47-
Color = vec4(nanColor, 1.);
48-
Color.a = nanAlpha;
59+
color = vec4(nanColor, 1.);
60+
color.a = nanAlpha;
4961
return;
5062
}
5163
}

0 commit comments

Comments
 (0)