@aguacerowx/react-native 0.0.21 → 0.0.23

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.
Files changed (100) hide show
  1. package/aguacerowx-react-native.podspec +5 -20
  2. package/android/build/.transforms/42e9b8fa82d77a1c205db5bf0d0ed519/transformed/classes/classes_dex/classes.dex +0 -0
  3. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.dex +0 -0
  4. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer.dex +0 -0
  5. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  6. package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  7. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  8. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  9. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  10. package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +18 -8
  11. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  12. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  13. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  14. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
  15. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
  16. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  17. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +8 -1
  18. package/android/src/main/res/raw/fragment_shader.glsl +18 -8
  19. package/ios/FragmentUniforms.swift +1 -0
  20. package/ios/GridRenderLayer.swift +117 -109
  21. package/ios/GridRenderLayerBridge.swift +11 -3
  22. package/ios/GridRenderLayerView.h +15 -1
  23. package/ios/GridRenderLayerView.m +65 -28
  24. package/ios/Shaders.metal +25 -13
  25. package/ios/compiled-shaders/Shaders-device.metallib +0 -0
  26. package/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
  27. package/lib/commonjs/aguacerowx-react-native.podspec +5 -20
  28. package/lib/commonjs/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  29. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  30. package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  31. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  32. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  33. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +18 -8
  34. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  35. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  36. package/lib/commonjs/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  37. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
  38. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
  39. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  40. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +8 -1
  41. package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +18 -8
  42. package/lib/commonjs/ios/FragmentUniforms.swift +1 -0
  43. package/lib/commonjs/ios/GridRenderLayer.swift +117 -109
  44. package/lib/commonjs/ios/GridRenderLayerBridge.swift +11 -3
  45. package/lib/commonjs/ios/GridRenderLayerView.h +15 -1
  46. package/lib/commonjs/ios/GridRenderLayerView.m +65 -28
  47. package/lib/commonjs/ios/Shaders.metal +25 -13
  48. package/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
  49. package/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
  50. package/lib/commonjs/package.json +2 -2
  51. package/lib/commonjs/scripts/compile-shaders.js.map +1 -1
  52. package/lib/commonjs/src/WeatherLayerManager.js +50 -5
  53. package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  54. package/lib/module/aguacerowx-react-native.podspec +5 -20
  55. package/lib/module/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  56. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  57. package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  58. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  59. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  60. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +18 -8
  61. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  62. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  63. package/lib/module/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  64. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
  65. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
  66. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  67. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +8 -1
  68. package/lib/module/android/src/main/res/raw/fragment_shader.glsl +18 -8
  69. package/lib/module/ios/FragmentUniforms.swift +1 -0
  70. package/lib/module/ios/GridRenderLayer.swift +117 -109
  71. package/lib/module/ios/GridRenderLayerBridge.swift +11 -3
  72. package/lib/module/ios/GridRenderLayerView.h +15 -1
  73. package/lib/module/ios/GridRenderLayerView.m +65 -28
  74. package/lib/module/ios/Shaders.metal +25 -13
  75. package/lib/module/ios/compiled-shaders/Shaders-device.metallib +0 -0
  76. package/lib/module/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
  77. package/lib/module/lib/commonjs/aguacerowx-react-native.podspec +5 -20
  78. package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +1 -0
  79. package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +117 -109
  80. package/lib/module/lib/commonjs/ios/GridRenderLayerBridge.swift +11 -3
  81. package/lib/module/lib/commonjs/ios/GridRenderLayerView.h +15 -1
  82. package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +65 -28
  83. package/lib/module/lib/commonjs/ios/Shaders.metal +25 -13
  84. package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
  85. package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
  86. package/lib/module/lib/commonjs/package.json +2 -2
  87. package/lib/module/lib/commonjs/scripts/compile-shaders.js.map +1 -1
  88. package/lib/module/lib/commonjs/src/WeatherLayerManager.js +50 -5
  89. package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  90. package/lib/module/package.json +2 -2
  91. package/lib/module/scripts/compile-shaders.js.map +1 -1
  92. package/lib/module/src/WeatherLayerManager.js +50 -5
  93. package/lib/module/src/WeatherLayerManager.js.map +1 -1
  94. package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
  95. package/package.json +2 -2
  96. package/src/WeatherLayerManager.js +208 -165
  97. package/ios/compiled-shaders/Shaders.metallib +0 -0
  98. package/lib/commonjs/ios/compiled-shaders/Shaders.metallib +0 -0
  99. package/lib/module/ios/compiled-shaders/Shaders.metallib +0 -0
  100. package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders.metallib +0 -0
