@aguacerowx/react-native 0.0.17 → 0.0.20
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/README.md +66 -0
- package/aguacerowx-react-native.podspec +27 -9
- package/android/build.gradle +31 -7
- package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +17 -1
- package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +5 -0
- package/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +8 -0
- package/android/src/main/res/raw/fragment_shader.glsl +120 -66
- package/ios/GridRenderLayer.swift +113 -92
- package/ios/compiled-shaders/Shaders-device.metallib +0 -0
- package/ios/compiled-shaders/Shaders-simulator.metallib +0 -0
- package/ios/compiled-shaders/Shaders.metallib +0 -0
- package/lib/commonjs/README.md +66 -0
- package/lib/commonjs/aguacerowx-react-native.podspec +27 -9
- package/lib/commonjs/android/build.gradle +31 -7
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +17 -1
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +5 -0
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +8 -0
- package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +120 -66
- package/lib/commonjs/ios/GridRenderLayer.swift +113 -92
- 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/ios/compiled-shaders/Shaders.metallib +0 -0
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +128 -68
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +39 -12
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +38 -20
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -6
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +1 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +28 -2
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +35 -8
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -1
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +38 -20
- package/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -1
- package/lib/commonjs/package.json +9 -4
- package/lib/commonjs/scripts/compile-shaders.sh +27 -0
- package/lib/commonjs/src/GridRenderLayer.js +8 -0
- package/lib/commonjs/src/GridRenderLayer.js.map +1 -1
- package/lib/commonjs/src/WeatherLayerManager.js +5 -0
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/README.md +66 -0
- package/lib/module/aguacerowx-react-native.podspec +27 -9
- package/lib/module/android/build.gradle +31 -7
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +17 -1
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +5 -0
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +8 -0
- package/lib/module/android/src/main/res/raw/fragment_shader.glsl +120 -66
- package/lib/module/ios/GridRenderLayer.swift +113 -92
- 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/ios/compiled-shaders/Shaders.metallib +0 -0
- package/lib/module/lib/commonjs/README.md +66 -0
- package/lib/module/lib/commonjs/aguacerowx-react-native.podspec +27 -9
- package/lib/module/lib/commonjs/android/build.gradle +31 -7
- package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +113 -92
- 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/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +128 -68
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +39 -12
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +38 -20
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -6
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/package.json +1 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +28 -2
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +35 -8
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -1
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +38 -20
- package/lib/module/lib/commonjs/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -1
- package/lib/module/lib/commonjs/package.json +9 -4
- package/lib/module/lib/commonjs/scripts/compile-shaders.sh +27 -0
- package/lib/module/lib/commonjs/src/GridRenderLayer.js +8 -0
- package/lib/module/lib/commonjs/src/GridRenderLayer.js.map +1 -1
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +5 -0
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js +128 -68
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/AguaceroCore.js.map +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js +39 -12
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/default-colormaps.js.map +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js +38 -20
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/dictionaries.js.map +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js +0 -6
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/dist/index.js.map +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/package.json +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js +28 -2
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/AguaceroCore.js.map +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js +35 -8
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/default-colormaps.js.map +1 -1
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js +38 -20
- package/lib/module/node_modules/@aguacerowx/javascript-sdk/src/dictionaries.js.map +1 -1
- package/lib/module/package.json +9 -4
- package/lib/module/scripts/compile-shaders.sh +27 -0
- package/lib/module/src/GridRenderLayer.js +8 -0
- package/lib/module/src/GridRenderLayer.js.map +1 -1
- package/lib/module/src/WeatherLayerManager.js +5 -0
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/typescript/src/GridRenderLayer.d.ts.map +1 -1
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +9 -4
- package/src/GridRenderLayer.js +13 -0
- package/src/WeatherLayerManager.js +7 -0
|
@@ -783,99 +783,120 @@ public class GridRenderLayer: NSObject {
|
|
|
783
783
|
|
|
784
784
|
// MARK: - Internal methods for CustomLayerHost (called by wrapper)
|
|
785
785
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
if let pendingColormap = pendingColormapUpdate {
|
|
866
|
-
print("🟡 [GridRenderLayer] Processing pending colormap update")
|
|
867
|
-
updateColormapTexture(colormapAsBase64: pendingColormap)
|
|
868
|
-
pendingColormapUpdate = nil
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
if let pendingData = pendingDataUpdate {
|
|
872
|
-
print("🟡 [GridRenderLayer] Processing pending data update")
|
|
873
|
-
updateDataTexture(data: pendingData.data, nx: pendingData.nx, ny: pendingData.ny,
|
|
874
|
-
scale: pendingData.scale, offset: pendingData.offset,
|
|
875
|
-
missing: pendingData.missing, scaleType: pendingData.scaleType)
|
|
876
|
-
pendingDataUpdate = nil
|
|
877
|
-
}
|
|
786
|
+
internal func internalRenderingWillStart(_ metalDevice: MTLDevice, colorPixelFormat: UInt, depthStencilPixelFormat: UInt) {
|
|
787
|
+
print("🟢 [GridRenderLayer] renderingWillStart called")
|
|
788
|
+
self.device = metalDevice
|
|
789
|
+
self.commandQueue = metalDevice.makeCommandQueue()
|
|
790
|
+
|
|
791
|
+
let bundle = Bundle(for: GridRenderLayer.self)
|
|
792
|
+
|
|
793
|
+
// Determine if we're running on simulator or device
|
|
794
|
+
#if targetEnvironment(simulator)
|
|
795
|
+
let metallibName = "Shaders-simulator"
|
|
796
|
+
#else
|
|
797
|
+
let metallibName = "Shaders-device"
|
|
798
|
+
#endif
|
|
799
|
+
|
|
800
|
+
// Try to load pre-compiled metallib for the current platform
|
|
801
|
+
let defaultLibrary: MTLLibrary?
|
|
802
|
+
if let metallibUrl = bundle.url(forResource: metallibName, withExtension: "metallib"),
|
|
803
|
+
let library = try? metalDevice.makeLibrary(URL: metallibUrl) {
|
|
804
|
+
print("✅ [GridRenderLayer] Loaded pre-compiled metallib (\(metallibName))")
|
|
805
|
+
defaultLibrary = library
|
|
806
|
+
}
|
|
807
|
+
// Fall back to compiling from .metal source (for development with npm link)
|
|
808
|
+
else if let metalUrl = bundle.url(forResource: "Shaders", withExtension: "metal"),
|
|
809
|
+
let source = try? String(contentsOf: metalUrl),
|
|
810
|
+
let library = try? metalDevice.makeLibrary(source: source, options: nil) {
|
|
811
|
+
print("✅ [GridRenderLayer] Compiled Metal shader from source")
|
|
812
|
+
defaultLibrary = library
|
|
813
|
+
}
|
|
814
|
+
// Neither worked
|
|
815
|
+
else {
|
|
816
|
+
print("❌ [GridRenderLayer] Could not find or compile Metal shaders")
|
|
817
|
+
print(" Bundle path: \(bundle.bundlePath)")
|
|
818
|
+
return
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
guard let library = defaultLibrary else {
|
|
822
|
+
print("❌ [GridRenderLayer] Failed to create Metal library")
|
|
823
|
+
return
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
let vertexFunction = library.makeFunction(name: "vertex_main")
|
|
827
|
+
let fragmentFunction = library.makeFunction(name: "fragment_main")
|
|
828
|
+
|
|
829
|
+
// Set up vertex descriptor
|
|
830
|
+
let vertexDescriptor = MTLVertexDescriptor()
|
|
831
|
+
vertexDescriptor.attributes[0].format = .float2 // position (x, y)
|
|
832
|
+
vertexDescriptor.attributes[0].offset = 0
|
|
833
|
+
vertexDescriptor.attributes[0].bufferIndex = 0
|
|
834
|
+
|
|
835
|
+
vertexDescriptor.attributes[1].format = .float2 // texCoord (u, v)
|
|
836
|
+
vertexDescriptor.attributes[1].offset = MemoryLayout<Float>.size * 2
|
|
837
|
+
vertexDescriptor.attributes[1].bufferIndex = 0
|
|
838
|
+
|
|
839
|
+
vertexDescriptor.layouts[0].stride = MemoryLayout<Float>.size * 4 // 2 floats for pos + 2 for texCoord
|
|
840
|
+
vertexDescriptor.layouts[0].stepFunction = .perVertex
|
|
841
|
+
|
|
842
|
+
let pipelineDescriptor = MTLRenderPipelineDescriptor()
|
|
843
|
+
pipelineDescriptor.vertexDescriptor = vertexDescriptor
|
|
844
|
+
pipelineDescriptor.vertexFunction = vertexFunction
|
|
845
|
+
pipelineDescriptor.fragmentFunction = fragmentFunction
|
|
846
|
+
|
|
847
|
+
pipelineDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormat(rawValue: colorPixelFormat) ?? .bgra8Unorm
|
|
848
|
+
pipelineDescriptor.depthAttachmentPixelFormat = MTLPixelFormat(rawValue: depthStencilPixelFormat) ?? .depth32Float_stencil8
|
|
849
|
+
pipelineDescriptor.stencilAttachmentPixelFormat = MTLPixelFormat(rawValue: depthStencilPixelFormat) ?? .depth32Float_stencil8
|
|
850
|
+
|
|
851
|
+
pipelineDescriptor.colorAttachments[0].isBlendingEnabled = true
|
|
852
|
+
pipelineDescriptor.colorAttachments[0].rgbBlendOperation = .add
|
|
853
|
+
pipelineDescriptor.colorAttachments[0].alphaBlendOperation = .add
|
|
854
|
+
pipelineDescriptor.colorAttachments[0].sourceRGBBlendFactor = .sourceAlpha
|
|
855
|
+
pipelineDescriptor.colorAttachments[0].sourceAlphaBlendFactor = .sourceAlpha
|
|
856
|
+
pipelineDescriptor.colorAttachments[0].destinationRGBBlendFactor = .oneMinusSourceAlpha
|
|
857
|
+
pipelineDescriptor.colorAttachments[0].destinationAlphaBlendFactor = .oneMinusSourceAlpha
|
|
858
|
+
|
|
859
|
+
do {
|
|
860
|
+
self.pipelineState = try metalDevice.makeRenderPipelineState(descriptor: pipelineDescriptor)
|
|
861
|
+
} catch {
|
|
862
|
+
print("❌ [GridRenderLayer] Failed to create pipeline state: \(error)")
|
|
863
|
+
return
|
|
878
864
|
}
|
|
865
|
+
|
|
866
|
+
let dataSamplerDesc = MTLSamplerDescriptor()
|
|
867
|
+
dataSamplerDesc.minFilter = .nearest
|
|
868
|
+
dataSamplerDesc.magFilter = .nearest
|
|
869
|
+
self.dataSamplerState = metalDevice.makeSamplerState(descriptor: dataSamplerDesc)
|
|
870
|
+
|
|
871
|
+
let colormapSamplerDesc = MTLSamplerDescriptor()
|
|
872
|
+
colormapSamplerDesc.minFilter = .nearest
|
|
873
|
+
colormapSamplerDesc.magFilter = .nearest
|
|
874
|
+
colormapSamplerDesc.sAddressMode = .clampToEdge
|
|
875
|
+
self.colormapSamplerState = metalDevice.makeSamplerState(descriptor: colormapSamplerDesc)
|
|
876
|
+
|
|
877
|
+
print("🟢 [GridRenderLayer] Metal setup complete")
|
|
878
|
+
|
|
879
|
+
// Process any pending updates that came in before Metal was ready
|
|
880
|
+
if let pendingGeometry = pendingGeometryUpdate {
|
|
881
|
+
print("🟡 [GridRenderLayer] Processing pending geometry update")
|
|
882
|
+
updateGeometry(corners: pendingGeometry.corners, gridDef: pendingGeometry.gridDef)
|
|
883
|
+
pendingGeometryUpdate = nil
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
if let pendingColormap = pendingColormapUpdate {
|
|
887
|
+
print("🟡 [GridRenderLayer] Processing pending colormap update")
|
|
888
|
+
updateColormapTexture(colormapAsBase64: pendingColormap)
|
|
889
|
+
pendingColormapUpdate = nil
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
if let pendingData = pendingDataUpdate {
|
|
893
|
+
print("🟡 [GridRenderLayer] Processing pending data update")
|
|
894
|
+
updateDataTexture(data: pendingData.data, nx: pendingData.nx, ny: pendingData.ny,
|
|
895
|
+
scale: pendingData.scale, offset: pendingData.offset,
|
|
896
|
+
missing: pendingData.missing, scaleType: pendingData.scaleType)
|
|
897
|
+
pendingDataUpdate = nil
|
|
898
|
+
}
|
|
899
|
+
}
|
|
879
900
|
internal func internalRender(_ parameters: CustomLayerRenderParameters, mtlCommandBuffer: MTLCommandBuffer, mtlRenderPassDescriptor: MTLRenderPassDescriptor) {
|
|
880
901
|
guard isVisible,
|
|
881
902
|
let pipeline = pipelineState,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/commonjs/README.md
CHANGED
|
@@ -25,6 +25,72 @@ $RNMapboxMapsVersion = '~> 11.0' # This enforces Mapbox SDK v11
|
|
|
25
25
|
use_mapbox_maps!
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
### Enable Modular Headers (Required for New Architecture)
|
|
29
|
+
|
|
30
|
+
If you're using React Native's new architecture (`newArchEnabled: true`), you **must** enable modular headers.
|
|
31
|
+
|
|
32
|
+
#### For Expo Projects (Recommended)
|
|
33
|
+
|
|
34
|
+
If you're using Expo, add the `expo-build-properties` plugin to your `app.config.js` or `app.config.ts`:
|
|
35
|
+
```bash
|
|
36
|
+
npm install expo-build-properties
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Then add it to your Expo config:
|
|
40
|
+
```typescript
|
|
41
|
+
// app.config.ts
|
|
42
|
+
export default {
|
|
43
|
+
// ... other config
|
|
44
|
+
plugins: [
|
|
45
|
+
// ... other plugins
|
|
46
|
+
[
|
|
47
|
+
'expo-build-properties',
|
|
48
|
+
{
|
|
49
|
+
ios: {
|
|
50
|
+
useFrameworks: 'static',
|
|
51
|
+
useModularHeaders: true, // Add this line
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then run:
|
|
60
|
+
```bash
|
|
61
|
+
npx expo prebuild --clean
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### For Non-Expo React Native Projects
|
|
65
|
+
|
|
66
|
+
**Option 1: Enable modular headers globally (Recommended)**
|
|
67
|
+
|
|
68
|
+
Add this line after the `platform :ios` line in your `ios/Podfile`:
|
|
69
|
+
```ruby
|
|
70
|
+
platform :ios, '13.4'
|
|
71
|
+
use_modular_headers! # Add this line
|
|
72
|
+
|
|
73
|
+
prepare_react_native_project!
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Option 2: Enable modular headers in post_install hook**
|
|
77
|
+
|
|
78
|
+
Add this code inside your `post_install do |installer|` block:
|
|
79
|
+
```ruby
|
|
80
|
+
post_install do |installer|
|
|
81
|
+
# Enable modular headers for libzstd
|
|
82
|
+
installer.pods_project.targets.each do |target|
|
|
83
|
+
if target.name == 'libzstd'
|
|
84
|
+
target.build_configurations.each do |config|
|
|
85
|
+
config.build_settings['DEFINES_MODULE'] = 'YES'
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# ... rest of your existing post_install code
|
|
91
|
+
end
|
|
92
|
+
```
|
|
93
|
+
|
|
28
94
|
### Install Pods
|
|
29
95
|
|
|
30
96
|
After saving the Podfile, navigate to your `ios` directory in the terminal and run a fresh pod installation.
|
|
@@ -10,27 +10,45 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.authors = { package["author"] => "support@aguacerowx.com" }
|
|
11
11
|
s.platforms = { :ios => "13.4" }
|
|
12
12
|
s.source = { :git => "https://github.com/AguaceroWx/aguacero-sdks.git", :tag => "v#{s.version}" }
|
|
13
|
-
|
|
14
13
|
s.swift_version = "5.0"
|
|
15
|
-
|
|
14
|
+
s.static_framework = false
|
|
15
|
+
|
|
16
16
|
s.pod_target_xcconfig = {
|
|
17
17
|
'DEFINES_MODULE' => 'YES',
|
|
18
18
|
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
|
|
19
19
|
'SWIFT_COMPILATION_MODE' => 'wholemodule',
|
|
20
20
|
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) ZSTD_DISABLE_ASM=1'
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
s.user_target_xcconfig = {
|
|
24
24
|
'DEFINES_MODULE' => 'YES'
|
|
25
25
|
}
|
|
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"
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
}
|
|
47
|
+
]
|
|
48
|
+
|
|
31
49
|
s.source_files = "ios/**/*.{h,m,mm,swift}", "ios/generated/**/*.{h,m,mm,cpp}"
|
|
32
|
-
|
|
50
|
+
|
|
33
51
|
s.dependency "React-Core"
|
|
34
52
|
s.dependency "MapboxMaps", "~> 11.0"
|
|
35
|
-
s.dependency "libzstd", "~> 1.5.5"
|
|
53
|
+
s.dependency "libzstd", "~> 1.5.5"
|
|
36
54
|
end
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
// @aguacerowx/react-native/android/build.gradle
|
|
2
2
|
|
|
3
|
+
buildscript {
|
|
4
|
+
repositories {
|
|
5
|
+
google()
|
|
6
|
+
mavenCentral()
|
|
7
|
+
}
|
|
8
|
+
dependencies {
|
|
9
|
+
classpath("com.facebook.react:react-native-gradle-plugin")
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
repositories {
|
|
4
14
|
google()
|
|
5
15
|
mavenCentral()
|
|
@@ -17,6 +27,12 @@ repositories {
|
|
|
17
27
|
|
|
18
28
|
apply plugin: 'com.android.library'
|
|
19
29
|
|
|
30
|
+
def isNewArchEnabled = project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
31
|
+
|
|
32
|
+
if (isNewArchEnabled) {
|
|
33
|
+
apply plugin: "com.facebook.react"
|
|
34
|
+
}
|
|
35
|
+
|
|
20
36
|
android {
|
|
21
37
|
namespace 'com.aguacerowx.reactnative'
|
|
22
38
|
compileSdk 34
|
|
@@ -44,6 +60,13 @@ android {
|
|
|
44
60
|
}
|
|
45
61
|
}
|
|
46
62
|
|
|
63
|
+
if (isNewArchEnabled) {
|
|
64
|
+
react {
|
|
65
|
+
libraryName = "AguaceroWxReactNativeSpec"
|
|
66
|
+
codegenJavaPackageName = "com.aguacerowx.reactnative"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
47
70
|
dependencies {
|
|
48
71
|
implementation 'com.facebook.react:react-native:+'
|
|
49
72
|
api 'org.locationtech.proj4j:proj4j:1.1.5'
|
|
@@ -51,7 +74,14 @@ dependencies {
|
|
|
51
74
|
}
|
|
52
75
|
|
|
53
76
|
project.afterEvaluate {
|
|
54
|
-
//
|
|
77
|
+
// Fix Gradle 9 task dependency issue
|
|
78
|
+
if (isNewArchEnabled) {
|
|
79
|
+
tasks.named("generateCodegenArtifactsFromSchema").configure {
|
|
80
|
+
dependsOn("generateCodegenSchemaFromJavaScript")
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Mapbox version resolution
|
|
55
85
|
def resolvedMapboxVersion
|
|
56
86
|
if (project.rootProject.hasProperty('mapboxMapsVersion')) {
|
|
57
87
|
resolvedMapboxVersion = project.rootProject.mapboxMapsVersion
|
|
@@ -61,23 +91,17 @@ project.afterEvaluate {
|
|
|
61
91
|
println "[aguacerowx] WARNING: Could not find 'mapboxMapsVersion' property. Falling back to ${resolvedMapboxVersion}."
|
|
62
92
|
}
|
|
63
93
|
|
|
64
|
-
// 2. Detect if @rnmapbox/maps is present in the user's project
|
|
65
|
-
// We check the root project to see all included modules.
|
|
66
94
|
def rnMapboxIsPresent = project.rootProject.findProject(':rnmapbox_maps') != null
|
|
67
95
|
def mapboxArtifact
|
|
68
96
|
|
|
69
|
-
// 3. Choose the correct Mapbox artifact based on the detection
|
|
70
97
|
if (rnMapboxIsPresent) {
|
|
71
|
-
// If @rnmapbox/maps is present, we MUST use the ndk27 variant to avoid conflicts.
|
|
72
98
|
mapboxArtifact = "android-ndk27"
|
|
73
99
|
println "[aguacerowx] @rnmapbox/maps detected. Using Mapbox artifact: '${mapboxArtifact}' to ensure compatibility."
|
|
74
100
|
} else {
|
|
75
|
-
// If it's not present, use the standard 'android' variant.
|
|
76
101
|
mapboxArtifact = "android"
|
|
77
102
|
println "[aguacerowx] @rnmapbox/maps not detected. Using standard Mapbox artifact: '${mapboxArtifact}'."
|
|
78
103
|
}
|
|
79
104
|
|
|
80
|
-
// 4. Add the chosen Mapbox dependency using the version and artifact we just determined.
|
|
81
105
|
dependencies {
|
|
82
106
|
implementation "com.mapbox.maps:${mapboxArtifact}:${resolvedMapboxVersion}"
|
|
83
107
|
}
|
|
@@ -33,7 +33,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
33
33
|
// Uniform and Attribute locations
|
|
34
34
|
private int uMatrix, uDataTexture, uColormapTexture, uOpacity, uDataRange,
|
|
35
35
|
uScale, uOffset, uMissingQuantized, uTextureSize, uConversionType, uSmoothing,
|
|
36
|
-
uScaleType;
|
|
36
|
+
uScaleType, uIsPtype;
|
|
37
37
|
private int aPosition, aTexCoord;
|
|
38
38
|
|
|
39
39
|
// GPU-side resource IDs
|
|
@@ -54,6 +54,8 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
54
54
|
private int conversionType = 0;
|
|
55
55
|
private boolean smoothingEnabled = true;
|
|
56
56
|
private int scaleType = 0;
|
|
57
|
+
private boolean isPtype = false; // ADDED
|
|
58
|
+
private String currentVariable = "";
|
|
57
59
|
private boolean textureParametersDirty = true;
|
|
58
60
|
private volatile boolean isVisible = true;
|
|
59
61
|
|
|
@@ -120,9 +122,22 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
120
122
|
uConversionType = GLES20.glGetUniformLocation(program, "u_conversion_type");
|
|
121
123
|
uSmoothing = GLES20.glGetUniformLocation(program, "u_smoothing");
|
|
122
124
|
uScaleType = GLES20.glGetUniformLocation(program, "u_scale_type");
|
|
125
|
+
uIsPtype = GLES20.glGetUniformLocation(program, "u_is_ptype");
|
|
123
126
|
aPosition = GLES20.glGetAttribLocation(program, "a_position");
|
|
124
127
|
aTexCoord = GLES20.glGetAttribLocation(program, "a_texCoord");
|
|
125
128
|
}
|
|
129
|
+
|
|
130
|
+
public void setVariable(String variable) {
|
|
131
|
+
if (variable == null) {
|
|
132
|
+
this.currentVariable = "";
|
|
133
|
+
} else {
|
|
134
|
+
this.currentVariable = variable;
|
|
135
|
+
}
|
|
136
|
+
// MODIFICATION: Add detailed logging here
|
|
137
|
+
this.isPtype = "ptypeRefl".equals(this.currentVariable) || "ptypeRate".equals(this.currentVariable);
|
|
138
|
+
Log.d(TAG, "setVariable called. Variable: '" + this.currentVariable + "', isPtype set to: " + this.isPtype);
|
|
139
|
+
}
|
|
140
|
+
|
|
126
141
|
|
|
127
142
|
public void clearData() {
|
|
128
143
|
this.isVisible = false;
|
|
@@ -243,6 +258,7 @@ public class GridRenderLayer implements CustomLayerHost {
|
|
|
243
258
|
GLES20.glUniform1i(uConversionType, conversionType);
|
|
244
259
|
GLES20.glUniform1i(uSmoothing, smoothingEnabled ? 1 : 0);
|
|
245
260
|
GLES20.glUniform1i(uScaleType, this.scaleType);
|
|
261
|
+
GLES20.glUniform1i(uIsPtype, this.isPtype ? 1 : 0);
|
|
246
262
|
|
|
247
263
|
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
|
248
264
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java
CHANGED
|
@@ -297,4 +297,9 @@ public class GridRenderLayerView extends FrameLayout {
|
|
|
297
297
|
gridLayerImplementation.clearData();
|
|
298
298
|
triggerRepaint();
|
|
299
299
|
}
|
|
300
|
+
|
|
301
|
+
public void setVariable(String variable) {
|
|
302
|
+
gridLayerImplementation.setVariable(variable);
|
|
303
|
+
triggerRepaint();
|
|
304
|
+
}
|
|
300
305
|
}
|
package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java
CHANGED
|
@@ -21,6 +21,7 @@ public class GridRenderManager extends SimpleViewManager<GridRenderLayerView> {
|
|
|
21
21
|
private static final int COMMAND_UPDATE_GEOMETRY = 3;
|
|
22
22
|
private static final int COMMAND_UPDATE_DATA_PARAMETERS = 4;
|
|
23
23
|
private static final int COMMAND_CLEAR = 5;
|
|
24
|
+
private static final int COMMAND_SET_VARIABLE = 6;
|
|
24
25
|
|
|
25
26
|
@NonNull
|
|
26
27
|
@Override
|
|
@@ -68,6 +69,7 @@ public class GridRenderManager extends SimpleViewManager<GridRenderLayerView> {
|
|
|
68
69
|
commands.put("updateGeometry", COMMAND_UPDATE_GEOMETRY);
|
|
69
70
|
commands.put("updateDataParameters", COMMAND_UPDATE_DATA_PARAMETERS);
|
|
70
71
|
commands.put("clear", COMMAND_CLEAR);
|
|
72
|
+
commands.put("setVariable", COMMAND_SET_VARIABLE);
|
|
71
73
|
return commands;
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -113,6 +115,12 @@ public class GridRenderManager extends SimpleViewManager<GridRenderLayerView> {
|
|
|
113
115
|
case COMMAND_CLEAR:
|
|
114
116
|
view.clearData();
|
|
115
117
|
break;
|
|
118
|
+
|
|
119
|
+
case COMMAND_SET_VARIABLE:
|
|
120
|
+
if (args != null && args.size() > 0) {
|
|
121
|
+
view.setVariable(args.getString(0));
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
116
124
|
}
|
|
117
125
|
}
|
|
118
126
|
}
|