@aguacerowx/react-native 0.0.33 → 0.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build/.transforms/42e9b8fa82d77a1c205db5bf0d0ed519/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +54 -27
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/{lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId2 → android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0} +0 -0
- package/{lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId3 → android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1} +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +30 -14
- package/android/src/main/res/raw/fragment_shader.glsl +54 -27
- package/ios/GridRenderLayer.swift +21 -3
- package/ios/Shaders.metal +156 -19
- package/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/commonjs/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
- package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +54 -27
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/{android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId2 → lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0} +0 -0
- package/lib/{module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId3 → commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1} +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +30 -14
- package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +54 -27
- package/lib/commonjs/ios/GridRenderLayer.swift +21 -3
- package/lib/commonjs/ios/Shaders.metal +156 -19
- package/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/commonjs/package.json +1 -1
- package/lib/commonjs/src/WeatherLayerManager.js +3 -16
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
- package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +54 -27
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/{GridRenderLayer$VertexInfo.class.uniqueId2 → GridRenderLayer$VertexInfo.class.uniqueId0} +0 -0
- package/{android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId3 → lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1} +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +30 -14
- package/lib/module/android/src/main/res/raw/fragment_shader.glsl +54 -27
- package/lib/module/ios/GridRenderLayer.swift +21 -3
- package/lib/module/ios/Shaders.metal +156 -19
- package/lib/module/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/module/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +21 -3
- package/lib/module/lib/commonjs/ios/Shaders.metal +156 -19
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/module/lib/commonjs/package.json +1 -1
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +3 -16
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/package.json +1 -1
- package/lib/module/src/WeatherLayerManager.js +3 -16
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/WeatherLayerManager.js +6 -20
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId4 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderManager.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId5 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId1 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId4 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderManager.class.uniqueId0 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId5 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId1 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId4 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderManager.class.uniqueId0 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/InspectorModule.class.uniqueId5 +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec.h +0 -0
|
@@ -91,7 +91,6 @@ void main() {
|
|
|
91
91
|
vec2 v11_coord = (bl_texel_index + vec2(1.5, 1.5)) * texel_size;
|
|
92
92
|
|
|
93
93
|
if (u_is_ptype == 1) {
|
|
94
|
-
// --- PTYPE-SPECIFIC INTERPOLATION ---
|
|
95
94
|
float v00 = dequantize_val(get_value(v00_coord));
|
|
96
95
|
float v10 = dequantize_val(get_value(v10_coord));
|
|
97
96
|
float v01 = dequantize_val(get_value(v01_coord));
|
|
@@ -102,31 +101,59 @@ void main() {
|
|
|
102
101
|
float p01 = get_ptype_from_physical(v01);
|
|
103
102
|
float p11 = get_ptype_from_physical(v11);
|
|
104
103
|
|
|
105
|
-
//
|
|
106
|
-
float
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
104
|
+
// Calculate geometric weights
|
|
105
|
+
float w00 = (1.0 - f.x) * (1.0 - f.y);
|
|
106
|
+
float w10 = f.x * (1.0 - f.y);
|
|
107
|
+
float w01 = (1.0 - f.x) * f.y;
|
|
108
|
+
float w11 = f.x * f.y;
|
|
109
|
+
|
|
110
|
+
// 1. Calculate 'smoothing_weight' (The Raw Alpha)
|
|
111
|
+
// This is the sum of valid neighbor weights.
|
|
112
|
+
float smoothing_weight = 0.0;
|
|
113
|
+
if (p00 >= 0.0) smoothing_weight += w00;
|
|
114
|
+
if (p10 >= 0.0) smoothing_weight += w10;
|
|
115
|
+
if (p01 >= 0.0) smoothing_weight += w01;
|
|
116
|
+
if (p11 >= 0.0) smoothing_weight += w11;
|
|
117
|
+
|
|
118
|
+
if (smoothing_weight <= 0.0) discard;
|
|
119
|
+
|
|
120
|
+
// 2. Voting Logic for Color (The "Winning" Type)
|
|
121
|
+
// This preserves the sharp internal borders you liked.
|
|
122
|
+
float weight_type_0 = 0.0;
|
|
123
|
+
float weight_type_1 = 0.0;
|
|
124
|
+
float weight_type_2 = 0.0;
|
|
125
|
+
float weight_type_3 = 0.0;
|
|
126
|
+
|
|
127
|
+
if (p00 >= 0.0) { int t = int(p00); if(t==0) weight_type_0+=w00; else if(t==1) weight_type_1+=w00; else if(t==2) weight_type_2+=w00; else if(t==3) weight_type_3+=w00; }
|
|
128
|
+
if (p10 >= 0.0) { int t = int(p10); if(t==0) weight_type_0+=w10; else if(t==1) weight_type_1+=w10; else if(t==2) weight_type_2+=w10; else if(t==3) weight_type_3+=w10; }
|
|
129
|
+
if (p01 >= 0.0) { int t = int(p01); if(t==0) weight_type_0+=w01; else if(t==1) weight_type_1+=w01; else if(t==2) weight_type_2+=w01; else if(t==3) weight_type_3+=w01; }
|
|
130
|
+
if (p11 >= 0.0) { int t = int(p11); if(t==0) weight_type_0+=w11; else if(t==1) weight_type_1+=w11; else if(t==2) weight_type_2+=w11; else if(t==3) weight_type_3+=w11; }
|
|
131
|
+
|
|
132
|
+
float max_w = weight_type_0; float winning_type = 0.0;
|
|
133
|
+
if (weight_type_1 > max_w) { max_w = weight_type_1; winning_type = 1.0; }
|
|
134
|
+
if (weight_type_2 > max_w) { max_w = weight_type_2; winning_type = 2.0; }
|
|
135
|
+
if (weight_type_3 > max_w) { max_w = weight_type_3; winning_type = 3.0; }
|
|
136
|
+
|
|
137
|
+
// 3. Average value only among pixels of the winning type
|
|
138
|
+
float value_sum = 0.0;
|
|
139
|
+
float value_weight = 0.0;
|
|
140
|
+
|
|
141
|
+
if (p00 == winning_type) { value_sum += v00 * w00; value_weight += w00; }
|
|
142
|
+
if (p10 == winning_type) { value_sum += v10 * w10; value_weight += w10; }
|
|
143
|
+
if (p01 == winning_type) { value_sum += v01 * w01; value_weight += w01; }
|
|
144
|
+
if (p11 == winning_type) { value_sum += v11 * w11; value_weight += w11; }
|
|
145
|
+
|
|
146
|
+
if (value_weight <= 0.0) discard;
|
|
147
|
+
|
|
148
|
+
raw_value = value_sum / value_weight;
|
|
149
|
+
|
|
150
|
+
// 4. FIX FOR BLURRINESS: Sharpen the Alpha Edge
|
|
151
|
+
// Instead of a linear 0.0->1.0 fade, we use smoothstep to tighten the edge.
|
|
152
|
+
// This makes the outer border look like a smooth curve rather than a fuzzy fog.
|
|
153
|
+
total_weight = smoothstep(0.40, 0.60, smoothing_weight);
|
|
127
154
|
|
|
128
155
|
} else {
|
|
129
|
-
//
|
|
156
|
+
// ... (keep your existing standard interpolation else block here) ...
|
|
130
157
|
float v00_q = get_value(v00_coord);
|
|
131
158
|
float v10_q = get_value(v10_coord);
|
|
132
159
|
float v01_q = get_value(v01_coord);
|
|
@@ -144,8 +171,6 @@ void main() {
|
|
|
144
171
|
}
|
|
145
172
|
}
|
|
146
173
|
|
|
147
|
-
// --- COMMON FINAL STEPS ---
|
|
148
|
-
|
|
149
174
|
if (raw_value < u_data_range.x) {
|
|
150
175
|
discard;
|
|
151
176
|
}
|
|
@@ -158,5 +183,7 @@ void main() {
|
|
|
158
183
|
}
|
|
159
184
|
|
|
160
185
|
float final_alpha = color.a * u_opacity * total_weight;
|
|
161
|
-
|
|
186
|
+
|
|
187
|
+
// OUTPUT: Use Straight Alpha (vec4(rgb, alpha)) to prevent black halo artifacts.
|
|
188
|
+
gl_FragColor = vec4(color.rgb, final_alpha);
|
|
162
189
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin
CHANGED
|
Binary file
|
|
@@ -540,6 +540,12 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
540
540
|
Math.abs(getDouble(gridParams, "lat_first", -1)) == 90.0;
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
+
private boolean isECMWFType(ReadableMap gridParams) {
|
|
544
|
+
if (gridParams == null) return false;
|
|
545
|
+
return getDouble(gridParams, "lon_first", -1) == 180.0 &&
|
|
546
|
+
getDouble(gridParams, "lat_first", -1) == 90.0;
|
|
547
|
+
}
|
|
548
|
+
|
|
543
549
|
private void generateGeometryData(ReadableMap gridDefMap, ArrayList<Float> vertices, ArrayList<Short> indices) {
|
|
544
550
|
ReadableMap gridParams = gridDefMap.getMap("grid_params");
|
|
545
551
|
if (gridParams == null) {
|
|
@@ -592,7 +598,6 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
592
598
|
return;
|
|
593
599
|
}
|
|
594
600
|
|
|
595
|
-
// Step 1: Extract grid parameters
|
|
596
601
|
int nx = gridParams.getInt("nx");
|
|
597
602
|
int ny = gridParams.getInt("ny");
|
|
598
603
|
double lon_first = getDouble(gridParams, "lon_first", 0.0);
|
|
@@ -604,34 +609,45 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
604
609
|
double lat_span = lat_last - lat_first;
|
|
605
610
|
boolean isSouthToNorth = lat_span > 0;
|
|
606
611
|
|
|
607
|
-
// Step 2:
|
|
608
|
-
|
|
609
|
-
double
|
|
612
|
+
// Step 2: Check if this is ECMWF and normalize longitudes
|
|
613
|
+
boolean isECMWF = isECMWFType(gridParams);
|
|
614
|
+
double data_lon_first_180 = lon_first;
|
|
615
|
+
double data_lon_last_180 = lon_last;
|
|
616
|
+
|
|
617
|
+
if (isECMWF) {
|
|
618
|
+
// Convert ECMWF's 180 to -180 range to -180 to 180
|
|
619
|
+
data_lon_first_180 = lon_first >= 180 ? lon_first - 360 : lon_first;
|
|
620
|
+
data_lon_last_180 = lon_last >= 180 ? lon_last - 360 : lon_last;
|
|
621
|
+
} else {
|
|
622
|
+
// For GFS and other models
|
|
623
|
+
data_lon_first_180 = lon_first > 180 ? lon_first - 360 : lon_first;
|
|
624
|
+
data_lon_last_180 = lon_last > 180 ? lon_last - 360 : lon_last;
|
|
625
|
+
}
|
|
626
|
+
|
|
610
627
|
double data_lon_range = data_lon_last_180 - data_lon_first_180;
|
|
611
628
|
|
|
612
629
|
// Step 3: Define mesh properties
|
|
613
|
-
int subdivisions_x = 120;
|
|
630
|
+
int subdivisions_x = 120;
|
|
614
631
|
int subdivisions_y = 60;
|
|
615
|
-
int verticesPerMesh = (subdivisions_y + 1) * (subdivisions_x + 1);
|
|
616
632
|
int verticesPerRow = subdivisions_x + 1;
|
|
617
633
|
final double TILE_SIZE = 512.0;
|
|
618
634
|
|
|
619
|
-
// Step 4: Generate three separate
|
|
635
|
+
// Step 4: Generate three separate meshes for wrapping
|
|
620
636
|
for (int world_copy = -1; world_copy <= 1; world_copy++) {
|
|
621
|
-
short vertexStartIndex = (short) (vertices.size() / 4);
|
|
637
|
+
short vertexStartIndex = (short) (vertices.size() / 4);
|
|
622
638
|
double lon_offset = world_copy * 360.0;
|
|
623
639
|
|
|
624
|
-
// Generate vertices for this
|
|
640
|
+
// Generate vertices for this world copy
|
|
625
641
|
for (int row = 0; row <= subdivisions_y; row++) {
|
|
626
642
|
for (int col = 0; col <= subdivisions_x; col++) {
|
|
627
643
|
float v_interp = (float) row / subdivisions_y;
|
|
628
644
|
float u_interp = (float) col / subdivisions_x;
|
|
629
645
|
|
|
630
|
-
// Vertex position
|
|
646
|
+
// Vertex position interpolated across data's native bounds
|
|
631
647
|
double vertex_lon = data_lon_first_180 + (u_interp * data_lon_range);
|
|
632
648
|
double vertex_lat = lat_first + (v_interp * lat_span);
|
|
633
649
|
|
|
634
|
-
// Convert to map coordinates
|
|
650
|
+
// Convert to map coordinates with world copy offset
|
|
635
651
|
double mercX_normalized = ((vertex_lon + lon_offset) + 180.0) / 360.0;
|
|
636
652
|
double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, vertex_lat));
|
|
637
653
|
double sinLatitude = Math.sin(Math.toRadians(clampedLat));
|
|
@@ -642,7 +658,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
642
658
|
vertices.add((float) mercX);
|
|
643
659
|
vertices.add((float) mercY);
|
|
644
660
|
|
|
645
|
-
// Texture coordinates
|
|
661
|
+
// Texture coordinates: clean 0.0 to 1.0 for each mesh
|
|
646
662
|
float tex_u = u_interp;
|
|
647
663
|
float tex_v = isSouthToNorth ? (1.0f - v_interp) : v_interp;
|
|
648
664
|
|
|
@@ -651,7 +667,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
651
667
|
}
|
|
652
668
|
}
|
|
653
669
|
|
|
654
|
-
// Generate indices for this
|
|
670
|
+
// Generate indices for this world copy
|
|
655
671
|
for (short row = 0; row < subdivisions_y; row++) {
|
|
656
672
|
for (short col = 0; col < subdivisions_x; col++) {
|
|
657
673
|
short tl = (short) (vertexStartIndex + row * verticesPerRow + col);
|
|
@@ -662,7 +678,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
662
678
|
if (isSouthToNorth) {
|
|
663
679
|
indices.add(tl); indices.add(bl); indices.add(tr);
|
|
664
680
|
indices.add(tr); indices.add(bl); indices.add(br);
|
|
665
|
-
} else {
|
|
681
|
+
} else {
|
|
666
682
|
indices.add(tl); indices.add(tr); indices.add(bl);
|
|
667
683
|
indices.add(bl); indices.add(tr); indices.add(br);
|
|
668
684
|
}
|
|
@@ -91,7 +91,6 @@ void main() {
|
|
|
91
91
|
vec2 v11_coord = (bl_texel_index + vec2(1.5, 1.5)) * texel_size;
|
|
92
92
|
|
|
93
93
|
if (u_is_ptype == 1) {
|
|
94
|
-
// --- PTYPE-SPECIFIC INTERPOLATION ---
|
|
95
94
|
float v00 = dequantize_val(get_value(v00_coord));
|
|
96
95
|
float v10 = dequantize_val(get_value(v10_coord));
|
|
97
96
|
float v01 = dequantize_val(get_value(v01_coord));
|
|
@@ -102,31 +101,59 @@ void main() {
|
|
|
102
101
|
float p01 = get_ptype_from_physical(v01);
|
|
103
102
|
float p11 = get_ptype_from_physical(v11);
|
|
104
103
|
|
|
105
|
-
//
|
|
106
|
-
float
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
104
|
+
// Calculate geometric weights
|
|
105
|
+
float w00 = (1.0 - f.x) * (1.0 - f.y);
|
|
106
|
+
float w10 = f.x * (1.0 - f.y);
|
|
107
|
+
float w01 = (1.0 - f.x) * f.y;
|
|
108
|
+
float w11 = f.x * f.y;
|
|
109
|
+
|
|
110
|
+
// 1. Calculate 'smoothing_weight' (The Raw Alpha)
|
|
111
|
+
// This is the sum of valid neighbor weights.
|
|
112
|
+
float smoothing_weight = 0.0;
|
|
113
|
+
if (p00 >= 0.0) smoothing_weight += w00;
|
|
114
|
+
if (p10 >= 0.0) smoothing_weight += w10;
|
|
115
|
+
if (p01 >= 0.0) smoothing_weight += w01;
|
|
116
|
+
if (p11 >= 0.0) smoothing_weight += w11;
|
|
117
|
+
|
|
118
|
+
if (smoothing_weight <= 0.0) discard;
|
|
119
|
+
|
|
120
|
+
// 2. Voting Logic for Color (The "Winning" Type)
|
|
121
|
+
// This preserves the sharp internal borders you liked.
|
|
122
|
+
float weight_type_0 = 0.0;
|
|
123
|
+
float weight_type_1 = 0.0;
|
|
124
|
+
float weight_type_2 = 0.0;
|
|
125
|
+
float weight_type_3 = 0.0;
|
|
126
|
+
|
|
127
|
+
if (p00 >= 0.0) { int t = int(p00); if(t==0) weight_type_0+=w00; else if(t==1) weight_type_1+=w00; else if(t==2) weight_type_2+=w00; else if(t==3) weight_type_3+=w00; }
|
|
128
|
+
if (p10 >= 0.0) { int t = int(p10); if(t==0) weight_type_0+=w10; else if(t==1) weight_type_1+=w10; else if(t==2) weight_type_2+=w10; else if(t==3) weight_type_3+=w10; }
|
|
129
|
+
if (p01 >= 0.0) { int t = int(p01); if(t==0) weight_type_0+=w01; else if(t==1) weight_type_1+=w01; else if(t==2) weight_type_2+=w01; else if(t==3) weight_type_3+=w01; }
|
|
130
|
+
if (p11 >= 0.0) { int t = int(p11); if(t==0) weight_type_0+=w11; else if(t==1) weight_type_1+=w11; else if(t==2) weight_type_2+=w11; else if(t==3) weight_type_3+=w11; }
|
|
131
|
+
|
|
132
|
+
float max_w = weight_type_0; float winning_type = 0.0;
|
|
133
|
+
if (weight_type_1 > max_w) { max_w = weight_type_1; winning_type = 1.0; }
|
|
134
|
+
if (weight_type_2 > max_w) { max_w = weight_type_2; winning_type = 2.0; }
|
|
135
|
+
if (weight_type_3 > max_w) { max_w = weight_type_3; winning_type = 3.0; }
|
|
136
|
+
|
|
137
|
+
// 3. Average value only among pixels of the winning type
|
|
138
|
+
float value_sum = 0.0;
|
|
139
|
+
float value_weight = 0.0;
|
|
140
|
+
|
|
141
|
+
if (p00 == winning_type) { value_sum += v00 * w00; value_weight += w00; }
|
|
142
|
+
if (p10 == winning_type) { value_sum += v10 * w10; value_weight += w10; }
|
|
143
|
+
if (p01 == winning_type) { value_sum += v01 * w01; value_weight += w01; }
|
|
144
|
+
if (p11 == winning_type) { value_sum += v11 * w11; value_weight += w11; }
|
|
145
|
+
|
|
146
|
+
if (value_weight <= 0.0) discard;
|
|
147
|
+
|
|
148
|
+
raw_value = value_sum / value_weight;
|
|
149
|
+
|
|
150
|
+
// 4. FIX FOR BLURRINESS: Sharpen the Alpha Edge
|
|
151
|
+
// Instead of a linear 0.0->1.0 fade, we use smoothstep to tighten the edge.
|
|
152
|
+
// This makes the outer border look like a smooth curve rather than a fuzzy fog.
|
|
153
|
+
total_weight = smoothstep(0.40, 0.60, smoothing_weight);
|
|
127
154
|
|
|
128
155
|
} else {
|
|
129
|
-
//
|
|
156
|
+
// ... (keep your existing standard interpolation else block here) ...
|
|
130
157
|
float v00_q = get_value(v00_coord);
|
|
131
158
|
float v10_q = get_value(v10_coord);
|
|
132
159
|
float v01_q = get_value(v01_coord);
|
|
@@ -144,8 +171,6 @@ void main() {
|
|
|
144
171
|
}
|
|
145
172
|
}
|
|
146
173
|
|
|
147
|
-
// --- COMMON FINAL STEPS ---
|
|
148
|
-
|
|
149
174
|
if (raw_value < u_data_range.x) {
|
|
150
175
|
discard;
|
|
151
176
|
}
|
|
@@ -158,5 +183,7 @@ void main() {
|
|
|
158
183
|
}
|
|
159
184
|
|
|
160
185
|
float final_alpha = color.a * u_opacity * total_weight;
|
|
161
|
-
|
|
186
|
+
|
|
187
|
+
// OUTPUT: Use Straight Alpha (vec4(rgb, alpha)) to prevent black halo artifacts.
|
|
188
|
+
gl_FragColor = vec4(color.rgb, final_alpha);
|
|
162
189
|
}
|
|
@@ -695,8 +695,21 @@ public class GridRenderLayer: NSObject {
|
|
|
695
695
|
let lat_span = lat_last - lat_first
|
|
696
696
|
let isSouthToNorth = lat_span > 0
|
|
697
697
|
|
|
698
|
-
|
|
699
|
-
let
|
|
698
|
+
// Check if this is ECMWF and normalize longitudes
|
|
699
|
+
let isECMWF = isECMWFType(gridParams: gridParams)
|
|
700
|
+
var data_lon_first_180 = lon_first
|
|
701
|
+
var data_lon_last_180 = lon_last
|
|
702
|
+
|
|
703
|
+
if isECMWF {
|
|
704
|
+
// Convert ECMWF's 180 to -180 range to -180 to 180
|
|
705
|
+
data_lon_first_180 = lon_first >= 180 ? lon_first - 360 : lon_first
|
|
706
|
+
data_lon_last_180 = lon_last >= 180 ? lon_last - 360 : lon_last
|
|
707
|
+
} else {
|
|
708
|
+
// For GFS and other models
|
|
709
|
+
data_lon_first_180 = lon_first > 180 ? lon_first - 360 : lon_first
|
|
710
|
+
data_lon_last_180 = lon_last > 180 ? lon_last - 360 : lon_last
|
|
711
|
+
}
|
|
712
|
+
|
|
700
713
|
let data_lon_range = data_lon_last_180 - data_lon_first_180
|
|
701
714
|
|
|
702
715
|
let subdivisions_x = 120
|
|
@@ -705,7 +718,7 @@ public class GridRenderLayer: NSObject {
|
|
|
705
718
|
let TILE_SIZE: Double = 512.0
|
|
706
719
|
|
|
707
720
|
let worldCopies = (data_lon_range > 300) ? [-1, 0, 1] : [0]
|
|
708
|
-
|
|
721
|
+
|
|
709
722
|
for world_copy in worldCopies {
|
|
710
723
|
let vertexStartIndex = UInt16(vertices.count / 4)
|
|
711
724
|
let lon_offset = Double(world_copy) * 360.0
|
|
@@ -755,6 +768,11 @@ public class GridRenderLayer: NSObject {
|
|
|
755
768
|
return (gridParams["lon_first"] as? Double) == 0.0 &&
|
|
756
769
|
abs((gridParams["lat_first"] as? Double) ?? -1) == 90.0
|
|
757
770
|
}
|
|
771
|
+
|
|
772
|
+
private func isECMWFType(gridParams: [String: Any]) -> Bool {
|
|
773
|
+
return (gridParams["lon_first"] as? Double) == 180.0 &&
|
|
774
|
+
(gridParams["lat_first"] as? Double) == 90.0
|
|
775
|
+
}
|
|
758
776
|
|
|
759
777
|
private func lonLatToMercator(lon: Double, lat: Double, tileSize: Double) -> (x: Float, y: Float) {
|
|
760
778
|
let mercX_normalized = (lon + 180.0) / 360.0
|
|
@@ -116,7 +116,7 @@ fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
|
116
116
|
float2 v11_coord = (bl_texel_index + float2(1.5, 1.5)) * texel_size;
|
|
117
117
|
|
|
118
118
|
if (uniforms.isPtype == 1) {
|
|
119
|
-
// --- PTYPE-SPECIFIC INTERPOLATION
|
|
119
|
+
// --- ENHANCED PTYPE-SPECIFIC INTERPOLATION ---
|
|
120
120
|
float v00 = dequantize_val(get_value(dataTexture, dataSampler, v00_coord, uniforms), uniforms);
|
|
121
121
|
float v10 = dequantize_val(get_value(dataTexture, dataSampler, v10_coord, uniforms), uniforms);
|
|
122
122
|
float v01 = dequantize_val(get_value(dataTexture, dataSampler, v01_coord, uniforms), uniforms);
|
|
@@ -127,25 +127,162 @@ fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
|
127
127
|
float p01 = get_ptype_from_physical(v01, uniforms);
|
|
128
128
|
float p11 = get_ptype_from_physical(v11, uniforms);
|
|
129
129
|
|
|
130
|
-
//
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
// Count unique valid precipitation types
|
|
131
|
+
bool has_type_0 = false;
|
|
132
|
+
bool has_type_1 = false;
|
|
133
|
+
bool has_type_2 = false;
|
|
134
|
+
bool has_type_3 = false;
|
|
135
|
+
int valid_count = 0;
|
|
136
136
|
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
if (p00 >= 0.0) {
|
|
138
|
+
int ptype = int(p00);
|
|
139
|
+
if (ptype == 0) has_type_0 = true;
|
|
140
|
+
else if (ptype == 1) has_type_1 = true;
|
|
141
|
+
else if (ptype == 2) has_type_2 = true;
|
|
142
|
+
else if (ptype == 3) has_type_3 = true;
|
|
143
|
+
valid_count++;
|
|
144
|
+
}
|
|
145
|
+
if (p10 >= 0.0) {
|
|
146
|
+
int ptype = int(p10);
|
|
147
|
+
if (ptype == 0) has_type_0 = true;
|
|
148
|
+
else if (ptype == 1) has_type_1 = true;
|
|
149
|
+
else if (ptype == 2) has_type_2 = true;
|
|
150
|
+
else if (ptype == 3) has_type_3 = true;
|
|
151
|
+
valid_count++;
|
|
152
|
+
}
|
|
153
|
+
if (p01 >= 0.0) {
|
|
154
|
+
int ptype = int(p01);
|
|
155
|
+
if (ptype == 0) has_type_0 = true;
|
|
156
|
+
else if (ptype == 1) has_type_1 = true;
|
|
157
|
+
else if (ptype == 2) has_type_2 = true;
|
|
158
|
+
else if (ptype == 3) has_type_3 = true;
|
|
159
|
+
valid_count++;
|
|
160
|
+
}
|
|
161
|
+
if (p11 >= 0.0) {
|
|
162
|
+
int ptype = int(p11);
|
|
163
|
+
if (ptype == 0) has_type_0 = true;
|
|
164
|
+
else if (ptype == 1) has_type_1 = true;
|
|
165
|
+
else if (ptype == 2) has_type_2 = true;
|
|
166
|
+
else if (ptype == 3) has_type_3 = true;
|
|
167
|
+
valid_count++;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (valid_count == 0) discard_fragment();
|
|
171
|
+
|
|
172
|
+
// Count how many unique types we have
|
|
173
|
+
int unique_types = 0;
|
|
174
|
+
if (has_type_0) unique_types++;
|
|
175
|
+
if (has_type_1) unique_types++;
|
|
176
|
+
if (has_type_2) unique_types++;
|
|
177
|
+
if (has_type_3) unique_types++;
|
|
178
|
+
|
|
179
|
+
if (unique_types == 1) {
|
|
180
|
+
// ALL SAME TYPE - smooth interpolation across all valid pixels
|
|
181
|
+
float total_value = 0.0;
|
|
182
|
+
float total_weight = 0.0;
|
|
183
|
+
|
|
184
|
+
if (p00 >= 0.0) {
|
|
185
|
+
float weight = (1.0 - f.x) * (1.0 - f.y);
|
|
186
|
+
total_value += v00 * weight;
|
|
187
|
+
total_weight += weight;
|
|
188
|
+
}
|
|
189
|
+
if (p10 >= 0.0) {
|
|
190
|
+
float weight = f.x * (1.0 - f.y);
|
|
191
|
+
total_value += v10 * weight;
|
|
192
|
+
total_weight += weight;
|
|
193
|
+
}
|
|
194
|
+
if (p01 >= 0.0) {
|
|
195
|
+
float weight = (1.0 - f.x) * f.y;
|
|
196
|
+
total_value += v01 * weight;
|
|
197
|
+
total_weight += weight;
|
|
198
|
+
}
|
|
199
|
+
if (p11 >= 0.0) {
|
|
200
|
+
float weight = f.x * f.y;
|
|
201
|
+
total_value += v11 * weight;
|
|
202
|
+
total_weight += weight;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
206
|
+
raw_value = total_value / total_weight;
|
|
207
|
+
|
|
208
|
+
} else {
|
|
209
|
+
// MULTIPLE TYPES - weighted voting to determine dominant type
|
|
210
|
+
float type_weight_0 = 0.0;
|
|
211
|
+
float type_weight_1 = 0.0;
|
|
212
|
+
float type_weight_2 = 0.0;
|
|
213
|
+
float type_weight_3 = 0.0;
|
|
214
|
+
|
|
215
|
+
if (p00 >= 0.0) {
|
|
216
|
+
float w = (1.0 - f.x) * (1.0 - f.y);
|
|
217
|
+
int ptype = int(p00);
|
|
218
|
+
if (ptype == 0) type_weight_0 += w;
|
|
219
|
+
else if (ptype == 1) type_weight_1 += w;
|
|
220
|
+
else if (ptype == 2) type_weight_2 += w;
|
|
221
|
+
else if (ptype == 3) type_weight_3 += w;
|
|
222
|
+
}
|
|
223
|
+
if (p10 >= 0.0) {
|
|
224
|
+
float w = f.x * (1.0 - f.y);
|
|
225
|
+
int ptype = int(p10);
|
|
226
|
+
if (ptype == 0) type_weight_0 += w;
|
|
227
|
+
else if (ptype == 1) type_weight_1 += w;
|
|
228
|
+
else if (ptype == 2) type_weight_2 += w;
|
|
229
|
+
else if (ptype == 3) type_weight_3 += w;
|
|
230
|
+
}
|
|
231
|
+
if (p01 >= 0.0) {
|
|
232
|
+
float w = (1.0 - f.x) * f.y;
|
|
233
|
+
int ptype = int(p01);
|
|
234
|
+
if (ptype == 0) type_weight_0 += w;
|
|
235
|
+
else if (ptype == 1) type_weight_1 += w;
|
|
236
|
+
else if (ptype == 2) type_weight_2 += w;
|
|
237
|
+
else if (ptype == 3) type_weight_3 += w;
|
|
238
|
+
}
|
|
239
|
+
if (p11 >= 0.0) {
|
|
240
|
+
float w = f.x * f.y;
|
|
241
|
+
int ptype = int(p11);
|
|
242
|
+
if (ptype == 0) type_weight_0 += w;
|
|
243
|
+
else if (ptype == 1) type_weight_1 += w;
|
|
244
|
+
else if (ptype == 2) type_weight_2 += w;
|
|
245
|
+
else if (ptype == 3) type_weight_3 += w;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// Find the type with the highest weight at this pixel location
|
|
249
|
+
float max_type_weight = 0.0;
|
|
250
|
+
float winning_type = -1.0;
|
|
251
|
+
if (type_weight_0 > max_type_weight) { max_type_weight = type_weight_0; winning_type = 0.0; }
|
|
252
|
+
if (type_weight_1 > max_type_weight) { max_type_weight = type_weight_1; winning_type = 1.0; }
|
|
253
|
+
if (type_weight_2 > max_type_weight) { max_type_weight = type_weight_2; winning_type = 2.0; }
|
|
254
|
+
if (type_weight_3 > max_type_weight) { max_type_weight = type_weight_3; winning_type = 3.0; }
|
|
255
|
+
|
|
256
|
+
if (winning_type == -1.0) discard_fragment();
|
|
257
|
+
|
|
258
|
+
// Now smoothly interpolate only among pixels of the winning type
|
|
259
|
+
float total_value = 0.0;
|
|
260
|
+
float total_weight = 0.0;
|
|
261
|
+
|
|
262
|
+
if (p00 == winning_type) {
|
|
263
|
+
float weight = (1.0 - f.x) * (1.0 - f.y);
|
|
264
|
+
total_value += v00 * weight;
|
|
265
|
+
total_weight += weight;
|
|
266
|
+
}
|
|
267
|
+
if (p10 == winning_type) {
|
|
268
|
+
float weight = f.x * (1.0 - f.y);
|
|
269
|
+
total_value += v10 * weight;
|
|
270
|
+
total_weight += weight;
|
|
271
|
+
}
|
|
272
|
+
if (p01 == winning_type) {
|
|
273
|
+
float weight = (1.0 - f.x) * f.y;
|
|
274
|
+
total_value += v01 * weight;
|
|
275
|
+
total_weight += weight;
|
|
276
|
+
}
|
|
277
|
+
if (p11 == winning_type) {
|
|
278
|
+
float weight = f.x * f.y;
|
|
279
|
+
total_value += v11 * weight;
|
|
280
|
+
total_weight += weight;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
284
|
+
raw_value = total_value / total_weight;
|
|
285
|
+
}
|
|
149
286
|
|
|
150
287
|
// Force full alpha to prevent dark borders between ptype regions
|
|
151
288
|
alpha_multiplier = 1.0;
|
|
Binary file
|
|
Binary file
|
|
@@ -726,7 +726,7 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
726
726
|
run
|
|
727
727
|
} = core.state;
|
|
728
728
|
if (isMRMS) {
|
|
729
|
-
// --- MRMS LOGIC
|
|
729
|
+
// --- MRMS LOGIC (Keep existing logic) ---
|
|
730
730
|
const oldTimestamps = new Set(core.mrmsStatus?.[currentVariable] || []);
|
|
731
731
|
const mrmsStatus = await core.fetchMRMSStatus(true);
|
|
732
732
|
const newTimestamps = mrmsStatus?.[currentVariable] || [];
|
|
@@ -736,6 +736,7 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
736
736
|
core.mrmsStatus = mrmsStatus;
|
|
737
737
|
core._emitStateChange(); // Update UI slider without changing selection
|
|
738
738
|
|
|
739
|
+
// ... (Keep your existing preloading logic here) ...
|
|
739
740
|
const {
|
|
740
741
|
corners,
|
|
741
742
|
gridDef
|
|
@@ -751,12 +752,7 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
751
752
|
const y = frameDate.getUTCFullYear(),
|
|
752
753
|
m = (frameDate.getUTCMonth() + 1).toString().padStart(2, '0'),
|
|
753
754
|
d = frameDate.getUTCDate().toString().padStart(2, '0');
|
|
754
|
-
|
|
755
|
-
// --- THIS IS THE FIX ---
|
|
756
|
-
// Changed 'variable' to 'currentVariable'
|
|
757
755
|
const resourcePath = `/grids/mrms/${y}${m}${d}/${frame}/0/${currentVariable}/0`;
|
|
758
|
-
// --- END FIX ---
|
|
759
|
-
|
|
760
756
|
const url = `${core.baseGridUrl}${resourcePath}?apiKey=${core.apiKey}`;
|
|
761
757
|
WeatherFrameProcessorModule.processFrame({
|
|
762
758
|
url,
|
|
@@ -794,19 +790,10 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
794
790
|
});
|
|
795
791
|
}
|
|
796
792
|
} else {
|
|
797
|
-
// --- MODEL LOGIC ---
|
|
798
793
|
const modelStatus = await core.fetchModelStatus(true);
|
|
794
|
+
core._emitStateChange();
|
|
799
795
|
const latestRun = findLatestModelRun(modelStatus, currentModel);
|
|
800
796
|
if (!latestRun) return;
|
|
801
|
-
const currentRunKey = `${date}:${run}`;
|
|
802
|
-
const latestRunKey = `${latestRun.date}:${latestRun.run}`;
|
|
803
|
-
if (latestRunKey > currentRunKey) {
|
|
804
|
-
// This preserves the current forecastHour while changing the run
|
|
805
|
-
await core.setState({
|
|
806
|
-
date: latestRun.date,
|
|
807
|
-
run: latestRun.run
|
|
808
|
-
});
|
|
809
|
-
}
|
|
810
797
|
}
|
|
811
798
|
}, [core]);
|
|
812
799
|
(0, _react.useEffect)(() => {
|