@aguacerowx/react-native 0.0.25 → 0.0.27
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 +126 -126
- package/aguacerowx-react-native.podspec +38 -38
- package/android/build/.transforms/42e9b8fa82d77a1c205db5bf0d0ed519/results.bin +1 -0
- package/android/build/.transforms/42e9b8fa82d77a1c205db5bf0d0ed519/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/results.bin +1 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/AguaceroPackage.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/BuildConfig.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayerView.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderManager.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/InspectorModule.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/ShaderUtils.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/WeatherFrameProcessorModule.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.dex +0 -0
- package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
- package/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
- package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.java +43 -0
- package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.java +22 -0
- package/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec-generated.cpp +22 -0
- package/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec.h +24 -0
- package/android/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI-generated.cpp +17 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI.h +19 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.cpp +22 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.h +24 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.cpp +16 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.h +23 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.cpp +62 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.h +40 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.cpp +17 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.h +32 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.cpp +16 -0
- package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.h +20 -0
- package/android/build/generated/source/codegen/schema.json +1 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
- package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
- package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
- package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
- package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
- package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
- package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
- package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
- package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
- package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
- package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
- package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
- package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
- package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
- package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +162 -0
- package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
- package/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +107 -107
- package/android/src/main/AndroidManifest.xml +6 -6
- package/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +33 -33
- package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +672 -672
- package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +304 -304
- package/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +125 -125
- package/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +71 -71
- package/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +106 -106
- package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +151 -151
- package/android/src/main/res/raw/debug_fragment_shader.glsl +12 -12
- package/android/src/main/res/raw/debug_vertex_shader.glsl +12 -12
- package/android/src/main/res/raw/fragment_shader.glsl +161 -161
- package/android/src/main/res/raw/vertex_shader.glsl +19 -19
- package/index.js +2 -2
- package/ios/AguaceroPackage.m +18 -18
- package/ios/FragmentUniforms.swift +15 -15
- package/ios/GridRenderLayer.swift +1043 -1043
- package/ios/GridRenderLayerBridge.swift +37 -37
- package/ios/GridRenderLayerManager.mm +157 -157
- package/ios/GridRenderLayerView.h +30 -30
- package/ios/GridRenderLayerView.m +256 -256
- package/ios/InspectorDataCache.swift +65 -65
- package/ios/InspectorModule.m +9 -9
- package/ios/InspectorModule.swift +63 -63
- package/ios/Shaders.metal +190 -190
- package/ios/WeatherFrameProcessorModule.m +15 -15
- package/ios/WeatherFrameProcessorModule.swift +103 -103
- package/lib/commonjs/README.md +126 -126
- package/lib/commonjs/aguacerowx-react-native.podspec +38 -38
- package/lib/commonjs/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
- package/lib/commonjs/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.java +43 -0
- package/lib/commonjs/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.java +22 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec-generated.cpp +22 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec.h +24 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI-generated.cpp +17 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI.h +19 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.cpp +22 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.h +24 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.cpp +16 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.h +23 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.cpp +62 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.h +40 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.cpp +17 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.h +32 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.cpp +16 -0
- package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.h +20 -0
- package/lib/commonjs/android/build/generated/source/codegen/schema.json +1 -0
- package/lib/commonjs/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
- package/lib/commonjs/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/lib/commonjs/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
- package/lib/commonjs/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- package/lib/commonjs/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/lib/commonjs/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/lib/commonjs/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
- package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
- package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
- package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
- package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
- package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
- package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/lib/commonjs/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
- package/lib/commonjs/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/lib/commonjs/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
- package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
- package/lib/commonjs/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
- package/lib/commonjs/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
- package/lib/commonjs/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
- package/lib/commonjs/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
- package/lib/commonjs/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
- package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
- package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +162 -0
- package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
- package/lib/commonjs/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/lib/commonjs/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
- package/lib/commonjs/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
- package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/commonjs/android/build.gradle +107 -107
- package/lib/commonjs/android/src/main/AndroidManifest.xml +6 -6
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +33 -33
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +672 -672
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +304 -304
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +125 -125
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +71 -71
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +106 -106
- package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +151 -151
- package/lib/commonjs/android/src/main/res/raw/debug_fragment_shader.glsl +12 -12
- package/lib/commonjs/android/src/main/res/raw/debug_vertex_shader.glsl +12 -12
- package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +161 -161
- package/lib/commonjs/android/src/main/res/raw/vertex_shader.glsl +19 -19
- package/lib/commonjs/babel.config.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ios/AguaceroPackage.m +18 -18
- package/lib/commonjs/ios/FragmentUniforms.swift +15 -15
- package/lib/commonjs/ios/GridRenderLayer.swift +1043 -1043
- package/lib/commonjs/ios/GridRenderLayerBridge.swift +37 -37
- package/lib/commonjs/ios/GridRenderLayerManager.mm +157 -157
- package/lib/commonjs/ios/GridRenderLayerView.h +30 -30
- package/lib/commonjs/ios/GridRenderLayerView.m +256 -256
- package/lib/commonjs/ios/InspectorDataCache.swift +65 -65
- package/lib/commonjs/ios/InspectorModule.m +9 -9
- package/lib/commonjs/ios/InspectorModule.swift +63 -63
- package/lib/commonjs/ios/Shaders.metal +190 -190
- package/lib/commonjs/ios/WeatherFrameProcessorModule.m +15 -15
- package/lib/commonjs/ios/WeatherFrameProcessorModule.swift +103 -103
- package/lib/commonjs/package.json +72 -72
- package/lib/commonjs/react-native-builder-bob.config.js.map +1 -1
- package/lib/commonjs/scripts/compile-shaders.js.map +1 -1
- package/lib/commonjs/scripts/compile-shaders.sh +38 -38
- package/lib/commonjs/src/AguaceroContext.js.map +1 -1
- package/lib/commonjs/src/GridRenderLayer.js.map +1 -1
- package/lib/commonjs/src/GridRenderLayerNativeComponent.js.map +1 -1
- package/lib/commonjs/src/MapManager.js.map +1 -1
- package/lib/commonjs/src/MapRegistry.js.map +1 -1
- package/lib/commonjs/src/StyleApplicator.js +6 -6
- package/lib/commonjs/src/StyleApplicator.js.map +1 -1
- package/lib/commonjs/src/WeatherLayerManager.js +171 -68
- package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/commonjs/tsconfig.json +23 -23
- package/lib/module/README.md +126 -126
- package/lib/module/aguacerowx-react-native.podspec +38 -38
- package/lib/module/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
- package/lib/module/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.java +43 -0
- package/lib/module/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.java +22 -0
- package/lib/module/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec-generated.cpp +22 -0
- package/lib/module/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec.h +24 -0
- package/lib/module/android/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI-generated.cpp +17 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI.h +19 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.cpp +22 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.h +24 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.cpp +16 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.h +23 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.cpp +62 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.h +40 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.cpp +17 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.h +32 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.cpp +16 -0
- package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.h +20 -0
- package/lib/module/android/build/generated/source/codegen/schema.json +1 -0
- package/lib/module/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
- package/lib/module/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
- package/lib/module/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
- package/lib/module/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
- package/lib/module/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/lib/module/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
- package/lib/module/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
- package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
- package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
- package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
- package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
- package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
- package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/lib/module/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
- package/lib/module/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/lib/module/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
- package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
- package/lib/module/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
- package/lib/module/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
- package/lib/module/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
- package/lib/module/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
- package/lib/module/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
- package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
- package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
- package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +162 -0
- package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
- package/lib/module/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/lib/module/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
- package/lib/module/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer$VertexInfo.class.uniqueId0 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayer.class.uniqueId1 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/GridRenderLayerView.class.uniqueId2 +0 -0
- package/lib/module/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/lib/module/android/build.gradle +107 -107
- package/lib/module/android/src/main/AndroidManifest.xml +6 -6
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +33 -33
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +672 -672
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +304 -304
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +125 -125
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +71 -71
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +106 -106
- package/lib/module/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +151 -151
- package/lib/module/android/src/main/res/raw/debug_fragment_shader.glsl +12 -12
- package/lib/module/android/src/main/res/raw/debug_vertex_shader.glsl +12 -12
- package/lib/module/android/src/main/res/raw/fragment_shader.glsl +161 -161
- package/lib/module/android/src/main/res/raw/vertex_shader.glsl +19 -19
- package/lib/module/babel.config.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/ios/AguaceroPackage.m +18 -18
- package/lib/module/ios/FragmentUniforms.swift +15 -15
- package/lib/module/ios/GridRenderLayer.swift +1043 -1043
- package/lib/module/ios/GridRenderLayerBridge.swift +37 -37
- package/lib/module/ios/GridRenderLayerManager.mm +157 -157
- package/lib/module/ios/GridRenderLayerView.h +30 -30
- package/lib/module/ios/GridRenderLayerView.m +256 -256
- package/lib/module/ios/InspectorDataCache.swift +65 -65
- package/lib/module/ios/InspectorModule.m +9 -9
- package/lib/module/ios/InspectorModule.swift +63 -63
- package/lib/module/ios/Shaders.metal +190 -190
- package/lib/module/ios/WeatherFrameProcessorModule.m +15 -15
- package/lib/module/ios/WeatherFrameProcessorModule.swift +103 -103
- package/lib/module/lib/commonjs/README.md +126 -126
- package/lib/module/lib/commonjs/aguacerowx-react-native.podspec +38 -38
- package/lib/module/lib/commonjs/android/build.gradle +108 -0
- package/lib/module/lib/commonjs/android/src/main/AndroidManifest.xml +7 -0
- package/lib/module/lib/commonjs/babel.config.js.map +1 -1
- package/lib/module/lib/commonjs/index.js.map +1 -1
- package/lib/module/lib/commonjs/ios/AguaceroPackage.m +19 -0
- package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +16 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +1043 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayerBridge.swift +38 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayerManager.mm +158 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.h +31 -0
- package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +257 -0
- package/lib/module/lib/commonjs/ios/InspectorDataCache.swift +66 -0
- package/lib/module/lib/commonjs/ios/InspectorModule.m +10 -0
- package/lib/module/lib/commonjs/ios/InspectorModule.swift +64 -0
- package/lib/module/lib/commonjs/ios/Shaders.metal +191 -0
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.m +16 -0
- package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.swift +104 -0
- 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/generated/AguaceroWxReactNativeSpec-generated.mm +0 -0
- package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec.h +0 -0
- package/lib/module/lib/commonjs/package.json +72 -72
- package/lib/module/lib/commonjs/react-native-builder-bob.config.js.map +1 -1
- package/lib/module/lib/commonjs/scripts/compile-shaders.js.map +1 -1
- package/lib/module/lib/commonjs/scripts/compile-shaders.sh +39 -0
- package/lib/module/lib/commonjs/src/AguaceroContext.js.map +1 -1
- package/lib/module/lib/commonjs/src/GridRenderLayer.js.map +1 -1
- package/lib/module/lib/commonjs/src/GridRenderLayerNativeComponent.js.map +1 -1
- package/lib/module/lib/commonjs/src/MapManager.js.map +1 -1
- package/lib/module/lib/commonjs/src/MapRegistry.js.map +1 -1
- package/lib/module/lib/commonjs/src/StyleApplicator.js +6 -6
- package/lib/module/lib/commonjs/src/StyleApplicator.js.map +1 -1
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js +171 -68
- package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/lib/commonjs/tsconfig.json +23 -23
- package/lib/module/package.json +72 -72
- package/lib/module/react-native-builder-bob.config.js.map +1 -1
- package/lib/module/scripts/compile-shaders.js.map +1 -1
- package/lib/module/scripts/compile-shaders.sh +38 -38
- package/lib/module/src/AguaceroContext.js.map +1 -1
- package/lib/module/src/GridRenderLayer.js.map +1 -1
- package/lib/module/src/GridRenderLayerNativeComponent.js.map +1 -1
- package/lib/module/src/MapManager.js.map +1 -1
- package/lib/module/src/MapRegistry.js.map +1 -1
- package/lib/module/src/StyleApplicator.js +6 -6
- package/lib/module/src/StyleApplicator.js.map +1 -1
- package/lib/module/src/WeatherLayerManager.js +171 -68
- package/lib/module/src/WeatherLayerManager.js.map +1 -1
- package/lib/module/tsconfig.json +23 -23
- package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
- package/package.json +72 -72
- package/src/AguaceroContext.js +3 -3
- package/src/GridRenderLayer.js +217 -217
- package/src/GridRenderLayerNativeComponent.ts +15 -15
- package/src/MapManager.js +155 -155
- package/src/MapRegistry.js +34 -34
- package/src/StyleApplicator.js +240 -240
- package/src/WeatherLayerManager.js +1020 -951
|
@@ -1,673 +1,673 @@
|
|
|
1
|
-
// packages/react-native/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java
|
|
2
|
-
|
|
3
|
-
package com.aguacerowx.reactnative;
|
|
4
|
-
|
|
5
|
-
import android.content.Context;
|
|
6
|
-
import android.opengl.GLES20;
|
|
7
|
-
import android.util.Log;
|
|
8
|
-
|
|
9
|
-
import com.facebook.react.bridge.ReadableArray;
|
|
10
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
11
|
-
import com.mapbox.maps.CustomLayerHost;
|
|
12
|
-
import com.mapbox.maps.CustomLayerRenderParameters;
|
|
13
|
-
|
|
14
|
-
import java.io.InputStream;
|
|
15
|
-
import java.nio.ByteBuffer;
|
|
16
|
-
import java.nio.ByteOrder;
|
|
17
|
-
import java.nio.FloatBuffer;
|
|
18
|
-
import java.nio.ShortBuffer;
|
|
19
|
-
import java.util.ArrayList;
|
|
20
|
-
import java.util.List;
|
|
21
|
-
import java.util.Scanner;
|
|
22
|
-
|
|
23
|
-
import java.io.File;
|
|
24
|
-
import java.io.FileInputStream;
|
|
25
|
-
import java.io.IOException;
|
|
26
|
-
import com.github.luben.zstd.Zstd;
|
|
27
|
-
|
|
28
|
-
public class GridRenderLayer implements CustomLayerHost {
|
|
29
|
-
private final Context context;
|
|
30
|
-
private final String TAG = "AguaceroWX";
|
|
31
|
-
private int program;
|
|
32
|
-
|
|
33
|
-
// Uniform and Attribute locations
|
|
34
|
-
private int uMatrix, uDataTexture, uColormapTexture, uOpacity, uDataRange,
|
|
35
|
-
uScale, uOffset, uMissingQuantized, uTextureSize, uConversionType, uSmoothing,
|
|
36
|
-
uScaleType, uIsPtype;
|
|
37
|
-
private int aPosition, aTexCoord;
|
|
38
|
-
|
|
39
|
-
// GPU-side resource IDs
|
|
40
|
-
private int dataTextureId = 0;
|
|
41
|
-
private int colormapTextureId = 0;
|
|
42
|
-
private int vboId = 0;
|
|
43
|
-
private int iboId = 0;
|
|
44
|
-
private int indexCount = 0;
|
|
45
|
-
|
|
46
|
-
// Layer properties
|
|
47
|
-
private float opacity = 1.0f;
|
|
48
|
-
private float[] dataRange = new float[]{0.0f, 1.0f};
|
|
49
|
-
private float scale = 1.0f;
|
|
50
|
-
private float offset = 0.0f;
|
|
51
|
-
private float missingQuantized = 127.0f;
|
|
52
|
-
private int textureWidth = 0;
|
|
53
|
-
private int textureHeight = 0;
|
|
54
|
-
private int conversionType = 0;
|
|
55
|
-
private boolean smoothingEnabled = true;
|
|
56
|
-
private int scaleType = 0;
|
|
57
|
-
private boolean isPtype = false; // ADDED
|
|
58
|
-
private String currentVariable = "";
|
|
59
|
-
private boolean textureParametersDirty = true;
|
|
60
|
-
private volatile boolean isVisible = true;
|
|
61
|
-
|
|
62
|
-
// Pending data buffers for thread-safe uploads
|
|
63
|
-
private final Object dataLock = new Object();
|
|
64
|
-
private ByteBuffer pendingDataBuffer = null;
|
|
65
|
-
private int pendingNx = 0, pendingNy = 0;
|
|
66
|
-
private float pendingScale = 1.0f, pendingOffset = 0.0f, pendingMissing = 127.0f;
|
|
67
|
-
private int pendingScaleType = 0;
|
|
68
|
-
private ByteBuffer pendingColormapBuffer = null;
|
|
69
|
-
private FloatBuffer pendingVertexBuffer = null;
|
|
70
|
-
private ShortBuffer pendingIndexBuffer = null;
|
|
71
|
-
private int uIsMRMS;
|
|
72
|
-
private boolean isMRMS = false;
|
|
73
|
-
|
|
74
|
-
public GridRenderLayer(Context context) {
|
|
75
|
-
this.context = context;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
private double getDouble(ReadableMap map, String key, double defaultValue) {
|
|
79
|
-
return map.hasKey(key) ? map.getDouble(key) : defaultValue;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
private String loadShaderSource(int resourceId) {
|
|
83
|
-
InputStream inputStream = context.getResources().openRawResource(resourceId);
|
|
84
|
-
return new Scanner(inputStream).useDelimiter("\\A").next();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
private int createShader(int type, String source) {
|
|
88
|
-
int shader = GLES20.glCreateShader(type);
|
|
89
|
-
if (shader == 0) return 0;
|
|
90
|
-
GLES20.glShaderSource(shader, source);
|
|
91
|
-
GLES20.glCompileShader(shader);
|
|
92
|
-
final int[] compileStatus = new int[1];
|
|
93
|
-
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compileStatus, 0);
|
|
94
|
-
if (compileStatus[0] == 0) {
|
|
95
|
-
Log.e(TAG, "Error compiling shader: " + GLES20.glGetShaderInfoLog(shader));
|
|
96
|
-
GLES20.glDeleteShader(shader);
|
|
97
|
-
return 0;
|
|
98
|
-
}
|
|
99
|
-
return shader;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
@Override
|
|
103
|
-
public void initialize() {
|
|
104
|
-
String vertexSource = loadShaderSource(R.raw.vertex_shader);
|
|
105
|
-
String fragmentSource = loadShaderSource(R.raw.fragment_shader);
|
|
106
|
-
int vertexShader = createShader(GLES20.GL_VERTEX_SHADER, vertexSource);
|
|
107
|
-
int fragmentShader = createShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
|
|
108
|
-
|
|
109
|
-
program = GLES20.glCreateProgram();
|
|
110
|
-
GLES20.glAttachShader(program, vertexShader);
|
|
111
|
-
GLES20.glAttachShader(program, fragmentShader);
|
|
112
|
-
GLES20.glLinkProgram(program);
|
|
113
|
-
|
|
114
|
-
uMatrix = GLES20.glGetUniformLocation(program, "u_matrix");
|
|
115
|
-
uDataTexture = GLES20.glGetUniformLocation(program, "u_data_texture");
|
|
116
|
-
uColormapTexture = GLES20.glGetUniformLocation(program, "u_colormap_texture");
|
|
117
|
-
uOpacity = GLES20.glGetUniformLocation(program, "u_opacity");
|
|
118
|
-
uDataRange = GLES20.glGetUniformLocation(program, "u_data_range");
|
|
119
|
-
uScale = GLES20.glGetUniformLocation(program, "u_scale");
|
|
120
|
-
uOffset = GLES20.glGetUniformLocation(program, "u_offset");
|
|
121
|
-
uMissingQuantized = GLES20.glGetUniformLocation(program, "u_missing_quantized");
|
|
122
|
-
uTextureSize = GLES20.glGetUniformLocation(program, "u_texture_size");
|
|
123
|
-
uConversionType = GLES20.glGetUniformLocation(program, "u_conversion_type");
|
|
124
|
-
uSmoothing = GLES20.glGetUniformLocation(program, "u_smoothing");
|
|
125
|
-
uScaleType = GLES20.glGetUniformLocation(program, "u_scale_type");
|
|
126
|
-
uIsPtype = GLES20.glGetUniformLocation(program, "u_is_ptype");
|
|
127
|
-
uIsMRMS = GLES20.glGetUniformLocation(program, "u_is_mrms");
|
|
128
|
-
aPosition = GLES20.glGetAttribLocation(program, "a_position");
|
|
129
|
-
aTexCoord = GLES20.glGetAttribLocation(program, "a_texCoord");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
public void setVariable(String variable) {
|
|
133
|
-
if (variable == null) {
|
|
134
|
-
this.currentVariable = "";
|
|
135
|
-
} else {
|
|
136
|
-
this.currentVariable = variable;
|
|
137
|
-
}
|
|
138
|
-
// MODIFICATION: Add detailed logging here
|
|
139
|
-
this.isPtype = "ptypeRefl".equals(this.currentVariable) || "ptypeRate".equals(this.currentVariable);
|
|
140
|
-
Log.d(TAG, "setVariable called. Variable: '" + this.currentVariable + "', isPtype set to: " + this.isPtype);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public void setIsMRMS(boolean isMRMS) {
|
|
144
|
-
this.isMRMS = isMRMS;
|
|
145
|
-
Log.d(TAG, "setIsMRMS called with: " + isMRMS);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
public void clearData() {
|
|
149
|
-
this.isVisible = false;
|
|
150
|
-
// Also clear any pending data to prevent a stale frame from rendering
|
|
151
|
-
synchronized (dataLock) {
|
|
152
|
-
pendingDataBuffer = null;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
@Override
|
|
157
|
-
public void render(CustomLayerRenderParameters renderParameters) {
|
|
158
|
-
if (program == 0 || !isVisible) return;
|
|
159
|
-
|
|
160
|
-
synchronized (dataLock) {
|
|
161
|
-
if (pendingVertexBuffer != null && pendingIndexBuffer != null) {
|
|
162
|
-
this.indexCount = pendingIndexBuffer.capacity();
|
|
163
|
-
if (vboId == 0) {
|
|
164
|
-
int[] bufs = new int[2];
|
|
165
|
-
GLES20.glGenBuffers(2, bufs, 0);
|
|
166
|
-
vboId = bufs[0];
|
|
167
|
-
iboId = bufs[1];
|
|
168
|
-
}
|
|
169
|
-
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboId);
|
|
170
|
-
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, pendingVertexBuffer.capacity() * 4, pendingVertexBuffer, GLES20.GL_STATIC_DRAW);
|
|
171
|
-
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, iboId);
|
|
172
|
-
GLES20.glBufferData(GLES20.GL_ELEMENT_ARRAY_BUFFER, pendingIndexBuffer.capacity() * 2, pendingIndexBuffer, GLES20.GL_STATIC_DRAW);
|
|
173
|
-
pendingVertexBuffer = null;
|
|
174
|
-
pendingIndexBuffer = null;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (pendingDataBuffer != null) {
|
|
178
|
-
// --- FIX 2: LOGICAL FIX FOR TEXTURE RESIZING ---
|
|
179
|
-
boolean dimensionsChanged = (pendingNx != this.textureWidth || pendingNy != this.textureHeight);
|
|
180
|
-
|
|
181
|
-
this.textureWidth = pendingNx;
|
|
182
|
-
this.textureHeight = pendingNy;
|
|
183
|
-
this.scale = pendingScale;
|
|
184
|
-
this.offset = pendingOffset;
|
|
185
|
-
this.missingQuantized = pendingMissing;
|
|
186
|
-
this.scaleType = pendingScaleType;
|
|
187
|
-
|
|
188
|
-
if (dataTextureId == 0) {
|
|
189
|
-
int[] t = new int[1];
|
|
190
|
-
GLES20.glGenTextures(1, t, 0);
|
|
191
|
-
dataTextureId = t[0];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
195
|
-
|
|
196
|
-
if (dimensionsChanged || dataTextureId == 0) {
|
|
197
|
-
int filter = smoothingEnabled ? GLES20.GL_LINEAR : GLES20.GL_NEAREST;
|
|
198
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, filter);
|
|
199
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, filter);
|
|
200
|
-
|
|
201
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
|
202
|
-
|
|
203
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
|
204
|
-
GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
|
|
205
|
-
|
|
206
|
-
pendingDataBuffer.position(0);
|
|
207
|
-
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_ALPHA, pendingNx, pendingNy, 0, GLES20.GL_ALPHA, GLES20.GL_UNSIGNED_BYTE, pendingDataBuffer);
|
|
208
|
-
} else {
|
|
209
|
-
// Texture dimensions are the same, so just update its contents efficiently
|
|
210
|
-
pendingDataBuffer.position(0);
|
|
211
|
-
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, pendingNx, pendingNy, GLES20.GL_ALPHA, GLES20.GL_UNSIGNED_BYTE, pendingDataBuffer);
|
|
212
|
-
}
|
|
213
|
-
pendingDataBuffer = null;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (pendingColormapBuffer != null) {
|
|
217
|
-
if (colormapTextureId == 0) {
|
|
218
|
-
int[] t = new int[1];
|
|
219
|
-
GLES20.glGenTextures(1, t, 0);
|
|
220
|
-
colormapTextureId = t[0];
|
|
221
|
-
}
|
|
222
|
-
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, colormapTextureId);
|
|
223
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
|
|
224
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
|
|
225
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
|
226
|
-
pendingColormapBuffer.position(0);
|
|
227
|
-
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pendingColormapBuffer);
|
|
228
|
-
pendingColormapBuffer = null;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
double zoom = renderParameters.getZoom();
|
|
233
|
-
|
|
234
|
-
if (vboId == 0 || iboId == 0 || indexCount == 0 || dataTextureId == 0 || colormapTextureId == 0) return;
|
|
235
|
-
|
|
236
|
-
if (textureParametersDirty) {
|
|
237
|
-
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
238
|
-
int filter = smoothingEnabled ? GLES20.GL_LINEAR : GLES20.GL_NEAREST;
|
|
239
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, filter);
|
|
240
|
-
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, filter);
|
|
241
|
-
textureParametersDirty = false;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
GLES20.glUseProgram(program);
|
|
245
|
-
|
|
246
|
-
double scale = Math.pow(2.0, zoom);
|
|
247
|
-
|
|
248
|
-
List<Double> matrix = renderParameters.getProjectionMatrix();
|
|
249
|
-
float[] floatMatrix = new float[16];
|
|
250
|
-
for (int i = 0; i < 16; i++) {
|
|
251
|
-
floatMatrix[i] = matrix.get(i).floatValue();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
floatMatrix[0] *= scale // X scale
|
|
255
|
-
floatMatrix[1] *= scale // X rotation
|
|
256
|
-
floatMatrix[2] *= scale // X Z-component
|
|
257
|
-
floatMatrix[3] *= scale // X translation
|
|
258
|
-
floatMatrix[4] *= scale // Y rotation
|
|
259
|
-
floatMatrix[5] *= scale // Y scale
|
|
260
|
-
floatMatrix[6] *= scale // Y Z-component
|
|
261
|
-
floatMatrix[7] *= scale // Y translation
|
|
262
|
-
floatMatrix[8] *= scale // Z X-component
|
|
263
|
-
floatMatrix[9] *= scale // Z Y-component
|
|
264
|
-
floatMatrix[10] *= scale // Z scale
|
|
265
|
-
floatMatrix[11] *= scale // Z translation
|
|
266
|
-
|
|
267
|
-
GLES20.glUniformMatrix4fv(uMatrix, 1, false, floatMatrix, 0);
|
|
268
|
-
GLES20.glUniform1f(uOpacity, opacity);
|
|
269
|
-
GLES20.glUniform2fv(uDataRange, 1, dataRange, 0);
|
|
270
|
-
GLES20.glUniform1f(uScale, this.scale);
|
|
271
|
-
GLES20.glUniform1f(uOffset, offset);
|
|
272
|
-
GLES20.glUniform1f(uMissingQuantized, missingQuantized);
|
|
273
|
-
GLES20.glUniform2f(uTextureSize, (float) textureWidth, (float) textureHeight);
|
|
274
|
-
GLES20.glUniform1i(uConversionType, conversionType);
|
|
275
|
-
GLES20.glUniform1i(uSmoothing, smoothingEnabled ? 1 : 0);
|
|
276
|
-
GLES20.glUniform1i(uScaleType, this.scaleType);
|
|
277
|
-
GLES20.glUniform1i(uIsPtype, this.isPtype ? 1 : 0);
|
|
278
|
-
GLES20.glUniform1i(uIsMRMS, this.isMRMS ? 1 : 0);
|
|
279
|
-
|
|
280
|
-
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
|
281
|
-
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
282
|
-
GLES20.glUniform1i(uDataTexture, 0);
|
|
283
|
-
|
|
284
|
-
GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
|
|
285
|
-
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, colormapTextureId);
|
|
286
|
-
GLES20.glUniform1i(uColormapTexture, 1);
|
|
287
|
-
|
|
288
|
-
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboId);
|
|
289
|
-
GLES20.glEnableVertexAttribArray(aPosition);
|
|
290
|
-
GLES20.glVertexAttribPointer(aPosition, 2, GLES20.GL_FLOAT, false, 16, 0);
|
|
291
|
-
GLES20.glEnableVertexAttribArray(aTexCoord);
|
|
292
|
-
GLES20.glVertexAttribPointer(aTexCoord, 2, GLES20.GL_FLOAT, false, 16, 8);
|
|
293
|
-
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, iboId);
|
|
294
|
-
|
|
295
|
-
GLES20.glEnable(GLES20.GL_BLEND);
|
|
296
|
-
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
|
|
297
|
-
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
|
|
298
|
-
|
|
299
|
-
GLES20.glDrawElements(GLES20.GL_TRIANGLES, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);
|
|
300
|
-
|
|
301
|
-
GLES20.glDisableVertexAttribArray(aPosition);
|
|
302
|
-
GLES20.glDisableVertexAttribArray(aTexCoord);
|
|
303
|
-
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
|
|
304
|
-
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
@Override
|
|
308
|
-
public void deinitialize() {
|
|
309
|
-
if (program != 0) { GLES20.glDeleteProgram(program); program = 0; }
|
|
310
|
-
int[] texturesToDelete = {dataTextureId, colormapTextureId};
|
|
311
|
-
GLES20.glDeleteTextures(2, texturesToDelete, 0);
|
|
312
|
-
dataTextureId = 0; colormapTextureId = 0;
|
|
313
|
-
int[] buffersToDelete = {vboId, iboId};
|
|
314
|
-
GLES20.glDeleteBuffers(2, buffersToDelete, 0);
|
|
315
|
-
vboId = 0; iboId = 0;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
@Override
|
|
319
|
-
public void contextLost() {
|
|
320
|
-
program = 0; dataTextureId = 0; colormapTextureId = 0; vboId = 0; iboId = 0;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
public void setOpacity(float opacity) { this.opacity = opacity; }
|
|
324
|
-
public void setDataRange(float[] dataRange) { this.dataRange = dataRange; }
|
|
325
|
-
public void setConversionType(int type) { this.conversionType = type; }
|
|
326
|
-
public void setSmoothing(boolean enabled) {
|
|
327
|
-
if (this.smoothingEnabled != enabled) {
|
|
328
|
-
this.smoothingEnabled = enabled;
|
|
329
|
-
this.textureParametersDirty = true;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
// Add this method to GridRenderLayer.java (around line 270)
|
|
334
|
-
public void updateDataParameters(float scale, float offset, float missing) {
|
|
335
|
-
synchronized (dataLock) {
|
|
336
|
-
this.scale = scale;
|
|
337
|
-
this.offset = offset;
|
|
338
|
-
this.missingQuantized = missing;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// This existing method is now used by both the old JS path and our new native path
|
|
343
|
-
public void updateDataTexture(byte[] bytes, int nx, int ny, float scale, float offset, float missing, String scaleType) {
|
|
344
|
-
ByteBuffer dataBuffer = ByteBuffer.allocateDirect(bytes.length);
|
|
345
|
-
dataBuffer.put(bytes);
|
|
346
|
-
dataBuffer.position(0);
|
|
347
|
-
synchronized (dataLock) {
|
|
348
|
-
this.pendingDataBuffer = dataBuffer;
|
|
349
|
-
this.pendingNx = nx;
|
|
350
|
-
this.pendingNy = ny;
|
|
351
|
-
this.pendingScale = scale;
|
|
352
|
-
this.pendingOffset = offset;
|
|
353
|
-
this.pendingMissing = missing;
|
|
354
|
-
this.pendingScaleType = "sqrt".equals(scaleType) ? 1 : 0;
|
|
355
|
-
}
|
|
356
|
-
// When new data is provided, ensure the layer is visible
|
|
357
|
-
this.isVisible = true;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
public void updateColormapTexture(ByteBuffer data) {
|
|
361
|
-
synchronized (dataLock) { this.pendingColormapBuffer = data; }
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
private void generateLCCGeometry(ReadableMap gridDefMap, ArrayList<Float> vertices, ArrayList<Short> indices) {
|
|
365
|
-
ReadableMap gridParams = gridDefMap.getMap("grid_params");
|
|
366
|
-
ReadableMap projParams = gridDefMap.getMap("proj_params");
|
|
367
|
-
|
|
368
|
-
if (gridParams == null || projParams == null) {
|
|
369
|
-
Log.e(TAG, "Missing grid or projection parameters for LCC");
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
int nx = gridParams.getInt("nx");
|
|
374
|
-
int ny = gridParams.getInt("ny");
|
|
375
|
-
double dx = getDouble(gridParams, "dx", 0);
|
|
376
|
-
double dy = getDouble(gridParams, "dy", 0);
|
|
377
|
-
double x_origin = getDouble(gridParams, "x_origin", 0);
|
|
378
|
-
double y_origin = getDouble(gridParams, "y_origin", 0);
|
|
379
|
-
|
|
380
|
-
int subdivisions = 60;
|
|
381
|
-
final double TILE_SIZE = 512.0;
|
|
382
|
-
|
|
383
|
-
double x_min = x_origin;
|
|
384
|
-
double y_max = y_origin;
|
|
385
|
-
double x_max = x_origin + (nx - 1) * dx;
|
|
386
|
-
double y_min = y_origin + (ny - 1) * dy;
|
|
387
|
-
|
|
388
|
-
Object[][] vertexGrid = new Object[subdivisions + 1][subdivisions + 1];
|
|
389
|
-
int validVertexCount = 0;
|
|
390
|
-
|
|
391
|
-
for (int row = 0; row <= subdivisions; row++) {
|
|
392
|
-
for (int col = 0; col <= subdivisions; col++) {
|
|
393
|
-
double t_x = (double) col / subdivisions;
|
|
394
|
-
double t_y = (double) row / subdivisions;
|
|
395
|
-
|
|
396
|
-
double proj_x = x_min + t_x * (x_max - x_min);
|
|
397
|
-
double proj_y = y_max + t_y * (y_min - y_max);
|
|
398
|
-
|
|
399
|
-
double[] latLon = projectLCCToLatLon(proj_x, proj_y, projParams);
|
|
400
|
-
|
|
401
|
-
if (latLon == null) {
|
|
402
|
-
vertexGrid[row][col] = null;
|
|
403
|
-
continue;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
double lon = latLon[0];
|
|
407
|
-
double lat = latLon[1];
|
|
408
|
-
|
|
409
|
-
double mercX_normalized = (lon + 180.0) / 360.0;
|
|
410
|
-
double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, lat));
|
|
411
|
-
double sinLatitude = Math.sin(Math.toRadians(clampedLat));
|
|
412
|
-
double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
|
|
413
|
-
|
|
414
|
-
double mercX = mercX_normalized * TILE_SIZE;
|
|
415
|
-
double mercY = mercY_normalized * TILE_SIZE;
|
|
416
|
-
|
|
417
|
-
if (!Double.isFinite(mercX) || !Double.isFinite(mercY)) {
|
|
418
|
-
vertexGrid[row][col] = null;
|
|
419
|
-
continue;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
float tex_u = (float) t_x;
|
|
423
|
-
float tex_v = (float) t_y;
|
|
424
|
-
|
|
425
|
-
VertexInfo vInfo = new VertexInfo();
|
|
426
|
-
vInfo.mercX = (float) mercX;
|
|
427
|
-
vInfo.mercY = (float) mercY;
|
|
428
|
-
vInfo.texU = tex_u;
|
|
429
|
-
vInfo.texV = tex_v;
|
|
430
|
-
vInfo.index = (short) validVertexCount;
|
|
431
|
-
|
|
432
|
-
vertexGrid[row][col] = vInfo;
|
|
433
|
-
|
|
434
|
-
vertices.add((float) mercX);
|
|
435
|
-
vertices.add((float) mercY);
|
|
436
|
-
vertices.add(tex_u);
|
|
437
|
-
vertices.add(tex_v);
|
|
438
|
-
|
|
439
|
-
validVertexCount++;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
if (vertices.isEmpty()) {
|
|
444
|
-
Log.e(TAG, "No valid vertices generated for LCC grid");
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
for (int row = 0; row < subdivisions; row++) {
|
|
449
|
-
for (int col = 0; col < subdivisions; col++) {
|
|
450
|
-
VertexInfo topLeft = (VertexInfo) vertexGrid[row][col];
|
|
451
|
-
VertexInfo topRight = (VertexInfo) vertexGrid[row][col + 1];
|
|
452
|
-
VertexInfo bottomLeft = (VertexInfo) vertexGrid[row + 1][col];
|
|
453
|
-
VertexInfo bottomRight = (VertexInfo) vertexGrid[row + 1][col + 1];
|
|
454
|
-
|
|
455
|
-
if (topLeft != null && topRight != null && bottomLeft != null && bottomRight != null) {
|
|
456
|
-
indices.add(topLeft.index);
|
|
457
|
-
indices.add(bottomLeft.index);
|
|
458
|
-
indices.add(topRight.index);
|
|
459
|
-
|
|
460
|
-
indices.add(topRight.index);
|
|
461
|
-
indices.add(bottomLeft.index);
|
|
462
|
-
indices.add(bottomRight.index);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
private static class VertexInfo {
|
|
469
|
-
float mercX, mercY, texU, texV;
|
|
470
|
-
short index;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
private double[] projectLCCToLatLon(double x, double y, ReadableMap projParams) {
|
|
474
|
-
try {
|
|
475
|
-
StringBuilder projString = new StringBuilder("+proj=lcc");
|
|
476
|
-
|
|
477
|
-
if (projParams.hasKey("lat_1")) projString.append(" +lat_1=").append(projParams.getDouble("lat_1"));
|
|
478
|
-
if (projParams.hasKey("lat_2")) projString.append(" +lat_2=").append(projParams.getDouble("lat_2"));
|
|
479
|
-
if (projParams.hasKey("lat_0")) projString.append(" +lat_0=").append(projParams.getDouble("lat_0"));
|
|
480
|
-
if (projParams.hasKey("lon_0")) projString.append(" +lon_0=").append(projParams.getDouble("lon_0"));
|
|
481
|
-
if (projParams.hasKey("x_0")) projString.append(" +x_0=").append(projParams.getDouble("x_0"));
|
|
482
|
-
if (projParams.hasKey("y_0")) projString.append(" +y_0=").append(projParams.getDouble("y_0"));
|
|
483
|
-
if (projParams.hasKey("ellps")) projString.append(" +ellps=").append(projParams.getString("ellps"));
|
|
484
|
-
if (projParams.hasKey("a")) projString.append(" +a=").append(projParams.getDouble("a"));
|
|
485
|
-
if (projParams.hasKey("b")) projString.append(" +b=").append(projParams.getDouble("b"));
|
|
486
|
-
projString.append(" +units=m +no_defs");
|
|
487
|
-
|
|
488
|
-
org.locationtech.proj4j.CRSFactory crsFactory = new org.locationtech.proj4j.CRSFactory();
|
|
489
|
-
org.locationtech.proj4j.CoordinateReferenceSystem srcCRS = crsFactory.createFromParameters("LCC", projString.toString());
|
|
490
|
-
org.locationtech.proj4j.CoordinateReferenceSystem dstCRS = crsFactory.createFromParameters("WGS84", "+proj=longlat +datum=WGS84 +no_defs");
|
|
491
|
-
|
|
492
|
-
org.locationtech.proj4j.CoordinateTransformFactory ctFactory = new org.locationtech.proj4j.CoordinateTransformFactory();
|
|
493
|
-
org.locationtech.proj4j.CoordinateTransform transform = ctFactory.createTransform(srcCRS, dstCRS);
|
|
494
|
-
|
|
495
|
-
org.locationtech.proj4j.ProjCoordinate srcCoord = new org.locationtech.proj4j.ProjCoordinate(x, y);
|
|
496
|
-
org.locationtech.proj4j.ProjCoordinate dstCoord = new org.locationtech.proj4j.ProjCoordinate();
|
|
497
|
-
transform.transform(srcCoord, dstCoord);
|
|
498
|
-
|
|
499
|
-
return new double[]{dstCoord.x, dstCoord.y};
|
|
500
|
-
|
|
501
|
-
} catch (Exception e) {
|
|
502
|
-
Log.e(TAG, "Error in LCC projection: " + e.getMessage());
|
|
503
|
-
return null;
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
private boolean isLCCType(ReadableMap gridDefMap) {
|
|
508
|
-
if (gridDefMap == null) return false;
|
|
509
|
-
ReadableMap projParams = gridDefMap.getMap("proj_params");
|
|
510
|
-
if (projParams == null) return false;
|
|
511
|
-
return projParams.hasKey("proj") && "lcc".equals(projParams.getString("proj"));
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
public void updateGeometry(ReadableMap cornersMap, ReadableMap gridDefMap) {
|
|
515
|
-
if (gridDefMap == null) return;
|
|
516
|
-
ArrayList<Float> vertices = new ArrayList<>();
|
|
517
|
-
ArrayList<Short> indices = new ArrayList<>();
|
|
518
|
-
generateGeometryData(gridDefMap, vertices, indices);
|
|
519
|
-
if (vertices.isEmpty() || indices.isEmpty()) {
|
|
520
|
-
Log.e(TAG, "Generated geometry is empty, aborting GPU buffer update.");
|
|
521
|
-
return;
|
|
522
|
-
}
|
|
523
|
-
FloatBuffer vb = ByteBuffer.allocateDirect(vertices.size() * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
|
524
|
-
float[] vertexArray = new float[vertices.size()];
|
|
525
|
-
for (int i = 0; i < vertices.size(); i++) vertexArray[i] = vertices.get(i);
|
|
526
|
-
vb.put(vertexArray).position(0);
|
|
527
|
-
ShortBuffer ib = ByteBuffer.allocateDirect(indices.size() * 2).order(ByteOrder.nativeOrder()).asShortBuffer();
|
|
528
|
-
short[] indexArray = new short[indices.size()];
|
|
529
|
-
for (int i = 0; i < indices.size(); i++) indexArray[i] = indices.get(i);
|
|
530
|
-
ib.put(indexArray).position(0);
|
|
531
|
-
synchronized (dataLock) {
|
|
532
|
-
pendingVertexBuffer = vb;
|
|
533
|
-
pendingIndexBuffer = ib;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
private boolean isGFSType(ReadableMap gridParams) {
|
|
538
|
-
if (gridParams == null) return false;
|
|
539
|
-
return getDouble(gridParams, "lon_first", -1) == 0.0 &&
|
|
540
|
-
Math.abs(getDouble(gridParams, "lat_first", -1)) == 90.0;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
private void generateGeometryData(ReadableMap gridDefMap, ArrayList<Float> vertices, ArrayList<Short> indices) {
|
|
544
|
-
ReadableMap gridParams = gridDefMap.getMap("grid_params");
|
|
545
|
-
if (gridParams == null) {
|
|
546
|
-
Log.e(TAG, "❌ [Geometry] grid_params is null. Aborting mesh generation.");
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
// --- Path 1: Specialized GFS Global Grid Logic (Working Correctly) ---
|
|
551
|
-
if (isGFSType(gridParams)) {
|
|
552
|
-
// This proven logic remains unchanged.
|
|
553
|
-
int subdivisions = 120;
|
|
554
|
-
int verticesPerRow = (subdivisions * 3) + 1;
|
|
555
|
-
final double TILE_SIZE = 512.0;
|
|
556
|
-
for (int row = 0; row <= subdivisions; row++) {
|
|
557
|
-
for (int col = 0; col <= subdivisions * 3; col++) {
|
|
558
|
-
float v_interp = (float) row / subdivisions;
|
|
559
|
-
float u_interp = (float) col / subdivisions;
|
|
560
|
-
double lon = -540.0 + u_interp * 1080.0;
|
|
561
|
-
double lat = -90.0 + v_interp * 180.0;
|
|
562
|
-
double mercX_normalized = (lon + 180.0) / 360.0;
|
|
563
|
-
double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, lat));
|
|
564
|
-
double sinLatitude = Math.sin(Math.toRadians(clampedLat));
|
|
565
|
-
double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
|
|
566
|
-
double mercX = mercX_normalized * TILE_SIZE;
|
|
567
|
-
double mercY = mercY_normalized * TILE_SIZE;
|
|
568
|
-
vertices.add((float) mercX);
|
|
569
|
-
vertices.add((float) mercY);
|
|
570
|
-
float tex_u = (float) ((lon + 180.0) / 360.0);
|
|
571
|
-
float tex_v = 1.0f - v_interp;
|
|
572
|
-
vertices.add(tex_u);
|
|
573
|
-
vertices.add(tex_v);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
for (short row = 0; row < subdivisions; row++) {
|
|
577
|
-
for (short col = 0; col < subdivisions * 3; col++) {
|
|
578
|
-
short tl = (short) (row * verticesPerRow + col);
|
|
579
|
-
short tr = (short) (tl + 1);
|
|
580
|
-
short bl = (short) ((row + 1) * verticesPerRow + col);
|
|
581
|
-
short br = (short) (bl + 1);
|
|
582
|
-
indices.add(tl); indices.add(bl); indices.add(tr);
|
|
583
|
-
indices.add(tr); indices.add(bl); indices.add(br);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
// --- Path 2: LCC Grid Logic ---
|
|
590
|
-
if (isLCCType(gridDefMap)) {
|
|
591
|
-
generateLCCGeometry(gridDefMap, vertices, indices);
|
|
592
|
-
return;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
// Step 1: Extract grid parameters
|
|
596
|
-
int nx = gridParams.getInt("nx");
|
|
597
|
-
int ny = gridParams.getInt("ny");
|
|
598
|
-
double lon_first = getDouble(gridParams, "lon_first", 0.0);
|
|
599
|
-
double lat_first = getDouble(gridParams, "lat_first", 90.0);
|
|
600
|
-
double dx = getDouble(gridParams, "dx_degrees", 0.0);
|
|
601
|
-
double dy = getDouble(gridParams, "dy_degrees", 0.0);
|
|
602
|
-
double lon_last = getDouble(gridParams, "lon_last", lon_first + (nx - 1) * dx);
|
|
603
|
-
double lat_last = getDouble(gridParams, "lat_last", lat_first + (ny - 1) * dy);
|
|
604
|
-
double lat_span = lat_last - lat_first;
|
|
605
|
-
boolean isSouthToNorth = lat_span > 0;
|
|
606
|
-
|
|
607
|
-
// Step 2: Normalize data longitudes to the -180 to +180 range for consistent placement.
|
|
608
|
-
double data_lon_first_180 = lon_first > 180 ? lon_first - 360 : lon_first;
|
|
609
|
-
double data_lon_last_180 = lon_last > 180 ? lon_last - 360 : lon_last;
|
|
610
|
-
double data_lon_range = data_lon_last_180 - data_lon_first_180;
|
|
611
|
-
|
|
612
|
-
// Step 3: Define mesh properties
|
|
613
|
-
int subdivisions_x = 120; // Subdivisions for a single mesh instance
|
|
614
|
-
int subdivisions_y = 60;
|
|
615
|
-
int verticesPerMesh = (subdivisions_y + 1) * (subdivisions_x + 1);
|
|
616
|
-
int verticesPerRow = subdivisions_x + 1;
|
|
617
|
-
final double TILE_SIZE = 512.0;
|
|
618
|
-
|
|
619
|
-
// Step 4: Generate three separate, non-connected meshes to prevent seam artifacts
|
|
620
|
-
for (int world_copy = -1; world_copy <= 1; world_copy++) {
|
|
621
|
-
short vertexStartIndex = (short) (vertices.size() / 4); // 4 floats per vertex (x,y,u,v)
|
|
622
|
-
double lon_offset = world_copy * 360.0;
|
|
623
|
-
|
|
624
|
-
// Generate vertices for this specific world copy
|
|
625
|
-
for (int row = 0; row <= subdivisions_y; row++) {
|
|
626
|
-
for (int col = 0; col <= subdivisions_x; col++) {
|
|
627
|
-
float v_interp = (float) row / subdivisions_y;
|
|
628
|
-
float u_interp = (float) col / subdivisions_x;
|
|
629
|
-
|
|
630
|
-
// Vertex position is interpolated across the data's native bounds, then offset for the world copy
|
|
631
|
-
double vertex_lon = data_lon_first_180 + (u_interp * data_lon_range);
|
|
632
|
-
double vertex_lat = lat_first + (v_interp * lat_span);
|
|
633
|
-
|
|
634
|
-
// Convert to map coordinates, adding the world copy offset
|
|
635
|
-
double mercX_normalized = ((vertex_lon + lon_offset) + 180.0) / 360.0;
|
|
636
|
-
double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, vertex_lat));
|
|
637
|
-
double sinLatitude = Math.sin(Math.toRadians(clampedLat));
|
|
638
|
-
double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
|
|
639
|
-
double mercX = mercX_normalized * TILE_SIZE;
|
|
640
|
-
double mercY = mercY_normalized * TILE_SIZE;
|
|
641
|
-
|
|
642
|
-
vertices.add((float) mercX);
|
|
643
|
-
vertices.add((float) mercY);
|
|
644
|
-
|
|
645
|
-
// Texture coordinates are always a clean 0.0 to 1.0 for each mesh instance
|
|
646
|
-
float tex_u = u_interp;
|
|
647
|
-
float tex_v = isSouthToNorth ? (1.0f - v_interp) : v_interp;
|
|
648
|
-
|
|
649
|
-
vertices.add(tex_u);
|
|
650
|
-
vertices.add(tex_v);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
// Generate indices for this specific world copy, offsetting by the starting index
|
|
655
|
-
for (short row = 0; row < subdivisions_y; row++) {
|
|
656
|
-
for (short col = 0; col < subdivisions_x; col++) {
|
|
657
|
-
short tl = (short) (vertexStartIndex + row * verticesPerRow + col);
|
|
658
|
-
short tr = (short) (tl + 1);
|
|
659
|
-
short bl = (short) (vertexStartIndex + (row + 1) * verticesPerRow + col);
|
|
660
|
-
short br = (short) (bl + 1);
|
|
661
|
-
|
|
662
|
-
if (isSouthToNorth) {
|
|
663
|
-
indices.add(tl); indices.add(bl); indices.add(tr);
|
|
664
|
-
indices.add(tr); indices.add(bl); indices.add(br);
|
|
665
|
-
} else { // North-to-South (MRMS)
|
|
666
|
-
indices.add(tl); indices.add(tr); indices.add(bl);
|
|
667
|
-
indices.add(bl); indices.add(tr); indices.add(br);
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
}
|
|
1
|
+
// packages/react-native/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java
|
|
2
|
+
|
|
3
|
+
package com.aguacerowx.reactnative;
|
|
4
|
+
|
|
5
|
+
import android.content.Context;
|
|
6
|
+
import android.opengl.GLES20;
|
|
7
|
+
import android.util.Log;
|
|
8
|
+
|
|
9
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
10
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
11
|
+
import com.mapbox.maps.CustomLayerHost;
|
|
12
|
+
import com.mapbox.maps.CustomLayerRenderParameters;
|
|
13
|
+
|
|
14
|
+
import java.io.InputStream;
|
|
15
|
+
import java.nio.ByteBuffer;
|
|
16
|
+
import java.nio.ByteOrder;
|
|
17
|
+
import java.nio.FloatBuffer;
|
|
18
|
+
import java.nio.ShortBuffer;
|
|
19
|
+
import java.util.ArrayList;
|
|
20
|
+
import java.util.List;
|
|
21
|
+
import java.util.Scanner;
|
|
22
|
+
|
|
23
|
+
import java.io.File;
|
|
24
|
+
import java.io.FileInputStream;
|
|
25
|
+
import java.io.IOException;
|
|
26
|
+
import com.github.luben.zstd.Zstd;
|
|
27
|
+
|
|
28
|
+
public class GridRenderLayer implements CustomLayerHost {
|
|
29
|
+
private final Context context;
|
|
30
|
+
private final String TAG = "AguaceroWX";
|
|
31
|
+
private int program;
|
|
32
|
+
|
|
33
|
+
// Uniform and Attribute locations
|
|
34
|
+
private int uMatrix, uDataTexture, uColormapTexture, uOpacity, uDataRange,
|
|
35
|
+
uScale, uOffset, uMissingQuantized, uTextureSize, uConversionType, uSmoothing,
|
|
36
|
+
uScaleType, uIsPtype;
|
|
37
|
+
private int aPosition, aTexCoord;
|
|
38
|
+
|
|
39
|
+
// GPU-side resource IDs
|
|
40
|
+
private int dataTextureId = 0;
|
|
41
|
+
private int colormapTextureId = 0;
|
|
42
|
+
private int vboId = 0;
|
|
43
|
+
private int iboId = 0;
|
|
44
|
+
private int indexCount = 0;
|
|
45
|
+
|
|
46
|
+
// Layer properties
|
|
47
|
+
private float opacity = 1.0f;
|
|
48
|
+
private float[] dataRange = new float[]{0.0f, 1.0f};
|
|
49
|
+
private float scale = 1.0f;
|
|
50
|
+
private float offset = 0.0f;
|
|
51
|
+
private float missingQuantized = 127.0f;
|
|
52
|
+
private int textureWidth = 0;
|
|
53
|
+
private int textureHeight = 0;
|
|
54
|
+
private int conversionType = 0;
|
|
55
|
+
private boolean smoothingEnabled = true;
|
|
56
|
+
private int scaleType = 0;
|
|
57
|
+
private boolean isPtype = false; // ADDED
|
|
58
|
+
private String currentVariable = "";
|
|
59
|
+
private boolean textureParametersDirty = true;
|
|
60
|
+
private volatile boolean isVisible = true;
|
|
61
|
+
|
|
62
|
+
// Pending data buffers for thread-safe uploads
|
|
63
|
+
private final Object dataLock = new Object();
|
|
64
|
+
private ByteBuffer pendingDataBuffer = null;
|
|
65
|
+
private int pendingNx = 0, pendingNy = 0;
|
|
66
|
+
private float pendingScale = 1.0f, pendingOffset = 0.0f, pendingMissing = 127.0f;
|
|
67
|
+
private int pendingScaleType = 0;
|
|
68
|
+
private ByteBuffer pendingColormapBuffer = null;
|
|
69
|
+
private FloatBuffer pendingVertexBuffer = null;
|
|
70
|
+
private ShortBuffer pendingIndexBuffer = null;
|
|
71
|
+
private int uIsMRMS;
|
|
72
|
+
private boolean isMRMS = false;
|
|
73
|
+
|
|
74
|
+
public GridRenderLayer(Context context) {
|
|
75
|
+
this.context = context;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private double getDouble(ReadableMap map, String key, double defaultValue) {
|
|
79
|
+
return map.hasKey(key) ? map.getDouble(key) : defaultValue;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private String loadShaderSource(int resourceId) {
|
|
83
|
+
InputStream inputStream = context.getResources().openRawResource(resourceId);
|
|
84
|
+
return new Scanner(inputStream).useDelimiter("\\A").next();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private int createShader(int type, String source) {
|
|
88
|
+
int shader = GLES20.glCreateShader(type);
|
|
89
|
+
if (shader == 0) return 0;
|
|
90
|
+
GLES20.glShaderSource(shader, source);
|
|
91
|
+
GLES20.glCompileShader(shader);
|
|
92
|
+
final int[] compileStatus = new int[1];
|
|
93
|
+
GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compileStatus, 0);
|
|
94
|
+
if (compileStatus[0] == 0) {
|
|
95
|
+
Log.e(TAG, "Error compiling shader: " + GLES20.glGetShaderInfoLog(shader));
|
|
96
|
+
GLES20.glDeleteShader(shader);
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
return shader;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@Override
|
|
103
|
+
public void initialize() {
|
|
104
|
+
String vertexSource = loadShaderSource(R.raw.vertex_shader);
|
|
105
|
+
String fragmentSource = loadShaderSource(R.raw.fragment_shader);
|
|
106
|
+
int vertexShader = createShader(GLES20.GL_VERTEX_SHADER, vertexSource);
|
|
107
|
+
int fragmentShader = createShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
|
|
108
|
+
|
|
109
|
+
program = GLES20.glCreateProgram();
|
|
110
|
+
GLES20.glAttachShader(program, vertexShader);
|
|
111
|
+
GLES20.glAttachShader(program, fragmentShader);
|
|
112
|
+
GLES20.glLinkProgram(program);
|
|
113
|
+
|
|
114
|
+
uMatrix = GLES20.glGetUniformLocation(program, "u_matrix");
|
|
115
|
+
uDataTexture = GLES20.glGetUniformLocation(program, "u_data_texture");
|
|
116
|
+
uColormapTexture = GLES20.glGetUniformLocation(program, "u_colormap_texture");
|
|
117
|
+
uOpacity = GLES20.glGetUniformLocation(program, "u_opacity");
|
|
118
|
+
uDataRange = GLES20.glGetUniformLocation(program, "u_data_range");
|
|
119
|
+
uScale = GLES20.glGetUniformLocation(program, "u_scale");
|
|
120
|
+
uOffset = GLES20.glGetUniformLocation(program, "u_offset");
|
|
121
|
+
uMissingQuantized = GLES20.glGetUniformLocation(program, "u_missing_quantized");
|
|
122
|
+
uTextureSize = GLES20.glGetUniformLocation(program, "u_texture_size");
|
|
123
|
+
uConversionType = GLES20.glGetUniformLocation(program, "u_conversion_type");
|
|
124
|
+
uSmoothing = GLES20.glGetUniformLocation(program, "u_smoothing");
|
|
125
|
+
uScaleType = GLES20.glGetUniformLocation(program, "u_scale_type");
|
|
126
|
+
uIsPtype = GLES20.glGetUniformLocation(program, "u_is_ptype");
|
|
127
|
+
uIsMRMS = GLES20.glGetUniformLocation(program, "u_is_mrms");
|
|
128
|
+
aPosition = GLES20.glGetAttribLocation(program, "a_position");
|
|
129
|
+
aTexCoord = GLES20.glGetAttribLocation(program, "a_texCoord");
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public void setVariable(String variable) {
|
|
133
|
+
if (variable == null) {
|
|
134
|
+
this.currentVariable = "";
|
|
135
|
+
} else {
|
|
136
|
+
this.currentVariable = variable;
|
|
137
|
+
}
|
|
138
|
+
// MODIFICATION: Add detailed logging here
|
|
139
|
+
this.isPtype = "ptypeRefl".equals(this.currentVariable) || "ptypeRate".equals(this.currentVariable);
|
|
140
|
+
Log.d(TAG, "setVariable called. Variable: '" + this.currentVariable + "', isPtype set to: " + this.isPtype);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
public void setIsMRMS(boolean isMRMS) {
|
|
144
|
+
this.isMRMS = isMRMS;
|
|
145
|
+
Log.d(TAG, "setIsMRMS called with: " + isMRMS);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public void clearData() {
|
|
149
|
+
this.isVisible = false;
|
|
150
|
+
// Also clear any pending data to prevent a stale frame from rendering
|
|
151
|
+
synchronized (dataLock) {
|
|
152
|
+
pendingDataBuffer = null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@Override
|
|
157
|
+
public void render(CustomLayerRenderParameters renderParameters) {
|
|
158
|
+
if (program == 0 || !isVisible) return;
|
|
159
|
+
|
|
160
|
+
synchronized (dataLock) {
|
|
161
|
+
if (pendingVertexBuffer != null && pendingIndexBuffer != null) {
|
|
162
|
+
this.indexCount = pendingIndexBuffer.capacity();
|
|
163
|
+
if (vboId == 0) {
|
|
164
|
+
int[] bufs = new int[2];
|
|
165
|
+
GLES20.glGenBuffers(2, bufs, 0);
|
|
166
|
+
vboId = bufs[0];
|
|
167
|
+
iboId = bufs[1];
|
|
168
|
+
}
|
|
169
|
+
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboId);
|
|
170
|
+
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, pendingVertexBuffer.capacity() * 4, pendingVertexBuffer, GLES20.GL_STATIC_DRAW);
|
|
171
|
+
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, iboId);
|
|
172
|
+
GLES20.glBufferData(GLES20.GL_ELEMENT_ARRAY_BUFFER, pendingIndexBuffer.capacity() * 2, pendingIndexBuffer, GLES20.GL_STATIC_DRAW);
|
|
173
|
+
pendingVertexBuffer = null;
|
|
174
|
+
pendingIndexBuffer = null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (pendingDataBuffer != null) {
|
|
178
|
+
// --- FIX 2: LOGICAL FIX FOR TEXTURE RESIZING ---
|
|
179
|
+
boolean dimensionsChanged = (pendingNx != this.textureWidth || pendingNy != this.textureHeight);
|
|
180
|
+
|
|
181
|
+
this.textureWidth = pendingNx;
|
|
182
|
+
this.textureHeight = pendingNy;
|
|
183
|
+
this.scale = pendingScale;
|
|
184
|
+
this.offset = pendingOffset;
|
|
185
|
+
this.missingQuantized = pendingMissing;
|
|
186
|
+
this.scaleType = pendingScaleType;
|
|
187
|
+
|
|
188
|
+
if (dataTextureId == 0) {
|
|
189
|
+
int[] t = new int[1];
|
|
190
|
+
GLES20.glGenTextures(1, t, 0);
|
|
191
|
+
dataTextureId = t[0];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
195
|
+
|
|
196
|
+
if (dimensionsChanged || dataTextureId == 0) {
|
|
197
|
+
int filter = smoothingEnabled ? GLES20.GL_LINEAR : GLES20.GL_NEAREST;
|
|
198
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, filter);
|
|
199
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, filter);
|
|
200
|
+
|
|
201
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
|
202
|
+
|
|
203
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
|
|
204
|
+
GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
|
|
205
|
+
|
|
206
|
+
pendingDataBuffer.position(0);
|
|
207
|
+
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_ALPHA, pendingNx, pendingNy, 0, GLES20.GL_ALPHA, GLES20.GL_UNSIGNED_BYTE, pendingDataBuffer);
|
|
208
|
+
} else {
|
|
209
|
+
// Texture dimensions are the same, so just update its contents efficiently
|
|
210
|
+
pendingDataBuffer.position(0);
|
|
211
|
+
GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, pendingNx, pendingNy, GLES20.GL_ALPHA, GLES20.GL_UNSIGNED_BYTE, pendingDataBuffer);
|
|
212
|
+
}
|
|
213
|
+
pendingDataBuffer = null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (pendingColormapBuffer != null) {
|
|
217
|
+
if (colormapTextureId == 0) {
|
|
218
|
+
int[] t = new int[1];
|
|
219
|
+
GLES20.glGenTextures(1, t, 0);
|
|
220
|
+
colormapTextureId = t[0];
|
|
221
|
+
}
|
|
222
|
+
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, colormapTextureId);
|
|
223
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
|
|
224
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
|
|
225
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
|
|
226
|
+
pendingColormapBuffer.position(0);
|
|
227
|
+
GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pendingColormapBuffer);
|
|
228
|
+
pendingColormapBuffer = null;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
double zoom = renderParameters.getZoom();
|
|
233
|
+
|
|
234
|
+
if (vboId == 0 || iboId == 0 || indexCount == 0 || dataTextureId == 0 || colormapTextureId == 0) return;
|
|
235
|
+
|
|
236
|
+
if (textureParametersDirty) {
|
|
237
|
+
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
238
|
+
int filter = smoothingEnabled ? GLES20.GL_LINEAR : GLES20.GL_NEAREST;
|
|
239
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, filter);
|
|
240
|
+
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, filter);
|
|
241
|
+
textureParametersDirty = false;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
GLES20.glUseProgram(program);
|
|
245
|
+
|
|
246
|
+
double scale = Math.pow(2.0, zoom);
|
|
247
|
+
|
|
248
|
+
List<Double> matrix = renderParameters.getProjectionMatrix();
|
|
249
|
+
float[] floatMatrix = new float[16];
|
|
250
|
+
for (int i = 0; i < 16; i++) {
|
|
251
|
+
floatMatrix[i] = matrix.get(i).floatValue();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
floatMatrix[0] *= scale // X scale
|
|
255
|
+
floatMatrix[1] *= scale // X rotation
|
|
256
|
+
floatMatrix[2] *= scale // X Z-component
|
|
257
|
+
floatMatrix[3] *= scale // X translation
|
|
258
|
+
floatMatrix[4] *= scale // Y rotation
|
|
259
|
+
floatMatrix[5] *= scale // Y scale
|
|
260
|
+
floatMatrix[6] *= scale // Y Z-component
|
|
261
|
+
floatMatrix[7] *= scale // Y translation
|
|
262
|
+
floatMatrix[8] *= scale // Z X-component
|
|
263
|
+
floatMatrix[9] *= scale // Z Y-component
|
|
264
|
+
floatMatrix[10] *= scale // Z scale
|
|
265
|
+
floatMatrix[11] *= scale // Z translation
|
|
266
|
+
|
|
267
|
+
GLES20.glUniformMatrix4fv(uMatrix, 1, false, floatMatrix, 0);
|
|
268
|
+
GLES20.glUniform1f(uOpacity, opacity);
|
|
269
|
+
GLES20.glUniform2fv(uDataRange, 1, dataRange, 0);
|
|
270
|
+
GLES20.glUniform1f(uScale, this.scale);
|
|
271
|
+
GLES20.glUniform1f(uOffset, offset);
|
|
272
|
+
GLES20.glUniform1f(uMissingQuantized, missingQuantized);
|
|
273
|
+
GLES20.glUniform2f(uTextureSize, (float) textureWidth, (float) textureHeight);
|
|
274
|
+
GLES20.glUniform1i(uConversionType, conversionType);
|
|
275
|
+
GLES20.glUniform1i(uSmoothing, smoothingEnabled ? 1 : 0);
|
|
276
|
+
GLES20.glUniform1i(uScaleType, this.scaleType);
|
|
277
|
+
GLES20.glUniform1i(uIsPtype, this.isPtype ? 1 : 0);
|
|
278
|
+
GLES20.glUniform1i(uIsMRMS, this.isMRMS ? 1 : 0);
|
|
279
|
+
|
|
280
|
+
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
|
281
|
+
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
|
|
282
|
+
GLES20.glUniform1i(uDataTexture, 0);
|
|
283
|
+
|
|
284
|
+
GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
|
|
285
|
+
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, colormapTextureId);
|
|
286
|
+
GLES20.glUniform1i(uColormapTexture, 1);
|
|
287
|
+
|
|
288
|
+
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboId);
|
|
289
|
+
GLES20.glEnableVertexAttribArray(aPosition);
|
|
290
|
+
GLES20.glVertexAttribPointer(aPosition, 2, GLES20.GL_FLOAT, false, 16, 0);
|
|
291
|
+
GLES20.glEnableVertexAttribArray(aTexCoord);
|
|
292
|
+
GLES20.glVertexAttribPointer(aTexCoord, 2, GLES20.GL_FLOAT, false, 16, 8);
|
|
293
|
+
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, iboId);
|
|
294
|
+
|
|
295
|
+
GLES20.glEnable(GLES20.GL_BLEND);
|
|
296
|
+
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
|
|
297
|
+
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
|
|
298
|
+
|
|
299
|
+
GLES20.glDrawElements(GLES20.GL_TRIANGLES, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);
|
|
300
|
+
|
|
301
|
+
GLES20.glDisableVertexAttribArray(aPosition);
|
|
302
|
+
GLES20.glDisableVertexAttribArray(aTexCoord);
|
|
303
|
+
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
|
|
304
|
+
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
@Override
|
|
308
|
+
public void deinitialize() {
|
|
309
|
+
if (program != 0) { GLES20.glDeleteProgram(program); program = 0; }
|
|
310
|
+
int[] texturesToDelete = {dataTextureId, colormapTextureId};
|
|
311
|
+
GLES20.glDeleteTextures(2, texturesToDelete, 0);
|
|
312
|
+
dataTextureId = 0; colormapTextureId = 0;
|
|
313
|
+
int[] buffersToDelete = {vboId, iboId};
|
|
314
|
+
GLES20.glDeleteBuffers(2, buffersToDelete, 0);
|
|
315
|
+
vboId = 0; iboId = 0;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@Override
|
|
319
|
+
public void contextLost() {
|
|
320
|
+
program = 0; dataTextureId = 0; colormapTextureId = 0; vboId = 0; iboId = 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
public void setOpacity(float opacity) { this.opacity = opacity; }
|
|
324
|
+
public void setDataRange(float[] dataRange) { this.dataRange = dataRange; }
|
|
325
|
+
public void setConversionType(int type) { this.conversionType = type; }
|
|
326
|
+
public void setSmoothing(boolean enabled) {
|
|
327
|
+
if (this.smoothingEnabled != enabled) {
|
|
328
|
+
this.smoothingEnabled = enabled;
|
|
329
|
+
this.textureParametersDirty = true;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// Add this method to GridRenderLayer.java (around line 270)
|
|
334
|
+
public void updateDataParameters(float scale, float offset, float missing) {
|
|
335
|
+
synchronized (dataLock) {
|
|
336
|
+
this.scale = scale;
|
|
337
|
+
this.offset = offset;
|
|
338
|
+
this.missingQuantized = missing;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// This existing method is now used by both the old JS path and our new native path
|
|
343
|
+
public void updateDataTexture(byte[] bytes, int nx, int ny, float scale, float offset, float missing, String scaleType) {
|
|
344
|
+
ByteBuffer dataBuffer = ByteBuffer.allocateDirect(bytes.length);
|
|
345
|
+
dataBuffer.put(bytes);
|
|
346
|
+
dataBuffer.position(0);
|
|
347
|
+
synchronized (dataLock) {
|
|
348
|
+
this.pendingDataBuffer = dataBuffer;
|
|
349
|
+
this.pendingNx = nx;
|
|
350
|
+
this.pendingNy = ny;
|
|
351
|
+
this.pendingScale = scale;
|
|
352
|
+
this.pendingOffset = offset;
|
|
353
|
+
this.pendingMissing = missing;
|
|
354
|
+
this.pendingScaleType = "sqrt".equals(scaleType) ? 1 : 0;
|
|
355
|
+
}
|
|
356
|
+
// When new data is provided, ensure the layer is visible
|
|
357
|
+
this.isVisible = true;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
public void updateColormapTexture(ByteBuffer data) {
|
|
361
|
+
synchronized (dataLock) { this.pendingColormapBuffer = data; }
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
private void generateLCCGeometry(ReadableMap gridDefMap, ArrayList<Float> vertices, ArrayList<Short> indices) {
|
|
365
|
+
ReadableMap gridParams = gridDefMap.getMap("grid_params");
|
|
366
|
+
ReadableMap projParams = gridDefMap.getMap("proj_params");
|
|
367
|
+
|
|
368
|
+
if (gridParams == null || projParams == null) {
|
|
369
|
+
Log.e(TAG, "Missing grid or projection parameters for LCC");
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
int nx = gridParams.getInt("nx");
|
|
374
|
+
int ny = gridParams.getInt("ny");
|
|
375
|
+
double dx = getDouble(gridParams, "dx", 0);
|
|
376
|
+
double dy = getDouble(gridParams, "dy", 0);
|
|
377
|
+
double x_origin = getDouble(gridParams, "x_origin", 0);
|
|
378
|
+
double y_origin = getDouble(gridParams, "y_origin", 0);
|
|
379
|
+
|
|
380
|
+
int subdivisions = 60;
|
|
381
|
+
final double TILE_SIZE = 512.0;
|
|
382
|
+
|
|
383
|
+
double x_min = x_origin;
|
|
384
|
+
double y_max = y_origin;
|
|
385
|
+
double x_max = x_origin + (nx - 1) * dx;
|
|
386
|
+
double y_min = y_origin + (ny - 1) * dy;
|
|
387
|
+
|
|
388
|
+
Object[][] vertexGrid = new Object[subdivisions + 1][subdivisions + 1];
|
|
389
|
+
int validVertexCount = 0;
|
|
390
|
+
|
|
391
|
+
for (int row = 0; row <= subdivisions; row++) {
|
|
392
|
+
for (int col = 0; col <= subdivisions; col++) {
|
|
393
|
+
double t_x = (double) col / subdivisions;
|
|
394
|
+
double t_y = (double) row / subdivisions;
|
|
395
|
+
|
|
396
|
+
double proj_x = x_min + t_x * (x_max - x_min);
|
|
397
|
+
double proj_y = y_max + t_y * (y_min - y_max);
|
|
398
|
+
|
|
399
|
+
double[] latLon = projectLCCToLatLon(proj_x, proj_y, projParams);
|
|
400
|
+
|
|
401
|
+
if (latLon == null) {
|
|
402
|
+
vertexGrid[row][col] = null;
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
double lon = latLon[0];
|
|
407
|
+
double lat = latLon[1];
|
|
408
|
+
|
|
409
|
+
double mercX_normalized = (lon + 180.0) / 360.0;
|
|
410
|
+
double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, lat));
|
|
411
|
+
double sinLatitude = Math.sin(Math.toRadians(clampedLat));
|
|
412
|
+
double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
|
|
413
|
+
|
|
414
|
+
double mercX = mercX_normalized * TILE_SIZE;
|
|
415
|
+
double mercY = mercY_normalized * TILE_SIZE;
|
|
416
|
+
|
|
417
|
+
if (!Double.isFinite(mercX) || !Double.isFinite(mercY)) {
|
|
418
|
+
vertexGrid[row][col] = null;
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
float tex_u = (float) t_x;
|
|
423
|
+
float tex_v = (float) t_y;
|
|
424
|
+
|
|
425
|
+
VertexInfo vInfo = new VertexInfo();
|
|
426
|
+
vInfo.mercX = (float) mercX;
|
|
427
|
+
vInfo.mercY = (float) mercY;
|
|
428
|
+
vInfo.texU = tex_u;
|
|
429
|
+
vInfo.texV = tex_v;
|
|
430
|
+
vInfo.index = (short) validVertexCount;
|
|
431
|
+
|
|
432
|
+
vertexGrid[row][col] = vInfo;
|
|
433
|
+
|
|
434
|
+
vertices.add((float) mercX);
|
|
435
|
+
vertices.add((float) mercY);
|
|
436
|
+
vertices.add(tex_u);
|
|
437
|
+
vertices.add(tex_v);
|
|
438
|
+
|
|
439
|
+
validVertexCount++;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (vertices.isEmpty()) {
|
|
444
|
+
Log.e(TAG, "No valid vertices generated for LCC grid");
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
for (int row = 0; row < subdivisions; row++) {
|
|
449
|
+
for (int col = 0; col < subdivisions; col++) {
|
|
450
|
+
VertexInfo topLeft = (VertexInfo) vertexGrid[row][col];
|
|
451
|
+
VertexInfo topRight = (VertexInfo) vertexGrid[row][col + 1];
|
|
452
|
+
VertexInfo bottomLeft = (VertexInfo) vertexGrid[row + 1][col];
|
|
453
|
+
VertexInfo bottomRight = (VertexInfo) vertexGrid[row + 1][col + 1];
|
|
454
|
+
|
|
455
|
+
if (topLeft != null && topRight != null && bottomLeft != null && bottomRight != null) {
|
|
456
|
+
indices.add(topLeft.index);
|
|
457
|
+
indices.add(bottomLeft.index);
|
|
458
|
+
indices.add(topRight.index);
|
|
459
|
+
|
|
460
|
+
indices.add(topRight.index);
|
|
461
|
+
indices.add(bottomLeft.index);
|
|
462
|
+
indices.add(bottomRight.index);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
private static class VertexInfo {
|
|
469
|
+
float mercX, mercY, texU, texV;
|
|
470
|
+
short index;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
private double[] projectLCCToLatLon(double x, double y, ReadableMap projParams) {
|
|
474
|
+
try {
|
|
475
|
+
StringBuilder projString = new StringBuilder("+proj=lcc");
|
|
476
|
+
|
|
477
|
+
if (projParams.hasKey("lat_1")) projString.append(" +lat_1=").append(projParams.getDouble("lat_1"));
|
|
478
|
+
if (projParams.hasKey("lat_2")) projString.append(" +lat_2=").append(projParams.getDouble("lat_2"));
|
|
479
|
+
if (projParams.hasKey("lat_0")) projString.append(" +lat_0=").append(projParams.getDouble("lat_0"));
|
|
480
|
+
if (projParams.hasKey("lon_0")) projString.append(" +lon_0=").append(projParams.getDouble("lon_0"));
|
|
481
|
+
if (projParams.hasKey("x_0")) projString.append(" +x_0=").append(projParams.getDouble("x_0"));
|
|
482
|
+
if (projParams.hasKey("y_0")) projString.append(" +y_0=").append(projParams.getDouble("y_0"));
|
|
483
|
+
if (projParams.hasKey("ellps")) projString.append(" +ellps=").append(projParams.getString("ellps"));
|
|
484
|
+
if (projParams.hasKey("a")) projString.append(" +a=").append(projParams.getDouble("a"));
|
|
485
|
+
if (projParams.hasKey("b")) projString.append(" +b=").append(projParams.getDouble("b"));
|
|
486
|
+
projString.append(" +units=m +no_defs");
|
|
487
|
+
|
|
488
|
+
org.locationtech.proj4j.CRSFactory crsFactory = new org.locationtech.proj4j.CRSFactory();
|
|
489
|
+
org.locationtech.proj4j.CoordinateReferenceSystem srcCRS = crsFactory.createFromParameters("LCC", projString.toString());
|
|
490
|
+
org.locationtech.proj4j.CoordinateReferenceSystem dstCRS = crsFactory.createFromParameters("WGS84", "+proj=longlat +datum=WGS84 +no_defs");
|
|
491
|
+
|
|
492
|
+
org.locationtech.proj4j.CoordinateTransformFactory ctFactory = new org.locationtech.proj4j.CoordinateTransformFactory();
|
|
493
|
+
org.locationtech.proj4j.CoordinateTransform transform = ctFactory.createTransform(srcCRS, dstCRS);
|
|
494
|
+
|
|
495
|
+
org.locationtech.proj4j.ProjCoordinate srcCoord = new org.locationtech.proj4j.ProjCoordinate(x, y);
|
|
496
|
+
org.locationtech.proj4j.ProjCoordinate dstCoord = new org.locationtech.proj4j.ProjCoordinate();
|
|
497
|
+
transform.transform(srcCoord, dstCoord);
|
|
498
|
+
|
|
499
|
+
return new double[]{dstCoord.x, dstCoord.y};
|
|
500
|
+
|
|
501
|
+
} catch (Exception e) {
|
|
502
|
+
Log.e(TAG, "Error in LCC projection: " + e.getMessage());
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
private boolean isLCCType(ReadableMap gridDefMap) {
|
|
508
|
+
if (gridDefMap == null) return false;
|
|
509
|
+
ReadableMap projParams = gridDefMap.getMap("proj_params");
|
|
510
|
+
if (projParams == null) return false;
|
|
511
|
+
return projParams.hasKey("proj") && "lcc".equals(projParams.getString("proj"));
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
public void updateGeometry(ReadableMap cornersMap, ReadableMap gridDefMap) {
|
|
515
|
+
if (gridDefMap == null) return;
|
|
516
|
+
ArrayList<Float> vertices = new ArrayList<>();
|
|
517
|
+
ArrayList<Short> indices = new ArrayList<>();
|
|
518
|
+
generateGeometryData(gridDefMap, vertices, indices);
|
|
519
|
+
if (vertices.isEmpty() || indices.isEmpty()) {
|
|
520
|
+
Log.e(TAG, "Generated geometry is empty, aborting GPU buffer update.");
|
|
521
|
+
return;
|
|
522
|
+
}
|
|
523
|
+
FloatBuffer vb = ByteBuffer.allocateDirect(vertices.size() * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
|
524
|
+
float[] vertexArray = new float[vertices.size()];
|
|
525
|
+
for (int i = 0; i < vertices.size(); i++) vertexArray[i] = vertices.get(i);
|
|
526
|
+
vb.put(vertexArray).position(0);
|
|
527
|
+
ShortBuffer ib = ByteBuffer.allocateDirect(indices.size() * 2).order(ByteOrder.nativeOrder()).asShortBuffer();
|
|
528
|
+
short[] indexArray = new short[indices.size()];
|
|
529
|
+
for (int i = 0; i < indices.size(); i++) indexArray[i] = indices.get(i);
|
|
530
|
+
ib.put(indexArray).position(0);
|
|
531
|
+
synchronized (dataLock) {
|
|
532
|
+
pendingVertexBuffer = vb;
|
|
533
|
+
pendingIndexBuffer = ib;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
private boolean isGFSType(ReadableMap gridParams) {
|
|
538
|
+
if (gridParams == null) return false;
|
|
539
|
+
return getDouble(gridParams, "lon_first", -1) == 0.0 &&
|
|
540
|
+
Math.abs(getDouble(gridParams, "lat_first", -1)) == 90.0;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
private void generateGeometryData(ReadableMap gridDefMap, ArrayList<Float> vertices, ArrayList<Short> indices) {
|
|
544
|
+
ReadableMap gridParams = gridDefMap.getMap("grid_params");
|
|
545
|
+
if (gridParams == null) {
|
|
546
|
+
Log.e(TAG, "❌ [Geometry] grid_params is null. Aborting mesh generation.");
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// --- Path 1: Specialized GFS Global Grid Logic (Working Correctly) ---
|
|
551
|
+
if (isGFSType(gridParams)) {
|
|
552
|
+
// This proven logic remains unchanged.
|
|
553
|
+
int subdivisions = 120;
|
|
554
|
+
int verticesPerRow = (subdivisions * 3) + 1;
|
|
555
|
+
final double TILE_SIZE = 512.0;
|
|
556
|
+
for (int row = 0; row <= subdivisions; row++) {
|
|
557
|
+
for (int col = 0; col <= subdivisions * 3; col++) {
|
|
558
|
+
float v_interp = (float) row / subdivisions;
|
|
559
|
+
float u_interp = (float) col / subdivisions;
|
|
560
|
+
double lon = -540.0 + u_interp * 1080.0;
|
|
561
|
+
double lat = -90.0 + v_interp * 180.0;
|
|
562
|
+
double mercX_normalized = (lon + 180.0) / 360.0;
|
|
563
|
+
double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, lat));
|
|
564
|
+
double sinLatitude = Math.sin(Math.toRadians(clampedLat));
|
|
565
|
+
double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
|
|
566
|
+
double mercX = mercX_normalized * TILE_SIZE;
|
|
567
|
+
double mercY = mercY_normalized * TILE_SIZE;
|
|
568
|
+
vertices.add((float) mercX);
|
|
569
|
+
vertices.add((float) mercY);
|
|
570
|
+
float tex_u = (float) ((lon + 180.0) / 360.0);
|
|
571
|
+
float tex_v = 1.0f - v_interp;
|
|
572
|
+
vertices.add(tex_u);
|
|
573
|
+
vertices.add(tex_v);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
for (short row = 0; row < subdivisions; row++) {
|
|
577
|
+
for (short col = 0; col < subdivisions * 3; col++) {
|
|
578
|
+
short tl = (short) (row * verticesPerRow + col);
|
|
579
|
+
short tr = (short) (tl + 1);
|
|
580
|
+
short bl = (short) ((row + 1) * verticesPerRow + col);
|
|
581
|
+
short br = (short) (bl + 1);
|
|
582
|
+
indices.add(tl); indices.add(bl); indices.add(tr);
|
|
583
|
+
indices.add(tr); indices.add(bl); indices.add(br);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// --- Path 2: LCC Grid Logic ---
|
|
590
|
+
if (isLCCType(gridDefMap)) {
|
|
591
|
+
generateLCCGeometry(gridDefMap, vertices, indices);
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// Step 1: Extract grid parameters
|
|
596
|
+
int nx = gridParams.getInt("nx");
|
|
597
|
+
int ny = gridParams.getInt("ny");
|
|
598
|
+
double lon_first = getDouble(gridParams, "lon_first", 0.0);
|
|
599
|
+
double lat_first = getDouble(gridParams, "lat_first", 90.0);
|
|
600
|
+
double dx = getDouble(gridParams, "dx_degrees", 0.0);
|
|
601
|
+
double dy = getDouble(gridParams, "dy_degrees", 0.0);
|
|
602
|
+
double lon_last = getDouble(gridParams, "lon_last", lon_first + (nx - 1) * dx);
|
|
603
|
+
double lat_last = getDouble(gridParams, "lat_last", lat_first + (ny - 1) * dy);
|
|
604
|
+
double lat_span = lat_last - lat_first;
|
|
605
|
+
boolean isSouthToNorth = lat_span > 0;
|
|
606
|
+
|
|
607
|
+
// Step 2: Normalize data longitudes to the -180 to +180 range for consistent placement.
|
|
608
|
+
double data_lon_first_180 = lon_first > 180 ? lon_first - 360 : lon_first;
|
|
609
|
+
double data_lon_last_180 = lon_last > 180 ? lon_last - 360 : lon_last;
|
|
610
|
+
double data_lon_range = data_lon_last_180 - data_lon_first_180;
|
|
611
|
+
|
|
612
|
+
// Step 3: Define mesh properties
|
|
613
|
+
int subdivisions_x = 120; // Subdivisions for a single mesh instance
|
|
614
|
+
int subdivisions_y = 60;
|
|
615
|
+
int verticesPerMesh = (subdivisions_y + 1) * (subdivisions_x + 1);
|
|
616
|
+
int verticesPerRow = subdivisions_x + 1;
|
|
617
|
+
final double TILE_SIZE = 512.0;
|
|
618
|
+
|
|
619
|
+
// Step 4: Generate three separate, non-connected meshes to prevent seam artifacts
|
|
620
|
+
for (int world_copy = -1; world_copy <= 1; world_copy++) {
|
|
621
|
+
short vertexStartIndex = (short) (vertices.size() / 4); // 4 floats per vertex (x,y,u,v)
|
|
622
|
+
double lon_offset = world_copy * 360.0;
|
|
623
|
+
|
|
624
|
+
// Generate vertices for this specific world copy
|
|
625
|
+
for (int row = 0; row <= subdivisions_y; row++) {
|
|
626
|
+
for (int col = 0; col <= subdivisions_x; col++) {
|
|
627
|
+
float v_interp = (float) row / subdivisions_y;
|
|
628
|
+
float u_interp = (float) col / subdivisions_x;
|
|
629
|
+
|
|
630
|
+
// Vertex position is interpolated across the data's native bounds, then offset for the world copy
|
|
631
|
+
double vertex_lon = data_lon_first_180 + (u_interp * data_lon_range);
|
|
632
|
+
double vertex_lat = lat_first + (v_interp * lat_span);
|
|
633
|
+
|
|
634
|
+
// Convert to map coordinates, adding the world copy offset
|
|
635
|
+
double mercX_normalized = ((vertex_lon + lon_offset) + 180.0) / 360.0;
|
|
636
|
+
double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, vertex_lat));
|
|
637
|
+
double sinLatitude = Math.sin(Math.toRadians(clampedLat));
|
|
638
|
+
double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
|
|
639
|
+
double mercX = mercX_normalized * TILE_SIZE;
|
|
640
|
+
double mercY = mercY_normalized * TILE_SIZE;
|
|
641
|
+
|
|
642
|
+
vertices.add((float) mercX);
|
|
643
|
+
vertices.add((float) mercY);
|
|
644
|
+
|
|
645
|
+
// Texture coordinates are always a clean 0.0 to 1.0 for each mesh instance
|
|
646
|
+
float tex_u = u_interp;
|
|
647
|
+
float tex_v = isSouthToNorth ? (1.0f - v_interp) : v_interp;
|
|
648
|
+
|
|
649
|
+
vertices.add(tex_u);
|
|
650
|
+
vertices.add(tex_v);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// Generate indices for this specific world copy, offsetting by the starting index
|
|
655
|
+
for (short row = 0; row < subdivisions_y; row++) {
|
|
656
|
+
for (short col = 0; col < subdivisions_x; col++) {
|
|
657
|
+
short tl = (short) (vertexStartIndex + row * verticesPerRow + col);
|
|
658
|
+
short tr = (short) (tl + 1);
|
|
659
|
+
short bl = (short) (vertexStartIndex + (row + 1) * verticesPerRow + col);
|
|
660
|
+
short br = (short) (bl + 1);
|
|
661
|
+
|
|
662
|
+
if (isSouthToNorth) {
|
|
663
|
+
indices.add(tl); indices.add(bl); indices.add(tr);
|
|
664
|
+
indices.add(tr); indices.add(bl); indices.add(br);
|
|
665
|
+
} else { // North-to-South (MRMS)
|
|
666
|
+
indices.add(tl); indices.add(tr); indices.add(bl);
|
|
667
|
+
indices.add(bl); indices.add(tr); indices.add(br);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
673
|
}
|