@@ -10,8 +10,6 @@ import Foundation
10
10
  belowLayerId: String?
11
11
  ) -> Bool {
12
12
  let position: LayerPosition? = belowLayerId.map { .below($0) }
13
-
14
- // Create a CustomLayer object
15
13
  var customLayer = CustomLayer(id: layerId, renderer: layerHost)
16
14
 
17
15
  do {
@@ -23,8 +21,18 @@ import Foundation
23
21
  return false
24
22
  }
25
23
  }
26
-
24
+
27
25
  @objc public static func triggerRepaint(on mapView: MapView) {
28
26
  mapView.mapboxMap.triggerRepaint()
29
27
  }
28
+
29
+ // ADD THIS NEW METHOD
30
+ @objc public static func layerExists(in mapView: MapView, layerId: String) -> Bool {
31
+ do {
32
+ _ = try mapView.mapboxMap.layer(withId: layerId)
33
+ return true
34
+ } catch {
35
+ return false
36
+ }
37
+ }
30
38
  }
@@ -1,17 +1,31 @@
1
1
  #import <UIKit/UIKit.h>
2
+ #import <React/RCTComponent.h>
3
+
2
4
  @class GridRenderLayer;
3
5
  @class MapView;
6
+
4
7
  NS_ASSUME_NONNULL_BEGIN
8
+
5
9
  @interface GridRenderLayerView : UIView
10
+
6
11
  @property (nonatomic, strong) GridRenderLayer *layerInstance;
7
12
  @property (nonatomic, weak) MapView *mapView;
8
13
  @property (nonatomic, strong) NSString *layerId;
9
14
  @property (nonatomic, strong, nullable) NSString *belowID;
15
+
10
16
  // Property setters for React Native
11
17
  - (void)setOpacity:(float)opacity;
12
18
  - (void)setDataRange:(NSArray *)dataRange;
13
19
  - (void)setSmoothing:(BOOL)smoothing;
14
20
  - (void)setBelowID:(NSString *)belowID;
15
- - (void)setVariable:(NSString *)variable; // ADD THIS LINE
21
+ - (void)setVariable:(NSString *)variable;
22
+
23
+ // ADD THESE METHOD DECLARATIONS
24
+ - (void)waitForStyleLoadAndAddLayer;
25
+ - (void)pollForLayerExistence;
26
+ - (void)findMapViewAndAddLayerInView:(UIView *)view;
27
+ - (void)addLayerToMap;
28
+
16
29
  @end
30
+
17
31
  NS_ASSUME_NONNULL_END
@@ -69,11 +69,28 @@
69
69
 
