@aguacerowx/react-native 0.0.20 → 0.0.22
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/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/ios/FragmentUniforms.swift +2 -0
- package/ios/GridRenderLayer.swift +24 -4
- package/ios/GridRenderLayerManager.mm +12 -0
- package/ios/GridRenderLayerView.h +1 -7
- package/ios/GridRenderLayerView.m +7 -1
- package/ios/Shaders.metal +131 -71
- package/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/lib/commonjs/ios/FragmentUniforms.swift +2 -0
- package/lib/commonjs/ios/GridRenderLayer.swift +24 -4
- package/lib/commonjs/ios/GridRenderLayerManager.mm +12 -0
- package/lib/commonjs/ios/GridRenderLayerView.h +1 -7
- package/lib/commonjs/ios/GridRenderLayerView.m +7 -1
- package/lib/commonjs/ios/Shaders.metal +131 -71
- 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 +3 -3
- package/lib/commonjs/scripts/compile-shaders.js +62 -0
- package/lib/commonjs/scripts/compile-shaders.js.map +1 -0
- package/lib/commonjs/scripts/compile-shaders.sh +12 -0
- package/lib/commonjs/src/WeatherLayerManager.js +51 -17
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +42 -5
- package/lib/module/android/src/main/res/raw/fragment_shader.glsl +18 -8
- package/lib/module/ios/FragmentUniforms.swift +2 -0
- package/lib/module/ios/GridRenderLayer.swift +24 -4
- package/lib/module/ios/GridRenderLayerManager.mm +12 -0
- package/lib/module/ios/GridRenderLayerView.h +1 -7
- package/lib/module/ios/GridRenderLayerView.m +7 -1
- package/lib/module/ios/Shaders.metal +131 -71
- 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/package.json +3 -3
- package/lib/module/lib/commonjs/scripts/compile-shaders.js +62 -0
- package/lib/module/lib/commonjs/scripts/compile-shaders.js.map +1 -0
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +51 -17
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/package.json +3 -3
- package/lib/module/scripts/compile-shaders.js +60 -0
- package/lib/module/scripts/compile-shaders.js.map +1 -0
- package/lib/module/scripts/compile-shaders.sh +12 -0
- package/lib/module/src/WeatherLayerManager.js +51 -17
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/typescript/scripts/compile-shaders.d.ts +3 -0
- package/lib/typescript/scripts/compile-shaders.d.ts.map +1 -0
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/WeatherLayerManager.js +192 -151
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1055
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -381
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1256
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4041
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -38
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -30
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -27
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -41
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -301
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -126
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/android/build.gradle +0 -108
- package/lib/module/lib/commonjs/android/src/main/AndroidManifest.xml +0 -7
- package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +0 -14
- package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +0 -983
- package/lib/module/lib/commonjs/ios/GridRenderLayerBridge.swift +0 -30
- package/lib/module/lib/commonjs/ios/GridRenderLayerManager.mm +0 -146
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.h +0 -23
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +0 -199
- package/lib/module/lib/commonjs/ios/InspectorDataCache.swift +0 -66
- package/lib/module/lib/commonjs/ios/InspectorModule.m +0 -10
- package/lib/module/lib/commonjs/ios/InspectorModule.swift +0 -64
- package/lib/module/lib/commonjs/ios/Shaders.metal +0 -131
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.m +0 -16
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.swift +0 -104
- 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/ios/compiled-shaders/Shaders.metallib +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec-generated.mm +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec.h +0 -0
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1059
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -381
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1256
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4041
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -38
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -30
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -27
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -41
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -301
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -126
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
- package/lib/module/lib/commonjs/scripts/compile-shaders.sh +0 -27
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +0 -1063
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js +0 -381
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/coordinate_configs.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +0 -1256
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +0 -4041
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js +0 -38
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/events.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js +0 -30
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/fill-layer-worker.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js +0 -27
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/getBundleId.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -41
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js +0 -301
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/map-styles.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js +0 -126
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/unitConversions.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/package.json +0 -48
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +0 -1047
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js +0 -375
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/coordinate_configs.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +0 -1250
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +0 -4035
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js +0 -31
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/events.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js +0 -29
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/fill-layer-worker.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js +0 -21
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/getBundleId.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js +0 -12
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/index.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js +0 -295
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/map-styles.js.map +0 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js +0 -119
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/unitConversions.js.map +0 -1
|
@@ -60,7 +60,9 @@ public class GridRenderLayer: NSObject {
|
|
|
60
60
|
missingQuantized: 127.0,
|
|
61
61
|
textureSize: SIMD2<Float>(0.0, 0.0),
|
|
62
62
|
smoothing: 1,
|
|
63
|
-
scaleType: 0
|
|
63
|
+
scaleType: 0,
|
|
64
|
+
isPtype: 0,
|
|
65
|
+
isMRMS: 0
|
|
64
66
|
)
|
|
65
67
|
private var isVisible = false
|
|
66
68
|
private var pendingActiveFrameKey: String?
|
|
@@ -74,8 +76,8 @@ public class GridRenderLayer: NSObject {
|
|
|
74
76
|
let nx: Float
|
|
75
77
|
let ny: Float
|
|
76
78
|
let filePath: String
|
|
77
|
-
let originalScale: Float
|
|
78
|
-
let originalOffset: Float
|
|
79
|
+
let originalScale: Float
|
|
80
|
+
let originalOffset: Float
|
|
79
81
|
}
|
|
80
82
|
private var frameCache: [String: FrameMetadata] = [:]
|
|
81
83
|
private let highPriorityTextureQueue = DispatchQueue(label: "com.aguacero.texture-processing-high-priority", qos: .userInitiated)
|
|
@@ -124,7 +126,23 @@ public class GridRenderLayer: NSObject {
|
|
|
124
126
|
// ADD THIS: Force the map to repaint to show the smoothing change immediately.
|
|
125
127
|
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
126
128
|
}
|
|
129
|
+
|
|
130
|
+
@objc(setIsMRMSWithIsMRMS:)
|
|
131
|
+
public func setIsMRMS(isMRMS: Bool) {
|
|
132
|
+
self.uniforms.isMRMS = isMRMS ? 1 : 0
|
|
133
|
+
print("🟢 [GridRenderLayer] Set isMRMS: \(isMRMS)")
|
|
134
|
+
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
135
|
+
}
|
|
127
136
|
|
|
137
|
+
// ADD THIS METHOD
|
|
138
|
+
@objc(setVariableWithVariable:)
|
|
139
|
+
public func setVariable(variable: String) {
|
|
140
|
+
let isPtypeVar = (variable == "ptypeRefl" || variable == "ptypeRate")
|
|
141
|
+
self.uniforms.isPtype = isPtypeVar ? 1 : 0
|
|
142
|
+
print("🟢 [GridRenderLayer] Set variable: \(variable), isPtype set to: \(self.uniforms.isPtype)")
|
|
143
|
+
NotificationCenter.default.post(name: NSNotification.Name("TriggerMapRepaint"), object: nil)
|
|
144
|
+
}
|
|
145
|
+
|
|
128
146
|
@objc public func clear() {
|
|
129
147
|
self.isVisible = false
|
|
130
148
|
self.inspectorCache.clear()
|
|
@@ -935,7 +953,9 @@ internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFor
|
|
|
935
953
|
var floatArray = matrixArray.map { $0.floatValue }
|
|
936
954
|
|
|
937
955
|
floatArray[0] *= scale // X scale
|
|
938
|
-
floatArray[
|
|
956
|
+
floatArray[1] *= scale // X rotation
|
|
957
|
+
floatArray[4] *= scale // Y rotation
|
|
958
|
+
floatArray[5] *= scale
|
|
939
959
|
|
|
940
960
|
let mvp = matrix_float4x4(
|
|
941
961
|
SIMD4<Float>(floatArray[0], floatArray[1], floatArray[2], floatArray[3]),
|
|
@@ -143,4 +143,16 @@ RCT_EXPORT_METHOD(clearGpuCache:(nonnull NSNumber *)reactTag)
|
|
|
143
143
|
}];
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// ADD THIS METHOD
|
|
147
|
+
RCT_EXPORT_METHOD(setVariable:(nonnull NSNumber *)reactTag
|
|
148
|
+
variable:(NSString *)variable)
|
|
149
|
+
{
|
|
150
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
151
|
+
GridRenderLayerView *view = (GridRenderLayerView *)viewRegistry[reactTag];
|
|
152
|
+
if ([view isKindOfClass:[GridRenderLayerView class]]) {
|
|
153
|
+
[view setVariable:variable];
|
|
154
|
+
}
|
|
155
|
+
}];
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
@end
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
#import <UIKit/UIKit.h>
|
|
2
|
-
|
|
3
2
|
@class GridRenderLayer;
|
|
4
3
|
@class MapView;
|
|
5
|
-
|
|
6
4
|
NS_ASSUME_NONNULL_BEGIN
|
|
7
|
-
|
|
8
5
|
@interface GridRenderLayerView : UIView
|
|
9
|
-
|
|
10
6
|
@property (nonatomic, strong) GridRenderLayer *layerInstance;
|
|
11
7
|
@property (nonatomic, weak) MapView *mapView;
|
|
12
8
|
@property (nonatomic, strong) NSString *layerId;
|
|
13
9
|
@property (nonatomic, strong, nullable) NSString *belowID;
|
|
14
|
-
|
|
15
10
|
// Property setters for React Native
|
|
16
11
|
- (void)setOpacity:(float)opacity;
|
|
17
12
|
- (void)setDataRange:(NSArray *)dataRange;
|
|
18
13
|
- (void)setSmoothing:(BOOL)smoothing;
|
|
19
14
|
- (void)setBelowID:(NSString *)belowID;
|
|
20
|
-
|
|
15
|
+
- (void)setVariable:(NSString *)variable; // ADD THIS LINE
|
|
21
16
|
@end
|
|
22
|
-
|
|
23
17
|
NS_ASSUME_NONNULL_END
|
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
RCTLogInfo(@"🟢 [GridRenderLayerView] Set belowID: %@", belowID);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
// ADD THIS METHOD
|
|
63
|
+
- (void)setVariable:(NSString *)variable {
|
|
64
|
+
[self.layerInstance setVariableWithVariable:variable];
|
|
65
|
+
RCTLogInfo(@"🟢 [GridRenderLayerView] Set variable: %@", variable);
|
|
66
|
+
}
|
|
67
|
+
|
|
62
68
|
#pragma mark - View Lifecycle
|
|
63
69
|
|
|
64
70
|
- (void)didMoveToWindow {
|
|
@@ -196,4 +202,4 @@
|
|
|
196
202
|
[super removeFromSuperview];
|
|
197
203
|
}
|
|
198
204
|
|
|
199
|
-
@end
|
|
205
|
+
@end
|
|
@@ -22,7 +22,9 @@ struct FragmentUniforms {
|
|
|
22
22
|
float missingQuantized;
|
|
23
23
|
float2 textureSize;
|
|
24
24
|
int smoothing;
|
|
25
|
-
int scaleType;
|
|
25
|
+
int scaleType;
|
|
26
|
+
int isPtype;
|
|
27
|
+
int isMRMS;
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
// --- Vertex Shader (Unchanged) ---
|
|
@@ -34,52 +36,56 @@ vertex RasterizerData vertex_main(const Vertex in [[stage_in]],
|
|
|
34
36
|
return out;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
float2 pixel_floor = floor(pixel_coord - 0.5);
|
|
49
|
-
float2 f = fract(pixel_coord - 0.5);
|
|
50
|
-
|
|
51
|
-
// Calculate the precise UV coordinates for the CENTER of the four surrounding texels.
|
|
52
|
-
float2 uv00 = (pixel_floor + float2(0.5, 0.5)) * texel_size;
|
|
53
|
-
float2 uv10 = (pixel_floor + float2(1.5, 0.5)) * texel_size;
|
|
54
|
-
float2 uv01 = (pixel_floor + float2(0.5, 1.5)) * texel_size;
|
|
55
|
-
float2 uv11 = (pixel_floor + float2(1.5, 1.5)) * texel_size;
|
|
56
|
-
|
|
57
|
-
// Sample the four corner texels.
|
|
58
|
-
float s00 = dataTexture.sample(dataSampler, uv00).r * 255.0;
|
|
59
|
-
float s10 = dataTexture.sample(dataSampler, uv10).r * 255.0;
|
|
60
|
-
float s01 = dataTexture.sample(dataSampler, uv01).r * 255.0;
|
|
61
|
-
float s11 = dataTexture.sample(dataSampler, uv11).r * 255.0;
|
|
62
|
-
|
|
63
|
-
// THE CRITICAL CHECK: If any surrounding pixel is a "missing" value,
|
|
64
|
-
// treat this entire fragment as missing to prevent interpolation.
|
|
65
|
-
if (abs(s00 - missing_value) < 0.5 ||
|
|
66
|
-
abs(s10 - missing_value) < 0.5 ||
|
|
67
|
-
abs(s01 - missing_value) < 0.5 ||
|
|
68
|
-
abs(s11 - missing_value) < 0.5)
|
|
69
|
-
{
|
|
70
|
-
return missing_value;
|
|
39
|
+
|
|
40
|
+
// --- HELPER FUNCTIONS FOR FRAGMENT SHADER ---
|
|
41
|
+
|
|
42
|
+
// Dequantizes a signed value (-127 to 127) into a physical value
|
|
43
|
+
float dequantize_val(float q_val, constant FragmentUniforms &uniforms) {
|
|
44
|
+
if (abs(q_val - uniforms.missingQuantized) < 0.5) {
|
|
45
|
+
return -9999.0;
|
|
46
|
+
}
|
|
47
|
+
float intermediate = q_val * uniforms.scale + uniforms.offset;
|
|
48
|
+
if (uniforms.scaleType == 1) { // 1 = sqrt
|
|
49
|
+
return intermediate * abs(intermediate);
|
|
71
50
|
}
|
|
51
|
+
return intermediate;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Samples texture, converts 0-255 to signed -128-127 range.
|
|
55
|
+
// Returns a quantized value, or a large positive sentinel for missing data.
|
|
56
|
+
float get_value(texture2d<float, access::sample> dataTexture, sampler dataSampler, float2 coord, constant FragmentUniforms &uniforms) {
|
|
57
|
+
// Note: The sampler should be set to 'nearest' when calling this for ptype logic.
|
|
58
|
+
float value_0_to_255 = dataTexture.sample(dataSampler, coord).r * 255.0;
|
|
59
|
+
float val = value_0_to_255 - 128.0;
|
|
60
|
+
float missing_in_texture_range_0_255 = uniforms.missingQuantized + 128.0;
|
|
61
|
+
if (abs(value_0_to_255 - missing_in_texture_range_0_255) < 0.5) {
|
|
62
|
+
return 99999.0; // Sentinel for "missing"
|
|
63
|
+
}
|
|
64
|
+
return val;
|
|
65
|
+
}
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
// Maps a physical value to a precipitation type category
|
|
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;
|
|
76
71
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
+
}
|
|
80
86
|
}
|
|
81
87
|
|
|
82
|
-
// --- Fragment Shader
|
|
88
|
+
// --- Main Fragment Shader ---
|
|
83
89
|
fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
84
90
|
constant FragmentUniforms &uniforms [[buffer(0)]],
|
|
85
91
|
texture2d<float, access::sample> dataTexture [[texture(0)]],
|
|
@@ -87,45 +93,99 @@ fragment float4 fragment_main(RasterizerData in [[stage_in]],
|
|
|
87
93
|
sampler dataSampler [[sampler(0)]],
|
|
88
94
|
sampler colormapSampler [[sampler(1)]])
|
|
89
95
|
{
|
|
90
|
-
|
|
91
|
-
float
|
|
92
|
-
if (uniforms.smoothing == 1) {
|
|
93
|
-
// Use our custom function that prevents edge artifacts.
|
|
94
|
-
value_in_texture = sampleDataTextureSmooth(dataTexture, dataSampler, in.texCoord, uniforms);
|
|
95
|
-
} else {
|
|
96
|
-
// Smoothing is off. The sampler is already set to 'nearest' by the Swift code,
|
|
97
|
-
// so a standard sample call produces the correct pixelated result.
|
|
98
|
-
value_in_texture = dataTexture.sample(dataSampler, in.texCoord).r * 255.0;
|
|
99
|
-
}
|
|
96
|
+
float raw_value;
|
|
97
|
+
float alpha_multiplier = 1.0; // Used for alpha feathering at data edges
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
if (uniforms.smoothing == 0) { // Nearest neighbor
|
|
100
|
+
float quantized_value = get_value(dataTexture, dataSampler, in.texCoord, uniforms);
|
|
101
|
+
if (quantized_value >= 99999.0) {
|
|
102
|
+
discard_fragment();
|
|
103
|
+
}
|
|
104
|
+
raw_value = dequantize_val(quantized_value, uniforms);
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
} else { // Bilinear interpolation
|
|
107
|
+
float2 texel_size = 1.0 / uniforms.textureSize;
|
|
108
|
+
float2 tex_coord_in_texels = in.texCoord * uniforms.textureSize;
|
|
109
|
+
float2 bl_texel_index = floor(tex_coord_in_texels - 0.5);
|
|
110
|
+
float2 f = fract(tex_coord_in_texels - 0.5); // Interpolation factors
|
|
107
111
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
// Coordinates of the 4 neighboring texels
|
|
113
|
+
float2 v00_coord = (bl_texel_index + float2(0.5, 0.5)) * texel_size;
|
|
114
|
+
float2 v10_coord = (bl_texel_index + float2(1.5, 0.5)) * texel_size;
|
|
115
|
+
float2 v01_coord = (bl_texel_index + float2(0.5, 1.5)) * texel_size;
|
|
116
|
+
float2 v11_coord = (bl_texel_index + float2(1.5, 1.5)) * texel_size;
|
|
117
|
+
|
|
118
|
+
if (uniforms.isPtype == 1) {
|
|
119
|
+
// --- PTYPE-SPECIFIC INTERPOLATION (CATEGORICAL) ---
|
|
120
|
+
float v00 = dequantize_val(get_value(dataTexture, dataSampler, v00_coord, uniforms), uniforms);
|
|
121
|
+
float v10 = dequantize_val(get_value(dataTexture, dataSampler, v10_coord, uniforms), uniforms);
|
|
122
|
+
float v01 = dequantize_val(get_value(dataTexture, dataSampler, v01_coord, uniforms), uniforms);
|
|
123
|
+
float v11 = dequantize_val(get_value(dataTexture, dataSampler, v11_coord, uniforms), uniforms);
|
|
124
|
+
|
|
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);
|
|
129
|
+
|
|
130
|
+
// Determine the dominant precipitation type for this pixel
|
|
131
|
+
float dominant_ptype = -1.0;
|
|
132
|
+
if (p00 != -1.0) dominant_ptype = p00;
|
|
133
|
+
else if (p10 != -1.0) dominant_ptype = p10;
|
|
134
|
+
else if (p01 != -1.0) dominant_ptype = p01;
|
|
135
|
+
else if (p11 != -1.0) dominant_ptype = p11;
|
|
136
|
+
|
|
137
|
+
if (dominant_ptype == -1.0) discard_fragment();
|
|
138
|
+
|
|
139
|
+
// Interpolate ONLY the values that match the dominant ptype
|
|
140
|
+
float total_value = 0.0;
|
|
141
|
+
float total_weight = 0.0;
|
|
142
|
+
if (p00 == dominant_ptype) { float w = (1.0-f.x)*(1.0-f.y); total_value+=v00*w; total_weight+=w; }
|
|
143
|
+
if (p10 == dominant_ptype) { float w = f.x*(1.0-f.y); total_value+=v10*w; total_weight+=w; }
|
|
144
|
+
if (p01 == dominant_ptype) { float w = (1.0-f.x)*f.y; total_value+=v01*w; total_weight+=w; }
|
|
145
|
+
if (p11 == dominant_ptype) { float w = f.x*f.y; total_value+=v11*w; total_weight+=w; }
|
|
146
|
+
|
|
147
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
148
|
+
raw_value = total_value / total_weight;
|
|
149
|
+
|
|
150
|
+
// Force full alpha to prevent dark borders between ptype regions
|
|
151
|
+
alpha_multiplier = 1.0;
|
|
152
|
+
|
|
153
|
+
} else {
|
|
154
|
+
// --- STANDARD INTERPOLATION (CONTINUOUS) ---
|
|
155
|
+
float v00_q = get_value(dataTexture, dataSampler, v00_coord, uniforms);
|
|
156
|
+
float v10_q = get_value(dataTexture, dataSampler, v10_coord, uniforms);
|
|
157
|
+
float v01_q = get_value(dataTexture, dataSampler, v01_coord, uniforms);
|
|
158
|
+
float v11_q = get_value(dataTexture, dataSampler, v11_coord, uniforms);
|
|
159
|
+
|
|
160
|
+
float total_value_q = 0.0;
|
|
161
|
+
float total_weight = 0.0;
|
|
162
|
+
if (v00_q < 99999.0) { float w = (1.0-f.x)*(1.0-f.y); total_value_q+=v00_q*w; total_weight+=w; }
|
|
163
|
+
if (v10_q < 99999.0) { float w = f.x*(1.0-f.y); total_value_q+=v10_q*w; total_weight+=w; }
|
|
164
|
+
if (v01_q < 99999.0) { float w = (1.0-f.x)*f.y; total_value_q+=v01_q*w; total_weight+=w; }
|
|
165
|
+
if (v11_q < 99999.0) { float w = f.x*f.y; total_value_q+=v11_q*w; total_weight+=w; }
|
|
166
|
+
|
|
167
|
+
if (total_weight <= 0.0) discard_fragment();
|
|
168
|
+
raw_value = dequantize_val(total_value_q / total_weight, uniforms);
|
|
169
|
+
alpha_multiplier = total_weight; // Feather the edges of the data
|
|
170
|
+
}
|
|
116
171
|
}
|
|
117
|
-
|
|
118
|
-
//
|
|
172
|
+
|
|
173
|
+
// --- COMMON FINAL STEPS ---
|
|
174
|
+
|
|
119
175
|
if (raw_value < uniforms.dataRange.x) {
|
|
120
176
|
discard_fragment();
|
|
121
177
|
}
|
|
122
|
-
|
|
123
|
-
// Normalize the value to a 0-1 coordinate for colormap lookup.
|
|
178
|
+
|
|
124
179
|
float colormap_coord = (raw_value - uniforms.dataRange.x) / (uniforms.dataRange.y - uniforms.dataRange.x);
|
|
125
180
|
colormap_coord = clamp(colormap_coord, 0.0, 1.0);
|
|
126
181
|
|
|
127
|
-
// Sample the colormap and apply final opacity.
|
|
128
182
|
float4 color = colormapTexture.sample(colormapSampler, float2(colormap_coord, 0.5));
|
|
129
183
|
|
|
130
|
-
|
|
184
|
+
// Discard if the colormap specifies transparency
|
|
185
|
+
if (color.a < 0.1) {
|
|
186
|
+
discard_fragment();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
float final_alpha = color.a * uniforms.opacity * alpha_multiplier;
|
|
190
|
+
return float4(color.rgb * final_alpha, final_alpha);
|
|
131
191
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aguacerowx/react-native",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "Native weather rendering for React Native",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Michael Barletta",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"android/src/main/java/com/facebook/react/viewmanagers"
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
|
-
"compile-shaders": "
|
|
31
|
+
"compile-shaders": "node scripts/compile-shaders.js",
|
|
32
32
|
"clean": "node -e \"require('fs').rmSync('lib', {recursive: true, force: true})\"",
|
|
33
33
|
"build": "npm run compile-shaders && npm run clean && bob build",
|
|
34
34
|
"prepare": "npm run build"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"react-native-device-info": ">=10.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@aguacerowx/javascript-sdk": "^0.0.
|
|
47
|
+
"@aguacerowx/javascript-sdk": "^0.0.15",
|
|
48
48
|
"base64-js": "^1.5.1"
|
|
49
49
|
},
|
|
50
50
|
"react-native-builder-bob": {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const {
|
|
5
|
+
execSync
|
|
6
|
+
} = require('child_process');
|
|
7
|
+
const os = require('os');
|
|
8
|
+
|
|
9
|
+
// Check if we're on macOS
|
|
10
|
+
if (os.platform() !== 'darwin') {
|
|
11
|
+
console.log('⏭️ Skipping shader compilation (macOS only)');
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Check if xcrun is available
|
|
16
|
+
try {
|
|
17
|
+
execSync('which xcrun', {
|
|
18
|
+
stdio: 'ignore'
|
|
19
|
+
});
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.log('⚠️ xcrun not found. Skipping shader compilation.');
|
|
22
|
+
process.exit(0);
|
|
23
|
+
}
|
|
24
|
+
console.log('🔨 Compiling Metal shaders for all platforms...');
|
|
25
|
+
const SHADER_DIR = 'ios';
|
|
26
|
+
const OUTPUT_DIR = 'ios/compiled-shaders';
|
|
27
|
+
try {
|
|
28
|
+
// Create output directory
|
|
29
|
+
execSync(`mkdir -p "${OUTPUT_DIR}"`, {
|
|
30
|
+
stdio: 'inherit'
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// Compile for iOS Device (arm64)
|
|
34
|
+
console.log(' 📱 Compiling for iOS device...');
|
|
35
|
+
execSync(`xcrun -sdk iphoneos metal -c "${SHADER_DIR}/Shaders.metal" -o "${OUTPUT_DIR}/Shaders-device.air"`, {
|
|
36
|
+
stdio: 'inherit'
|
|
37
|
+
});
|
|
38
|
+
execSync(`xcrun -sdk iphoneos metallib "${OUTPUT_DIR}/Shaders-device.air" -o "${OUTPUT_DIR}/Shaders-device.metallib"`, {
|
|
39
|
+
stdio: 'inherit'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Compile for iOS Simulator (x86_64 + arm64)
|
|
43
|
+
console.log(' 💻 Compiling for iOS simulator...');
|
|
44
|
+
execSync(`xcrun -sdk iphonesimulator metal -c "${SHADER_DIR}/Shaders.metal" -o "${OUTPUT_DIR}/Shaders-simulator.air"`, {
|
|
45
|
+
stdio: 'inherit'
|
|
46
|
+
});
|
|
47
|
+
execSync(`xcrun -sdk iphonesimulator metallib "${OUTPUT_DIR}/Shaders-simulator.air" -o "${OUTPUT_DIR}/Shaders-simulator.metallib"`, {
|
|
48
|
+
stdio: 'inherit'
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Clean up intermediate files
|
|
52
|
+
execSync(`rm "${OUTPUT_DIR}"/*.air`, {
|
|
53
|
+
stdio: 'inherit'
|
|
54
|
+
});
|
|
55
|
+
console.log('✅ Metal shaders compiled:');
|
|
56
|
+
console.log(` - Device: ${OUTPUT_DIR}/Shaders-device.metallib`);
|
|
57
|
+
console.log(` - Simulator: ${OUTPUT_DIR}/Shaders-simulator.metallib`);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error('❌ Shader compilation failed:', error.message);
|
|
60
|
+
process.exit(1);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=compile-shaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["execSync","require","os","platform","console","log","process","exit","stdio","error","SHADER_DIR","OUTPUT_DIR","message"],"sourceRoot":"../../..","sources":["scripts/compile-shaders.js"],"mappings":"AAAA;AAAmB;;AAEnB,MAAM;EAAEA;AAAS,CAAC,GAAGC,OAAO,CAAC,eAAe,CAAC;AAC7C,MAAMC,EAAE,GAAGD,OAAO,CAAC,IAAI,CAAC;;AAExB;AACA,IAAIC,EAAE,CAACC,QAAQ,CAAC,CAAC,KAAK,QAAQ,EAAE;EAC5BC,OAAO,CAACC,GAAG,CAAC,8CAA8C,CAAC;EAC3DC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;AACnB;;AAEA;AACA,IAAI;EACAP,QAAQ,CAAC,aAAa,EAAE;IAAEQ,KAAK,EAAE;EAAS,CAAC,CAAC;AAChD,CAAC,CAAC,OAAOC,KAAK,EAAE;EACZL,OAAO,CAACC,GAAG,CAAC,mDAAmD,CAAC;EAChEC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;AACnB;AAEAH,OAAO,CAACC,GAAG,CAAC,iDAAiD,CAAC;AAE9D,MAAMK,UAAU,GAAG,KAAK;AACxB,MAAMC,UAAU,GAAG,sBAAsB;AAEzC,IAAI;EACA;EACAX,QAAQ,CAAC,aAAaW,UAAU,GAAG,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;;EAE1D;EACAJ,OAAO,CAACC,GAAG,CAAC,kCAAkC,CAAC;EAC/CL,QAAQ,CAAC,iCAAiCU,UAAU,uBAAuBC,UAAU,sBAAsB,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;EAClIR,QAAQ,CAAC,iCAAiCW,UAAU,4BAA4BA,UAAU,2BAA2B,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;;EAE5I;EACAJ,OAAO,CAACC,GAAG,CAAC,qCAAqC,CAAC;EAClDL,QAAQ,CAAC,wCAAwCU,UAAU,uBAAuBC,UAAU,yBAAyB,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;EAC5IR,QAAQ,CAAC,wCAAwCW,UAAU,+BAA+BA,UAAU,8BAA8B,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;;EAEzJ;EACAR,QAAQ,CAAC,OAAOW,UAAU,SAAS,EAAE;IAAEH,KAAK,EAAE;EAAU,CAAC,CAAC;EAE1DJ,OAAO,CAACC,GAAG,CAAC,2BAA2B,CAAC;EACxCD,OAAO,CAACC,GAAG,CAAC,gBAAgBM,UAAU,0BAA0B,CAAC;EACjEP,OAAO,CAACC,GAAG,CAAC,mBAAmBM,UAAU,6BAA6B,CAAC;AAC3E,CAAC,CAAC,OAAOF,KAAK,EAAE;EACZL,OAAO,CAACK,KAAK,CAAC,8BAA8B,EAAEA,KAAK,CAACG,OAAO,CAAC;EAC5DN,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;AACnB","ignoreList":[]}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
set -e
|
|
3
3
|
|
|
4
|
+
# Check if we're on macOS (Darwin)
|
|
5
|
+
if [[ "$OSTYPE" != "darwin"* ]]; then
|
|
6
|
+
echo "⏭️ Skipping shader compilation (macOS only, current OS: $OSTYPE)"
|
|
7
|
+
exit 0
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
# Check if xcrun is available
|
|
11
|
+
if ! command -v xcrun &> /dev/null; then
|
|
12
|
+
echo "⚠️ xcrun not found. Skipping shader compilation."
|
|
13
|
+
exit 0
|
|
14
|
+
fi
|
|
15
|
+
|
|
4
16
|
echo "🔨 Compiling Metal shaders for all platforms..."
|
|
5
17
|
|
|
6
18
|
SHADER_DIR="ios"
|
|
@@ -161,6 +161,14 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
161
161
|
forecastHour,
|
|
162
162
|
mrmsTimestamp
|
|
163
163
|
} = state;
|
|
164
|
+
|
|
165
|
+
// NEW: Fix the current forecast hour if it's invalid for this variable/model combo
|
|
166
|
+
let effectiveForecastHour = forecastHour;
|
|
167
|
+
if (!isMRMS && variable === 'ptypeRefl' && model === 'hrrr' && forecastHour === 0) {
|
|
168
|
+
const validHours = availableHours.filter(hour => hour !== 0);
|
|
169
|
+
effectiveForecastHour = validHours.length > 0 ? validHours[0] : 0;
|
|
170
|
+
console.log(`⚠️ [Preload] Correcting invalid hour 0 to ${effectiveForecastHour} for HRRR ptypeRefl`);
|
|
171
|
+
}
|
|
164
172
|
if (!cachedGeometry.current || !cachedColormap.current) {
|
|
165
173
|
const gridModel = isMRMS ? 'mrms' : model;
|
|
166
174
|
const {
|
|
@@ -178,7 +186,18 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
178
186
|
} = core._getColormapForVariable(variable);
|
|
179
187
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
180
188
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
181
|
-
|
|
189
|
+
let dataRange;
|
|
190
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
191
|
+
if (isMRMS) {
|
|
192
|
+
console.log('🔧 Using MRMS ptype data range: 5-380');
|
|
193
|
+
dataRange = [5, 380];
|
|
194
|
+
} else {
|
|
195
|
+
console.log('🔧 Using Model ptype data range: 5-380');
|
|
196
|
+
dataRange = [5, 380];
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
200
|
+
}
|
|
182
201
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
183
202
|
const colormapAsBase64 = (0, _base64Js.fromByteArray)(colormapBytes);
|
|
184
203
|
gridLayerRef.current.updateColormapTexture(colormapAsBase64);
|
|
@@ -192,12 +211,18 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
192
211
|
});
|
|
193
212
|
hasInitialLoad.current = true;
|
|
194
213
|
}
|
|
195
|
-
|
|
214
|
+
|
|
215
|
+
// Apply the same filtering logic as in AguaceroCore._emitStateChange
|
|
216
|
+
let filteredHours = availableHours;
|
|
217
|
+
if (!isMRMS && variable === 'ptypeRefl' && model === 'hrrr' && availableHours && availableHours.length > 0) {
|
|
218
|
+
filteredHours = availableHours.filter(hour => hour !== 0);
|
|
219
|
+
}
|
|
220
|
+
const allFrames = isMRMS ? availableTimestamps : filteredHours;
|
|
196
221
|
if (!allFrames || allFrames.length === 0) {
|
|
197
222
|
console.warn('🟡 [preloadAllFramesToDisk] No frames available to download.');
|
|
198
223
|
return;
|
|
199
224
|
}
|
|
200
|
-
const currentFrame = isMRMS ? mrmsTimestamp :
|
|
225
|
+
const currentFrame = isMRMS ? mrmsTimestamp : effectiveForecastHour;
|
|
201
226
|
const prioritizedFrames = [currentFrame, ...allFrames.filter(frame => frame !== currentFrame)];
|
|
202
227
|
console.log(`[Preload] Prioritizing frame: ${currentFrame}. Total frames: ${prioritizedFrames.length}`);
|
|
203
228
|
const {
|
|
@@ -211,7 +236,7 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
211
236
|
prioritizedFrames.forEach((frame, index) => {
|
|
212
237
|
const cacheKey = isMRMS ? `mrms-${frame}-${variable}` : `${model}-${date}-${run}-${frame}-${variable}`;
|
|
213
238
|
if (preloadedDataCache.current.has(cacheKey)) {
|
|
214
|
-
return;
|
|
239
|
+
return;
|
|
215
240
|
}
|
|
216
241
|
let resourcePath;
|
|
217
242
|
if (isMRMS) {
|
|
@@ -240,8 +265,6 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
240
265
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
241
266
|
let dataScale = result.scale;
|
|
242
267
|
let dataOffset = result.offset;
|
|
243
|
-
|
|
244
|
-
// Calculate converted values for immediate use
|
|
245
268
|
let convertedScale = dataScale;
|
|
246
269
|
let convertedOffset = dataOffset;
|
|
247
270
|
if (baseUnit !== toUnit) {
|
|
@@ -262,22 +285,18 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
262
285
|
}
|
|
263
286
|
}
|
|
264
287
|
}
|
|
265
|
-
|
|
266
|
-
// Store with ORIGINAL values for unit conversion later
|
|
267
288
|
const frameData = {
|
|
268
289
|
filePath: result.filePath,
|
|
269
290
|
nx,
|
|
270
291
|
ny,
|
|
271
292
|
scale: convertedScale,
|
|
272
|
-
// Current converted values
|
|
273
293
|
offset: convertedOffset,
|
|
274
294
|
missing: result.missing,
|
|
275
295
|
corners,
|
|
276
296
|
gridDef,
|
|
277
297
|
scaleType: result.scaleType,
|
|
278
298
|
originalScale: result.scale,
|
|
279
|
-
|
|
280
|
-
originalOffset: result.offset // CRITICAL: Always original
|
|
299
|
+
originalOffset: result.offset
|
|
281
300
|
};
|
|
282
301
|
preloadedDataCache.current.set(cacheKey, frameData);
|
|
283
302
|
const isCurrentFrame = index === 0;
|
|
@@ -302,14 +321,11 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
302
321
|
nx: frameData.nx,
|
|
303
322
|
ny: frameData.ny,
|
|
304
323
|
scale: frameData.scale,
|
|
305
|
-
// Current converted scale
|
|
306
324
|
offset: frameData.offset,
|
|
307
|
-
// Current converted offset
|
|
308
325
|
missing: frameData.missing,
|
|
309
326
|
scaleType: frameData.scaleType || 'linear',
|
|
310
327
|
originalScale: frameData.originalScale,
|
|
311
|
-
|
|
312
|
-
originalOffset: frameData.originalOffset // ADD THIS
|
|
328
|
+
originalOffset: frameData.originalOffset
|
|
313
329
|
}
|
|
314
330
|
};
|
|
315
331
|
gridLayerRef.current.primeGpuCache(frameInfoForGpu);
|
|
@@ -383,7 +399,16 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
383
399
|
} = core._getColormapForVariable(variable);
|
|
384
400
|
const toUnit = core._getTargetUnit(baseUnit, units);
|
|
385
401
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
386
|
-
|
|
402
|
+
let dataRange;
|
|
403
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
404
|
+
if (isMRMS) {
|
|
405
|
+
dataRange = [5, 380];
|
|
406
|
+
} else {
|
|
407
|
+
dataRange = [5, 380];
|
|
408
|
+
}
|
|
409
|
+
} else {
|
|
410
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
411
|
+
}
|
|
387
412
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
388
413
|
const colormapAsBase64 = (0, _base64Js.fromByteArray)(colormapBytes);
|
|
389
414
|
gridLayerRef.current.updateColormapTexture(colormapAsBase64);
|
|
@@ -598,7 +623,16 @@ const WeatherLayerManager = exports.WeatherLayerManager = /*#__PURE__*/(0, _reac
|
|
|
598
623
|
colormap
|
|
599
624
|
} = core._getColormapForVariable(variable);
|
|
600
625
|
const finalColormap = core._convertColormapUnits(colormap, baseUnit, toUnit);
|
|
601
|
-
|
|
626
|
+
let dataRange;
|
|
627
|
+
if (variable === 'ptypeRefl' || variable === 'ptypeRate') {
|
|
628
|
+
if (isMRMS) {
|
|
629
|
+
dataRange = [5, 380];
|
|
630
|
+
} else {
|
|
631
|
+
dataRange = [5, 380];
|
|
632
|
+
}
|
|
633
|
+
} else {
|
|
634
|
+
dataRange = [finalColormap[0], finalColormap[finalColormap.length - 2]];
|
|
635
|
+
}
|
|
602
636
|
const colormapBytes = _generateColormapBytes(finalColormap);
|
|
603
637
|
const colormapAsBase64 = (0, _base64Js.fromByteArray)(colormapBytes);
|
|
604
638
|
gridLayerRef.current.updateColormapTexture(colormapAsBase64);
|