70
70
  - (void)didMoveToWindow {
71
71
  [super didMoveToWindow];
72
+ RCTLogInfo(@"🔵 [GridRenderLayerView] didMoveToWindow called, window=%@, isLayerAdded=%d", self.window ? @"YES" : @"NO", self.isLayerAdded);
72
73
  if (self.window && !self.isLayerAdded) {
74
+ [self findMapViewAndAddLayerInView:self.window];
75
+ }
76
+ }
77
+
78
+ - (void)layoutSubviews {
79
+ [super layoutSubviews];
80
+
81
+ static dispatch_once_t onceToken;
82
+ dispatch_once(&onceToken, ^{
83
+ RCTLogInfo(@"🔵 [GridRenderLayerView] layoutSubviews called (first time)");
73
84
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
74
- [self findMapViewAndAddLayerInView:self.window]; // Start from window, not superview
85
+ if (!self.isLayerAdded) {
86
+ RCTLogInfo(@"🔍 [GridRenderLayerView] Attempting to find map from layoutSubviews");
87
+ UIView *searchRoot = self.window ? self.window : self.superview;
88
+ if (searchRoot) {
89
+ [self findMapViewAndAddLayerInView:searchRoot];
90
+ }
91
+ }
75
92
  });
76
- }
93
+ });
77
94
  }
78
95
 
79
96
  - (void)findMapViewAndAddLayerInView:(UIView *)view {
@@ -81,13 +98,13 @@
81
98
  return;
82
99
  }
83
100
 
101
+ RCTLogInfo(@"🔍 [GridRenderLayerView] Searching for MapView from: %@", NSStringFromClass([view class]));
102
+
84
103
  NSString *className = NSStringFromClass([view class]);
85
104
 
86
- // Check if this is RNMBXMapView - the wrapper
87
105
  if ([className isEqualToString:@"RNMBXMapView"]) {
88
106
  RCTLogInfo(@"✅ [GridRenderLayerView] Found RNMBXMapView!");
89
107
 
90
- // The first subview should be MapboxMaps.MapView
91
108
  if (view.subviews.count > 0) {
92
109
  UIView *firstSubview = view.subviews[0];
93
110
  NSString *subviewClass = NSStringFromClass([firstSubview class]);
@@ -96,7 +113,7 @@
96
113
  if ([subviewClass containsString:@"MapboxMaps.MapView"] || [subviewClass isEqualToString:@"MapView"]) {
97
114
  RCTLogInfo(@"✅ [GridRenderLayerView] Found actual MapboxMaps.MapView!");
98
115
  self.mapView = (MapView *)firstSubview;
99
- [self addLayerToMap];
116
+ [self waitForStyleLoadAndAddLayer];
100
117
  return;
101
118
  }
102
119
  }
@@ -105,7 +122,6 @@
105
122
  return;
106
123
  }
107
124
 
108
- // Recursively search all subviews
109
125
  for (UIView *subview in view.subviews) {
110
126
  [self findMapViewAndAddLayerInView:subview];
111
127
  if (self.isLayerAdded) {
@@ -114,14 +130,42 @@
114
130
  }
115
131
  }
116
132
 
117
- - (void)logViewHierarchy:(UIView *)view depth:(int)depth {
118
- NSString *indent = [@"" stringByPaddingToLength:depth * 2 withString:@" " startingAtIndex:0];
119
- NSString *className = NSStringFromClass([view class]);
120
- RCTLogInfo(@"%@└─ %@", indent, className);
133
+ - (void)waitForStyleLoadAndAddLayer {
134
+ if (!self.mapView) {
135
+ return;
136
+ }
121
137
 
122
- for (UIView *subview in view.subviews) {
123
- [self logViewHierarchy:subview depth:depth + 1];
138
+ NSString *targetLayer = self.belowID ?: @"AML_-_terrain";
139
+
140
+ // Check if the target layer already exists
141
+ if ([GridRenderLayerBridge layerExistsIn:self.mapView layerId:targetLayer]) {
142
+ RCTLogInfo(@"✅ [GridRenderLayerView] Target layer '%@' already exists, adding immediately", targetLayer);
143
+ [self addLayerToMap];
144
+ return;
145
+ }
146
+
147
+ // If not, start polling
148
+ RCTLogInfo(@"⏳ [GridRenderLayerView] Waiting for layer '%@' to exist...", targetLayer);
149
+ [self pollForLayerExistence];
150
+ }
151
+
152
+ - (void)pollForLayerExistence {
153
+ if (self.isLayerAdded || !self.mapView) {
154
+ return;
155
+ }
156
+
157
+ NSString *targetLayer = self.belowID ?: @"AML_-_terrain";
158
+
159
+ if ([GridRenderLayerBridge layerExistsIn:self.mapView layerId:targetLayer]) {
160
+ RCTLogInfo(@"✅ [GridRenderLayerView] Target layer '%@' now exists!", targetLayer);
161
+ [self addLayerToMap];
162
+ return;
124
163
  }
164
+
165
+ // Try again in 100ms
166
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
167
+ [self pollForLayerExistence];
168
+ });
125
169
  }
126
170
 
127
171
  - (void)addLayerToMap {
@@ -138,20 +182,6 @@
138
182
  return;
139
183
  }
140
184
 
141
- // Get the mapboxMap property using runtime
142
- Ivar mapboxMapIvar = class_getInstanceVariable([self.mapView class], "mapboxMap");
143
- if (!mapboxMapIvar) {
144
- RCTLogError(@"❌ [GridRenderLayerView] Could not find mapboxMap ivar");
145
- return;
146
- }
147
-
148
- id mapboxMap = object_getIvar(self.mapView, mapboxMapIvar);
149
- if (!mapboxMap) {
150
- RCTLogError(@"❌ [GridRenderLayerView] mapboxMap is nil");
151
- return;
152
- }
153
-
154
- // Use the Swift bridge to add the layer
155
185
  BOOL success = [GridRenderLayerBridge addCustomLayerTo:self.mapView
156
186
  layerHost:customLayer
157
187
  layerId:self.layerId
@@ -167,9 +197,7 @@
167
197
  usingBlock:^(NSNotification *note) {
168
198
  RCTLogInfo(@"🔄 [GridRenderLayerView] Received repaint notification");
169
199
  if (self.mapView) {
170
- RCTLogInfo(@" ✅ Calling Swift bridge triggerRepaint");
171
200
  [GridRenderLayerBridge triggerRepaintOn:self.mapView];
172
- RCTLogInfo(@" ✅ Called triggerRepaint via Swift bridge");
173
201
  }
174
202
  }];
175
203
  } else {
@@ -177,6 +205,15 @@
177
205
  }
178
206
  }
179
207
 
208
+ - (void)logViewHierarchy:(UIView *)view depth:(int)depth {
209
+ NSString *indent = [@"" stringByPaddingToLength:depth * 2 withString:@" " startingAtIndex:0];
210
+ NSString *className = NSStringFromClass([view class]);
211
+ RCTLogInfo(@"%@└─ %@", indent, className);
212
+
213
+ for (UIView *subview in view.subviews) {
214
+ [self logViewHierarchy:subview depth:depth + 1];
215
+ }
216
+ }
180
217
  - (void)removeFromSuperview {
181
218
  if (self.mapView && self.isLayerAdded) {
182
219
  id mapboxMap = [self.mapView valueForKey:@"mapboxMap"];
package/ios/Shaders.metal CHANGED
@@ -22,8 +22,9 @@ struct FragmentUniforms {
22
22
  float missingQuantized;
23
23
  float2 textureSize;
24
24
  int smoothing;
25
- int scaleType; // 0 for linear, 1 for sqrt
26
- int isPtype; // ADD THIS
25
+ int scaleType;
26
+ int isPtype;
27
+ int isMRMS;
27
28
  };
28
29
 
29
30
  // --- Vertex Shader (Unchanged) ---
@@ -64,15 +65,26 @@ float get_value(texture2d<float, access::sample> dataTexture, sampler dataSample
64
65
  }
65
66
 
66
67
  // Maps a physical value to a precipitation type category
67
- float get_ptype_from_physical(float val) {
68
- if (val < 0.0) return -1.0; // Missing/Invalid
69
- if (val < 100.0) return 0.0; // Rain
70
- if (val < 200.0) return 1.0; // Mix
71
- if (val < 300.0) return 2.0; // Snow
72
- return 3.0; // Pellets
68
+ // Maps a physical value to a precipitation type category
69
+ float get_ptype_from_physical(float val, constant FragmentUniforms &uniforms) { // ADD uniforms parameter
70
+ if (val < 0.0) return -1.0;
71
+
72
+ if (uniforms.isMRMS == 1) { // ADD THIS BRANCH
73
+ // MRMS: 0-100 rain, 100-200 snow, 200-300 freezing rain
74
+ if (val < 100.0) return 0.0;
75
+ if (val < 200.0) return 1.0;
76
+ if (val < 300.0) return 2.0;
77
+ return -1.0;
78
+ } else {
79
+ // Models: 0-100 rain, 100-200 snow, 200-300 freezing rain, 300-400 ice pellets
80
+ if (val < 100.0) return 0.0;
81
+ if (val < 200.0) return 1.0;
82
+ if (val < 300.0) return 2.0;
83
+ if (val < 400.0) return 3.0;
84
+ return -1.0;
85
+ }
73
86
  }
74
87
 
75
-
76
88
  // --- Main Fragment Shader ---
77
89
  fragment float4 fragment_main(RasterizerData in [[stage_in]],
78
90
  constant FragmentUniforms &uniforms [[buffer(0)]],
@@ -110,10 +122,10 @@ fragment float4 fragment_main(RasterizerData in [[stage_in]],
110
122
  float v01 = dequantize_val(get_value(dataTexture, dataSampler, v01_coord, uniforms), uniforms);
111
123
  float v11 = dequantize_val(get_value(dataTexture, dataSampler, v11_coord, uniforms), uniforms);
112
124
 
113
- float p00 = get_ptype_from_physical(v00);
114
- float p10 = get_ptype_from_physical(v10);
115
- float p01 = get_ptype_from_physical(v01);
116
- float p11 = get_ptype_from_physical(v11);
125
+ float p00 = get_ptype_from_physical(v00, uniforms);
126
+ float p10 = get_ptype_from_physical(v10, uniforms);
127
+ float p01 = get_ptype_from_physical(v01, uniforms);
128
+ float p11 = get_ptype_from_physical(v11, uniforms);
117
129
 
118
130
  // Determine the dominant precipitation type for this pixel
119
131
  float dominant_ptype = -1.0;
@@ -24,26 +24,11 @@ Pod::Spec.new do |s|
24
24
  'DEFINES_MODULE' => 'YES'
25
25
  }
26
26
 
27
- s.resources = ['ios/compiled-shaders/*.metallib', 'ios/*.metal']
28
-
29
- s.script_phases = [
30
- {
31
- :name => 'Copy Metal Shaders',
32
- :script => 'echo "🔨 Copying Metal shaders..."
33
- SHADER_DIR="${PODS_TARGET_SRCROOT}/ios/compiled-shaders"
34
- METAL_SOURCE="${PODS_TARGET_SRCROOT}/ios/Shaders.metal"
35
-
36
- if [ -f "$SHADER_DIR/Shaders.metallib" ]; then
37
- cp -v "$SHADER_DIR/Shaders.metallib" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" || true
38
- echo "✅ Pre-compiled Metal shader copied"
39
- elif [ -f "$METAL_SOURCE" ]; then
40
- echo "⚠️ No pre-compiled shader found, will compile from source"
41
- cp -v "$METAL_SOURCE" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/" || true
42
- else
43
- echo "❌ No Metal shaders found!"
44
- fi',
45
- :execution_position => :before_compile
46
- }
27
+ # Include both pre-compiled shaders AND source as fallback
28
+ s.resources = [
29
+ 'ios/compiled-shaders/Shaders-simulator.metallib',
30
+ 'ios/compiled-shaders/Shaders-device.metallib',
31
+ 'ios/Shaders.metal'
47
32
  ]
48
33
 
49
34
  s.source_files = "ios/**/*.{h,m,mm,swift}", "ios/generated/**/*.{h,m,mm,cpp}"
@@ -1,4 +1,4 @@
1
- #Mon Nov 17 23:39:32 EST 2025
1
+ #Tue Nov 18 11:28:28 EST 2025
2
2
  com.aguacerowx.reactnative.aguacerowx-react-native-main-6\:/raw/fragment_shader.glsl=C\:\\Users\\my41m\\aguacero\\aguacero-sdks\\packages\\react-native\\android\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\raw\\fragment_shader.glsl
3
3
  com.aguacerowx.reactnative.aguacerowx-react-native-main-6\:/raw/vertex_shader.glsl=C\:\\Users\\my41m\\aguacero\\aguacero-sdks\\packages\\react-native\\android\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\raw\\vertex_shader.glsl
4
4
  com.aguacerowx.reactnative.aguacerowx-react-native-main-6\:/raw/debug_vertex_shader.glsl=C\:\\Users\\my41m\\aguacero\\aguacero-sdks\\packages\\react-native\\android\\build\\intermediates\\packaged_res\\debug\\packageDebugResources\\raw\\debug_vertex_shader.glsl
@@ -1,5 +1,3 @@
1
- // packages/react-native/android/src/main/res/raw/fragment_shader.glsl
2
-
3
1
  precision highp float;
4
2
  varying vec2 v_texCoord;
5
3
 
@@ -19,7 +17,8 @@ uniform vec2 u_data_range;
19
17
  // Rendering parameters
20
18
  uniform vec2 u_texture_size;
21
19
  uniform int u_smoothing;
22
- uniform int u_is_ptype; // ADDED: Flag for ptype variables
20
+ uniform int u_is_ptype; // Flag for ptype variables
21
+ uniform int u_is_mrms; // NEW: Flag for MRMS data
23
22
 
24
23
  // --- HELPER FUNCTIONS ---
25
24
 
@@ -49,11 +48,22 @@ float get_value(vec2 coord) {
49
48
 
50
49
  // Maps a physical value to a precipitation type category
51
50
  float get_ptype_from_physical(float val) {
52
- if (val < 0.0) return -1.0; // Missing/Invalid
53
- if (val < 100.0) return 0.0; // Rain
54
- if (val < 200.0) return 1.0; // Mix
55
- if (val < 300.0) return 2.0; // Snow
56
- return 3.0; // Pellets
51
+ if (val < 0.0) return -1.0;
52
+
53
+ if (u_is_mrms == 1) {
54
+ // MRMS: 0-100 rain, 100-200 snow, 200-300 freezing rain
55
+ if (val < 100.0) return 0.0;
56
+ if (val < 200.0) return 1.0;
57
+ if (val < 300.0) return 2.0;
58
+ return -1.0;
59
+ } else {
60
+ // Models: 0-100 rain, 100-200 snow, 200-300 freezing rain, 300-400 ice pellets
61
+ if (val < 100.0) return 0.0;
62
+ if (val < 200.0) return 1.0;
63
+ if (val < 300.0) return 2.0;
64
+ if (val < 400.0) return 3.0;
65
+ return -1.0;
66
+ }
57
67
  }
58
68
 
59
69
 
@@ -68,7 +68,8 @@ public class GridRenderLayer implements CustomLayerHost {
68
68
  private ByteBuffer pendingColormapBuffer = null;
69
69
  private FloatBuffer pendingVertexBuffer = null;
70
70
  private ShortBuffer pendingIndexBuffer = null;
71
-
71
+ private int uIsMRMS;
72
+ private boolean isMRMS = false;
72
73
 
73
74
  public GridRenderLayer(Context context) {
74
75
  this.context = context;
@@ -123,6 +124,7 @@ public class GridRenderLayer implements CustomLayerHost {
123
124
  uSmoothing = GLES20.glGetUniformLocation(program, "u_smoothing");
124
125
  uScaleType = GLES20.glGetUniformLocation(program, "u_scale_type");
125
126
  uIsPtype = GLES20.glGetUniformLocation(program, "u_is_ptype");
127
+ uIsMRMS = GLES20.glGetUniformLocation(program, "u_is_mrms");
126
128
  aPosition = GLES20.glGetAttribLocation(program, "a_position");
127
129
  aTexCoord = GLES20.glGetAttribLocation(program, "a_texCoord");
128
130
  }
@@ -138,6 +140,10 @@ public class GridRenderLayer implements CustomLayerHost {
138
140
  Log.d(TAG, "setVariable called. Variable: '" + this.currentVariable + "', isPtype set to: " + this.isPtype);
139
141
  }
140
142
 
143
+ public void setIsMRMS(boolean isMRMS) {
144
+ this.isMRMS = isMRMS;
145
+ Log.d(TAG, "setIsMRMS called with: " + isMRMS);
146
+ }
141
147
 
142
148
  public void clearData() {
143
149
  this.isVisible = false;
@@ -261,6 +267,7 @@ public class GridRenderLayer implements CustomLayerHost {
261
267
  GLES20.glUniform1i(uSmoothing, smoothingEnabled ? 1 : 0);
262
268
  GLES20.glUniform1i(uScaleType, this.scaleType);
263
269
  GLES20.glUniform1i(uIsPtype, this.isPtype ? 1 : 0);
270
+ GLES20.glUniform1i(uIsMRMS, this.isMRMS ? 1 : 0);
264
271
 
265
272
  GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
266
273
  GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
@@ -1,5 +1,3 @@
1
- // packages/react-native/android/src/main/res/raw/fragment_shader.glsl
2
-
3
1
  precision highp float;
4
2
  varying vec2 v_texCoord;
5
3
 
@@ -19,7 +17,8 @@ uniform vec2 u_data_range;
19
17
  // Rendering parameters
20
18
  uniform vec2 u_texture_size;
21
19
  uniform int u_smoothing;
22
- uniform int u_is_ptype; // ADDED: Flag for ptype variables
20
+ uniform int u_is_ptype; // Flag for ptype variables
21
+ uniform int u_is_mrms; // NEW: Flag for MRMS data
23
22
 
24
23
  // --- HELPER FUNCTIONS ---
25
24
 
@@ -49,11 +48,22 @@ float get_value(vec2 coord) {
49
48
 
50
49
  // Maps a physical value to a precipitation type category
51
50
  float get_ptype_from_physical(float val) {
52
- if (val < 0.0) return -1.0; // Missing/Invalid
53
- if (val < 100.0) return 0.0; // Rain
54
- if (val < 200.0) return 1.0; // Mix
55
- if (val < 300.0) return 2.0; // Snow
56
- return 3.0; // Pellets
51
+ if (val < 0.0) return -1.0;
52
+
53
+ if (u_is_mrms == 1) {
54
+ // MRMS: 0-100 rain, 100-200 snow, 200-300 freezing rain
55
+ if (val < 100.0) return 0.0;
56
+ if (val < 200.0) return 1.0;
57
+ if (val < 300.0) return 2.0;
58
+ return -1.0;
59
+ } else {
60
+ // Models: 0-100 rain, 100-200 snow, 200-300 freezing rain, 300-400 ice pellets
61
+ if (val < 100.0) return 0.0;
62
+ if (val < 200.0) return 1.0;
63
+ if (val < 300.0) return 2.0;
64
+ if (val < 400.0) return 3.0;
65
+ return -1.0;
66
+ }
57
67
  }
58
68
 
59
69
 
@@ -12,4 +12,5 @@ struct FragmentUniforms {
12
12
  var smoothing: Int32
13
13
  var scaleType: Int32
14
14
  var isPtype: Int32
15
+ var isMRMS: Int32
15
16
  }