@aguacerowx/react-native 0.0.41 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/README.md +126 -126
  2. package/aguacerowx-react-native.podspec +38 -38
  3. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  4. package/android/build/.transforms/42e9b8fa82d77a1c205db5bf0d0ed519/results.bin +1 -0
  5. package/android/build/.transforms/42e9b8fa82d77a1c205db5bf0d0ed519/transformed/classes/classes_dex/classes.dex +0 -0
  6. package/android/build/.transforms/8f329a9571a96a1c1c0869d49784e448/results.bin +1 -0
  7. package/android/build/.transforms/8f329a9571a96a1c1c0869d49784e448/transformed/classes/classes_dex/classes.dex +0 -0
  8. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/results.bin +1 -0
  9. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/AguaceroPackage.dex +0 -0
  10. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/BuildConfig.dex +0 -0
  11. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.dex +0 -0
  12. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayer.dex +0 -0
  13. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderLayerView.dex +0 -0
  14. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/GridRenderManager.dex +0 -0
  15. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/InspectorModule.dex +0 -0
  16. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/ShaderUtils.dex +0 -0
  17. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/WeatherFrameProcessorModule$1.dex +0 -0
  18. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/aguacerowx/reactnative/WeatherFrameProcessorModule.dex +0 -0
  19. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.dex +0 -0
  20. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.dex +0 -0
  21. package/android/build/.transforms/c8ab78b63f2cc835ac936d58e29a17ab/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  22. package/android/build/.transforms/f95abdfc98a7a06fc247f75cdd74def9/results.bin +1 -0
  23. package/android/build/.transforms/f95abdfc98a7a06fc247f75cdd74def9/transformed/classes/classes_dex/classes.dex +0 -0
  24. package/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
  25. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.java +43 -0
  26. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.java +22 -0
  27. package/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec-generated.cpp +22 -0
  28. package/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec.h +24 -0
  29. package/android/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
  30. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI-generated.cpp +17 -0
  31. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI.h +19 -0
  32. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.cpp +22 -0
  33. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.h +24 -0
  34. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.cpp +16 -0
  35. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.h +23 -0
  36. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.cpp +62 -0
  37. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.h +40 -0
  38. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.cpp +17 -0
  39. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.h +32 -0
  40. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.cpp +16 -0
  41. package/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.h +20 -0
  42. package/android/build/generated/source/codegen/schema.json +1 -0
  43. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
  44. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  45. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  46. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  47. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  48. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  49. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
  50. package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
  51. package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
  52. package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  53. package/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
  54. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
  55. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  56. package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  57. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  58. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  59. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  60. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  61. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  62. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  63. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  64. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  65. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  66. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  67. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule$1.class +0 -0
  68. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  69. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
  70. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
  71. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
  72. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
  73. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
  74. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  75. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  76. package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
  77. package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
  78. package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +181 -0
  79. package/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
  80. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  81. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  82. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  83. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  84. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  85. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  86. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  87. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  88. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule$1.class +0 -0
  89. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  90. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
  91. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
  92. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  93. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
  94. package/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
  95. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId2 +0 -0
  96. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WeatherFrameProcessorModule$1.class.uniqueId0 +0 -0
  97. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WeatherFrameProcessorModule.class.uniqueId1 +0 -0
  98. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  99. package/android/build.gradle +107 -107
  100. package/android/src/main/AndroidManifest.xml +6 -6
  101. package/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +33 -33
  102. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +732 -688
  103. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +232 -304
  104. package/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +125 -125
  105. package/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +145 -71
  106. package/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +106 -106
  107. package/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +270 -151
  108. package/android/src/main/res/raw/debug_fragment_shader.glsl +12 -12
  109. package/android/src/main/res/raw/debug_vertex_shader.glsl +12 -12
  110. package/android/src/main/res/raw/fragment_shader.glsl +180 -180
  111. package/android/src/main/res/raw/vertex_shader.glsl +19 -19
  112. package/index.js +2 -2
  113. package/ios/AguaceroPackage.m +18 -18
  114. package/ios/FragmentUniforms.swift +15 -15
  115. package/ios/GridRenderLayer.swift +1158 -1158
  116. package/ios/GridRenderLayerBridge.swift +44 -44
  117. package/ios/GridRenderLayerManager.mm +171 -171
  118. package/ios/GridRenderLayerView.h +30 -30
  119. package/ios/GridRenderLayerView.m +200 -200
  120. package/ios/InspectorDataCache.swift +63 -63
  121. package/ios/InspectorModule.m +9 -9
  122. package/ios/InspectorModule.swift +112 -112
  123. package/ios/Shaders.metal +319 -319
  124. package/ios/WeatherFrameProcessorModule.m +15 -15
  125. package/ios/WeatherFrameProcessorModule.swift +152 -152
  126. package/lib/commonjs/README.md +126 -126
  127. package/lib/commonjs/aguacerowx-react-native.podspec +38 -38
  128. package/lib/commonjs/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
  129. package/lib/commonjs/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.java +43 -0
  130. package/lib/commonjs/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.java +22 -0
  131. package/lib/commonjs/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec-generated.cpp +22 -0
  132. package/lib/commonjs/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec.h +24 -0
  133. package/lib/commonjs/android/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
  134. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI-generated.cpp +17 -0
  135. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI.h +19 -0
  136. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.cpp +22 -0
  137. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.h +24 -0
  138. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.cpp +16 -0
  139. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.h +23 -0
  140. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.cpp +62 -0
  141. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.h +40 -0
  142. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.cpp +17 -0
  143. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.h +32 -0
  144. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.cpp +16 -0
  145. package/lib/commonjs/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.h +20 -0
  146. package/lib/commonjs/android/build/generated/source/codegen/schema.json +1 -0
  147. package/lib/commonjs/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
  148. package/lib/commonjs/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  149. package/lib/commonjs/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  150. package/lib/commonjs/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  151. package/lib/commonjs/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  152. package/lib/commonjs/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  153. package/lib/commonjs/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
  154. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
  155. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
  156. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  157. package/lib/commonjs/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
  158. package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
  159. package/lib/commonjs/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  160. package/lib/commonjs/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  161. package/lib/commonjs/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  162. package/lib/commonjs/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  163. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  164. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  165. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  166. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  167. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  168. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  169. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  170. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  171. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule$1.class +0 -0
  172. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  173. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
  174. package/lib/commonjs/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
  175. package/lib/commonjs/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
  176. package/lib/commonjs/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
  177. package/lib/commonjs/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
  178. package/lib/commonjs/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  179. package/lib/commonjs/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  180. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
  181. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
  182. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +181 -0
  183. package/lib/commonjs/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
  184. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  185. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  186. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  187. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  188. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  189. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  190. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  191. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  192. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule$1.class +0 -0
  193. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  194. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
  195. package/lib/commonjs/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
  196. package/lib/commonjs/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  197. package/lib/commonjs/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
  198. package/lib/commonjs/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
  199. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId2 +0 -0
  200. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WeatherFrameProcessorModule$1.class.uniqueId0 +0 -0
  201. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WeatherFrameProcessorModule.class.uniqueId1 +0 -0
  202. package/lib/commonjs/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  203. package/lib/commonjs/android/build.gradle +107 -107
  204. package/lib/commonjs/android/src/main/AndroidManifest.xml +6 -6
  205. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +33 -33
  206. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +732 -688
  207. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +232 -304
  208. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +125 -125
  209. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +145 -71
  210. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +106 -106
  211. package/lib/commonjs/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +270 -151
  212. package/lib/commonjs/android/src/main/res/raw/debug_fragment_shader.glsl +12 -12
  213. package/lib/commonjs/android/src/main/res/raw/debug_vertex_shader.glsl +12 -12
  214. package/lib/commonjs/android/src/main/res/raw/fragment_shader.glsl +180 -180
  215. package/lib/commonjs/android/src/main/res/raw/vertex_shader.glsl +19 -19
  216. package/lib/commonjs/babel.config.js.map +1 -1
  217. package/lib/commonjs/index.js.map +1 -1
  218. package/lib/commonjs/ios/AguaceroPackage.m +18 -18
  219. package/lib/commonjs/ios/FragmentUniforms.swift +15 -15
  220. package/lib/commonjs/ios/GridRenderLayer.swift +1158 -1158
  221. package/lib/commonjs/ios/GridRenderLayerBridge.swift +44 -44
  222. package/lib/commonjs/ios/GridRenderLayerManager.mm +171 -171
  223. package/lib/commonjs/ios/GridRenderLayerView.h +30 -30
  224. package/lib/commonjs/ios/GridRenderLayerView.m +200 -200
  225. package/lib/commonjs/ios/InspectorDataCache.swift +63 -63
  226. package/lib/commonjs/ios/InspectorModule.m +9 -9
  227. package/lib/commonjs/ios/InspectorModule.swift +112 -112
  228. package/lib/commonjs/ios/Shaders.metal +319 -319
  229. package/lib/commonjs/ios/WeatherFrameProcessorModule.m +15 -15
  230. package/lib/commonjs/ios/WeatherFrameProcessorModule.swift +152 -152
  231. package/lib/commonjs/package.json +72 -72
  232. package/lib/commonjs/react-native-builder-bob.config.js.map +1 -1
  233. package/lib/commonjs/scripts/compile-shaders.js.map +1 -1
  234. package/lib/commonjs/scripts/compile-shaders.sh +38 -38
  235. package/lib/commonjs/src/AguaceroContext.js.map +1 -1
  236. package/lib/commonjs/src/GridRenderLayer.js.map +1 -1
  237. package/lib/commonjs/src/GridRenderLayerNativeComponent.js.map +1 -1
  238. package/lib/commonjs/src/MapManager.js.map +1 -1
  239. package/lib/commonjs/src/MapRegistry.js.map +1 -1
  240. package/lib/commonjs/src/StyleApplicator.js +6 -6
  241. package/lib/commonjs/src/StyleApplicator.js.map +1 -1
  242. package/lib/commonjs/src/WeatherLayerManager.js +6 -27
  243. package/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  244. package/lib/commonjs/tsconfig.json +23 -23
  245. package/lib/module/README.md +126 -126
  246. package/lib/module/aguacerowx-react-native.podspec +38 -38
  247. package/lib/module/android/build/generated/source/buildConfig/debug/com/aguacerowx/reactnative/BuildConfig.java +10 -0
  248. package/lib/module/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.java +43 -0
  249. package/lib/module/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.java +22 -0
  250. package/lib/module/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec-generated.cpp +22 -0
  251. package/lib/module/android/build/generated/source/codegen/jni/AguaceroWxReactNativeSpec.h +24 -0
  252. package/lib/module/android/build/generated/source/codegen/jni/CMakeLists.txt +28 -0
  253. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI-generated.cpp +17 -0
  254. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/AguaceroWxReactNativeSpecJSI.h +19 -0
  255. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.cpp +22 -0
  256. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ComponentDescriptors.h +24 -0
  257. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.cpp +16 -0
  258. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/EventEmitters.h +23 -0
  259. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.cpp +62 -0
  260. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/Props.h +40 -0
  261. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.cpp +17 -0
  262. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/ShadowNodes.h +32 -0
  263. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.cpp +16 -0
  264. package/lib/module/android/build/generated/source/codegen/jni/react/renderer/components/AguaceroWxReactNativeSpec/States.h +20 -0
  265. package/lib/module/android/build/generated/source/codegen/schema.json +1 -0
  266. package/lib/module/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +8 -0
  267. package/lib/module/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  268. package/lib/module/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  269. package/lib/module/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  270. package/lib/module/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  271. package/lib/module/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  272. package/lib/module/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +4 -0
  273. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_fragment_shader.glsl.flat +0 -0
  274. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_debug_vertex_shader.glsl.flat +0 -0
  275. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_fragment_shader.glsl.flat +0 -0
  276. package/lib/module/android/build/intermediates/compiled_local_resources/debug/compileDebugLibraryResources/out/raw_vertex_shader.glsl.flat +0 -0
  277. package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +5 -0
  278. package/lib/module/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  279. package/lib/module/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  280. package/lib/module/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  281. package/lib/module/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  282. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  283. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  284. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  285. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  286. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  287. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  288. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  289. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  290. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule$1.class +0 -0
  291. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  292. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
  293. package/lib/module/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
  294. package/lib/module/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +6 -0
  295. package/lib/module/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +8 -0
  296. package/lib/module/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +8 -0
  297. package/lib/module/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  298. package/lib/module/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  299. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_fragment_shader.glsl +13 -0
  300. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/debug_vertex_shader.glsl +13 -0
  301. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/fragment_shader.glsl +181 -0
  302. package/lib/module/android/build/intermediates/packaged_res/debug/packageDebugResources/raw/vertex_shader.glsl +20 -0
  303. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/AguaceroPackage.class +0 -0
  304. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/BuildConfig.class +0 -0
  305. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer$VertexInfo.class +0 -0
  306. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayer.class +0 -0
  307. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderLayerView.class +0 -0
  308. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/GridRenderManager.class +0 -0
  309. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/InspectorModule.class +0 -0
  310. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/ShaderUtils.class +0 -0
  311. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule$1.class +0 -0
  312. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/aguacerowx/reactnative/WeatherFrameProcessorModule.class +0 -0
  313. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerDelegate.class +0 -0
  314. package/lib/module/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/GridRenderLayerManagerInterface.class +0 -0
  315. package/lib/module/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  316. package/lib/module/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +5 -0
  317. package/lib/module/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
  318. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/AguaceroPackage.class.uniqueId2 +0 -0
  319. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WeatherFrameProcessorModule$1.class.uniqueId0 +0 -0
  320. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/WeatherFrameProcessorModule.class.uniqueId1 +0 -0
  321. package/lib/module/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  322. package/lib/module/android/build.gradle +107 -107
  323. package/lib/module/android/src/main/AndroidManifest.xml +6 -6
  324. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/AguaceroPackage.java +33 -33
  325. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayer.java +732 -688
  326. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderLayerView.java +232 -304
  327. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/GridRenderManager.java +125 -125
  328. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/InspectorModule.java +145 -71
  329. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/ShaderUtils.java +106 -106
  330. package/lib/module/android/src/main/java/com/aguacerowx/reactnative/WeatherFrameProcessorModule.java +270 -151
  331. package/lib/module/android/src/main/res/raw/debug_fragment_shader.glsl +12 -12
  332. package/lib/module/android/src/main/res/raw/debug_vertex_shader.glsl +12 -12
  333. package/lib/module/android/src/main/res/raw/fragment_shader.glsl +180 -180
  334. package/lib/module/android/src/main/res/raw/vertex_shader.glsl +19 -19
  335. package/lib/module/babel.config.js.map +1 -1
  336. package/lib/module/index.js.map +1 -1
  337. package/lib/module/ios/AguaceroPackage.m +18 -18
  338. package/lib/module/ios/FragmentUniforms.swift +15 -15
  339. package/lib/module/ios/GridRenderLayer.swift +1158 -1158
  340. package/lib/module/ios/GridRenderLayerBridge.swift +44 -44
  341. package/lib/module/ios/GridRenderLayerManager.mm +171 -171
  342. package/lib/module/ios/GridRenderLayerView.h +30 -30
  343. package/lib/module/ios/GridRenderLayerView.m +200 -200
  344. package/lib/module/ios/InspectorDataCache.swift +63 -63
  345. package/lib/module/ios/InspectorModule.m +9 -9
  346. package/lib/module/ios/InspectorModule.swift +112 -112
  347. package/lib/module/ios/Shaders.metal +319 -319
  348. package/lib/module/ios/WeatherFrameProcessorModule.m +15 -15
  349. package/lib/module/ios/WeatherFrameProcessorModule.swift +152 -152
  350. package/lib/module/lib/commonjs/README.md +126 -126
  351. package/lib/module/lib/commonjs/aguacerowx-react-native.podspec +38 -38
  352. package/lib/module/lib/commonjs/android/build.gradle +108 -0
  353. package/lib/module/lib/commonjs/android/src/main/AndroidManifest.xml +7 -0
  354. package/lib/module/lib/commonjs/babel.config.js.map +1 -1
  355. package/lib/module/lib/commonjs/index.js.map +1 -1
  356. package/lib/module/lib/commonjs/ios/AguaceroPackage.m +19 -0
  357. package/lib/module/lib/commonjs/ios/FragmentUniforms.swift +16 -0
  358. package/lib/module/lib/commonjs/ios/GridRenderLayer.swift +1159 -0
  359. package/lib/module/lib/commonjs/ios/GridRenderLayerBridge.swift +45 -0
  360. package/lib/module/lib/commonjs/ios/GridRenderLayerManager.mm +172 -0
  361. package/lib/module/lib/commonjs/ios/GridRenderLayerView.h +31 -0
  362. package/lib/module/lib/commonjs/ios/GridRenderLayerView.m +201 -0
  363. package/lib/module/lib/commonjs/ios/InspectorDataCache.swift +64 -0
  364. package/lib/module/lib/commonjs/ios/InspectorModule.m +10 -0
  365. package/lib/module/lib/commonjs/ios/InspectorModule.swift +113 -0
  366. package/lib/module/lib/commonjs/ios/Shaders.metal +320 -0
  367. package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.m +16 -0
  368. package/lib/module/lib/commonjs/ios/WeatherFrameProcessorModule.swift +153 -0
  369. package/lib/module/lib/commonjs/ios/compiled-shaders/Shaders-device.metallib +0 -0
  370. package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec-generated.mm +0 -0
  371. package/lib/module/lib/commonjs/ios/generated/AguaceroWxReactNativeSpec.h +0 -0
  372. package/lib/module/lib/commonjs/package.json +72 -72
  373. package/lib/module/lib/commonjs/react-native-builder-bob.config.js.map +1 -1
  374. package/lib/module/lib/commonjs/scripts/compile-shaders.js.map +1 -1
  375. package/lib/module/lib/commonjs/scripts/compile-shaders.sh +39 -0
  376. package/lib/module/lib/commonjs/src/AguaceroContext.js.map +1 -1
  377. package/lib/module/lib/commonjs/src/GridRenderLayer.js.map +1 -1
  378. package/lib/module/lib/commonjs/src/GridRenderLayerNativeComponent.js.map +1 -1
  379. package/lib/module/lib/commonjs/src/MapManager.js.map +1 -1
  380. package/lib/module/lib/commonjs/src/MapRegistry.js.map +1 -1
  381. package/lib/module/lib/commonjs/src/StyleApplicator.js +6 -6
  382. package/lib/module/lib/commonjs/src/StyleApplicator.js.map +1 -1
  383. package/lib/module/lib/commonjs/src/WeatherLayerManager.js +6 -27
  384. package/lib/module/lib/commonjs/src/WeatherLayerManager.js.map +1 -1
  385. package/lib/module/lib/commonjs/tsconfig.json +23 -23
  386. package/lib/module/package.json +72 -72
  387. package/lib/module/react-native-builder-bob.config.js.map +1 -1
  388. package/lib/module/scripts/compile-shaders.js.map +1 -1
  389. package/lib/module/scripts/compile-shaders.sh +38 -38
  390. package/lib/module/src/AguaceroContext.js.map +1 -1
  391. package/lib/module/src/GridRenderLayer.js.map +1 -1
  392. package/lib/module/src/GridRenderLayerNativeComponent.js.map +1 -1
  393. package/lib/module/src/MapManager.js.map +1 -1
  394. package/lib/module/src/MapRegistry.js.map +1 -1
  395. package/lib/module/src/StyleApplicator.js +6 -6
  396. package/lib/module/src/StyleApplicator.js.map +1 -1
  397. package/lib/module/src/WeatherLayerManager.js +6 -27
  398. package/lib/module/src/WeatherLayerManager.js.map +1 -1
  399. package/lib/module/tsconfig.json +23 -23
  400. package/lib/typescript/src/WeatherLayerManager.d.ts.map +1 -1
  401. package/package.json +72 -72
  402. package/src/AguaceroContext.js +3 -3
  403. package/src/GridRenderLayer.js +215 -215
  404. package/src/GridRenderLayerNativeComponent.ts +15 -15
  405. package/src/MapManager.js +218 -218
  406. package/src/MapRegistry.js +34 -34
  407. package/src/StyleApplicator.js +240 -240
  408. package/src/WeatherLayerManager.js +1163 -1191
@@ -1,689 +1,733 @@
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 boolean isECMWFType(ReadableMap gridParams) {
544
- if (gridParams == null) return false;
545
- return getDouble(gridParams, "lon_first", -1) == 180.0 &&
546
- getDouble(gridParams, "lat_first", -1) == 90.0;
547
- }
548
-
549
- private void generateGeometryData(ReadableMap gridDefMap, ArrayList<Float> vertices, ArrayList<Short> indices) {
550
- ReadableMap gridParams = gridDefMap.getMap("grid_params");
551
- if (gridParams == null) {
552
- Log.e(TAG, "❌ [Geometry] grid_params is null. Aborting mesh generation.");
553
- return;
554
- }
555
-
556
- // --- Path 1: Specialized GFS Global Grid Logic (Working Correctly) ---
557
- if (isGFSType(gridParams)) {
558
- // This proven logic remains unchanged.
559
- int subdivisions = 120;
560
- int verticesPerRow = (subdivisions * 3) + 1;
561
- final double TILE_SIZE = 512.0;
562
- for (int row = 0; row <= subdivisions; row++) {
563
- for (int col = 0; col <= subdivisions * 3; col++) {
564
- float v_interp = (float) row / subdivisions;
565
- float u_interp = (float) col / subdivisions;
566
- double lon = -540.0 + u_interp * 1080.0;
567
- double lat = -90.0 + v_interp * 180.0;
568
- double mercX_normalized = (lon + 180.0) / 360.0;
569
- double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, lat));
570
- double sinLatitude = Math.sin(Math.toRadians(clampedLat));
571
- double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
572
- double mercX = mercX_normalized * TILE_SIZE;
573
- double mercY = mercY_normalized * TILE_SIZE;
574
- vertices.add((float) mercX);
575
- vertices.add((float) mercY);
576
- float tex_u = (float) ((lon + 180.0) / 360.0);
577
- float tex_v = 1.0f - v_interp;
578
- vertices.add(tex_u);
579
- vertices.add(tex_v);
580
- }
581
- }
582
- for (short row = 0; row < subdivisions; row++) {
583
- for (short col = 0; col < subdivisions * 3; col++) {
584
- short tl = (short) (row * verticesPerRow + col);
585
- short tr = (short) (tl + 1);
586
- short bl = (short) ((row + 1) * verticesPerRow + col);
587
- short br = (short) (bl + 1);
588
- indices.add(tl); indices.add(bl); indices.add(tr);
589
- indices.add(tr); indices.add(bl); indices.add(br);
590
- }
591
- }
592
- return;
593
- }
594
-
595
- // --- Path 2: LCC Grid Logic ---
596
- if (isLCCType(gridDefMap)) {
597
- generateLCCGeometry(gridDefMap, vertices, indices);
598
- return;
599
- }
600
-
601
- int nx = gridParams.getInt("nx");
602
- int ny = gridParams.getInt("ny");
603
- double lon_first = getDouble(gridParams, "lon_first", 0.0);
604
- double lat_first = getDouble(gridParams, "lat_first", 90.0);
605
- double dx = getDouble(gridParams, "dx_degrees", 0.0);
606
- double dy = getDouble(gridParams, "dy_degrees", 0.0);
607
- double lon_last = getDouble(gridParams, "lon_last", lon_first + (nx - 1) * dx);
608
- double lat_last = getDouble(gridParams, "lat_last", lat_first + (ny - 1) * dy);
609
- double lat_span = lat_last - lat_first;
610
- boolean isSouthToNorth = lat_span > 0;
611
-
612
- // Step 2: Check if this is ECMWF and normalize longitudes
613
- boolean isECMWF = isECMWFType(gridParams);
614
- double data_lon_first_180 = lon_first;
615
- double data_lon_last_180 = lon_last;
616
-
617
- if (isECMWF) {
618
- // Convert ECMWF's 180 to -180 range to -180 to 180
619
- data_lon_first_180 = lon_first >= 180 ? lon_first - 360 : lon_first;
620
- data_lon_last_180 = lon_last >= 180 ? lon_last - 360 : lon_last;
621
- } else {
622
- // For GFS and other models
623
- data_lon_first_180 = lon_first > 180 ? lon_first - 360 : lon_first;
624
- data_lon_last_180 = lon_last > 180 ? lon_last - 360 : lon_last;
625
- }
626
-
627
- double data_lon_range = data_lon_last_180 - data_lon_first_180;
628
-
629
- // Step 3: Define mesh properties
630
- int subdivisions_x = 120;
631
- int subdivisions_y = 60;
632
- int verticesPerRow = subdivisions_x + 1;
633
- final double TILE_SIZE = 512.0;
634
-
635
- // Step 4: Generate three separate meshes for wrapping
636
- for (int world_copy = -1; world_copy <= 1; world_copy++) {
637
- short vertexStartIndex = (short) (vertices.size() / 4);
638
- double lon_offset = world_copy * 360.0;
639
-
640
- // Generate vertices for this world copy
641
- for (int row = 0; row <= subdivisions_y; row++) {
642
- for (int col = 0; col <= subdivisions_x; col++) {
643
- float v_interp = (float) row / subdivisions_y;
644
- float u_interp = (float) col / subdivisions_x;
645
-
646
- // Vertex position interpolated across data's native bounds
647
- double vertex_lon = data_lon_first_180 + (u_interp * data_lon_range);
648
- double vertex_lat = lat_first + (v_interp * lat_span);
649
-
650
- // Convert to map coordinates with world copy offset
651
- double mercX_normalized = ((vertex_lon + lon_offset) + 180.0) / 360.0;
652
- double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, vertex_lat));
653
- double sinLatitude = Math.sin(Math.toRadians(clampedLat));
654
- double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
655
- double mercX = mercX_normalized * TILE_SIZE;
656
- double mercY = mercY_normalized * TILE_SIZE;
657
-
658
- vertices.add((float) mercX);
659
- vertices.add((float) mercY);
660
-
661
- // Texture coordinates: clean 0.0 to 1.0 for each mesh
662
- float tex_u = u_interp;
663
- float tex_v = isSouthToNorth ? (1.0f - v_interp) : v_interp;
664
-
665
- vertices.add(tex_u);
666
- vertices.add(tex_v);
667
- }
668
- }
669
-
670
- // Generate indices for this world copy
671
- for (short row = 0; row < subdivisions_y; row++) {
672
- for (short col = 0; col < subdivisions_x; col++) {
673
- short tl = (short) (vertexStartIndex + row * verticesPerRow + col);
674
- short tr = (short) (tl + 1);
675
- short bl = (short) (vertexStartIndex + (row + 1) * verticesPerRow + col);
676
- short br = (short) (bl + 1);
677
-
678
- if (isSouthToNorth) {
679
- indices.add(tl); indices.add(bl); indices.add(tr);
680
- indices.add(tr); indices.add(bl); indices.add(br);
681
- } else {
682
- indices.add(tl); indices.add(tr); indices.add(bl);
683
- indices.add(bl); indices.add(tr); indices.add(br);
684
- }
685
- }
686
- }
687
- }
688
- }
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
+ long t0 = System.nanoTime();
163
+ this.indexCount = pendingIndexBuffer.capacity();
164
+ int vertexBytes = pendingVertexBuffer.capacity() * 4;
165
+ int indexBytes = pendingIndexBuffer.capacity() * 2;
166
+
167
+ if (vboId == 0) {
168
+ int[] bufs = new int[2];
169
+ GLES20.glGenBuffers(2, bufs, 0);
170
+ vboId = bufs[0];
171
+ iboId = bufs[1];
172
+ }
173
+ GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboId);
174
+ GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, vertexBytes, pendingVertexBuffer, GLES20.GL_STATIC_DRAW);
175
+ GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, iboId);
176
+ GLES20.glBufferData(GLES20.GL_ELEMENT_ARRAY_BUFFER, indexBytes, pendingIndexBuffer, GLES20.GL_STATIC_DRAW);
177
+ pendingVertexBuffer = null;
178
+ pendingIndexBuffer = null;
179
+ long t1 = System.nanoTime();
180
+ Log.d(TAG, "[Render] VBO/IBO upload: " + ((t1 - t0) / 1_000_000) + " ms | VBO=" + (vertexBytes/1024) + "KB IBO=" + (indexBytes/1024) + "KB | indices=" + indexCount);
181
+ }
182
+
183
+ if (pendingDataBuffer != null) {
184
+ long t0 = System.nanoTime();
185
+ boolean dimensionsChanged = (pendingNx != this.textureWidth || pendingNy != this.textureHeight);
186
+ int texBytes = pendingNx * pendingNy; // GL_ALPHA = 1 byte/pixel
187
+
188
+ this.textureWidth = pendingNx;
189
+ this.textureHeight = pendingNy;
190
+ this.scale = pendingScale;
191
+ this.offset = pendingOffset;
192
+ this.missingQuantized = pendingMissing;
193
+ this.scaleType = pendingScaleType;
194
+
195
+ if (dataTextureId == 0) {
196
+ int[] t = new int[1];
197
+ GLES20.glGenTextures(1, t, 0);
198
+ dataTextureId = t[0];
199
+ }
200
+
201
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
202
+
203
+ if (dimensionsChanged || dataTextureId == 0) {
204
+ int filter = smoothingEnabled ? GLES20.GL_LINEAR : GLES20.GL_NEAREST;
205
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, filter);
206
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, filter);
207
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
208
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
209
+ GLES20.glPixelStorei(GLES20.GL_UNPACK_ALIGNMENT, 1);
210
+ pendingDataBuffer.position(0);
211
+ GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_ALPHA, pendingNx, pendingNy, 0, GLES20.GL_ALPHA, GLES20.GL_UNSIGNED_BYTE, pendingDataBuffer);
212
+ Log.d(TAG, "[Render] glTexImage2D (full alloc) " + pendingNx + "x" + pendingNy + " = " + (texBytes/1024) + " KB GPU");
213
+ } else {
214
+ pendingDataBuffer.position(0);
215
+ GLES20.glTexSubImage2D(GLES20.GL_TEXTURE_2D, 0, 0, 0, pendingNx, pendingNy, GLES20.GL_ALPHA, GLES20.GL_UNSIGNED_BYTE, pendingDataBuffer);
216
+ Log.d(TAG, "[Render] glTexSubImage2D (update) " + pendingNx + "x" + pendingNy + " = " + (texBytes/1024) + " KB");
217
+ }
218
+ pendingDataBuffer = null;
219
+ long t1 = System.nanoTime();
220
+ Log.d(TAG, "[Render] Data texture upload total: " + ((t1 - t0) / 1_000_000) + " ms");
221
+ }
222
+
223
+ if (pendingColormapBuffer != null) {
224
+ long t0 = System.nanoTime();
225
+ if (colormapTextureId == 0) {
226
+ int[] t = new int[1];
227
+ GLES20.glGenTextures(1, t, 0);
228
+ colormapTextureId = t[0];
229
+ }
230
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, colormapTextureId);
231
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_NEAREST);
232
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_NEAREST);
233
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
234
+ pendingColormapBuffer.position(0);
235
+ GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, 256, 1, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pendingColormapBuffer);
236
+ pendingColormapBuffer = null;
237
+ long t1 = System.nanoTime();
238
+ Log.d(TAG, "[Render] Colormap texture upload: " + ((t1 - t0) / 1_000_000) + " ms");
239
+ }
240
+ }
241
+
242
+ double zoom = renderParameters.getZoom();
243
+
244
+ if (vboId == 0 || iboId == 0 || indexCount == 0 || dataTextureId == 0 || colormapTextureId == 0) return;
245
+
246
+ if (textureParametersDirty) {
247
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
248
+ int filter = smoothingEnabled ? GLES20.GL_LINEAR : GLES20.GL_NEAREST;
249
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, filter);
250
+ GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, filter);
251
+ textureParametersDirty = false;
252
+ }
253
+
254
+ GLES20.glUseProgram(program);
255
+
256
+ double scale = Math.pow(2.0, zoom);
257
+
258
+ List<Double> matrix = renderParameters.getProjectionMatrix();
259
+ float[] floatMatrix = new float[16];
260
+ for (int i = 0; i < 16; i++) {
261
+ floatMatrix[i] = matrix.get(i).floatValue();
262
+ }
263
+
264
+ floatMatrix[0] *= scale; // X scale
265
+ floatMatrix[1] *= scale; // X rotation
266
+ floatMatrix[2] *= scale; // X Z-component
267
+ floatMatrix[3] *= scale; // X translation
268
+ floatMatrix[4] *= scale; // Y rotation
269
+ floatMatrix[5] *= scale; // Y scale
270
+ floatMatrix[6] *= scale; // Y Z-component
271
+ floatMatrix[7] *= scale; // Y translation
272
+ floatMatrix[8] *= scale; // Z X-component
273
+ floatMatrix[9] *= scale; // Z Y-component
274
+ floatMatrix[10] *= scale; // Z scale
275
+ floatMatrix[11] *= scale; // Z translation
276
+
277
+ GLES20.glUniformMatrix4fv(uMatrix, 1, false, floatMatrix, 0);
278
+ GLES20.glUniform1f(uOpacity, opacity);
279
+ GLES20.glUniform2fv(uDataRange, 1, dataRange, 0);
280
+ GLES20.glUniform1f(uScale, this.scale);
281
+ GLES20.glUniform1f(uOffset, offset);
282
+ GLES20.glUniform1f(uMissingQuantized, missingQuantized);
283
+ GLES20.glUniform2f(uTextureSize, (float) textureWidth, (float) textureHeight);
284
+ GLES20.glUniform1i(uConversionType, conversionType);
285
+ GLES20.glUniform1i(uSmoothing, smoothingEnabled ? 1 : 0);
286
+ GLES20.glUniform1i(uScaleType, this.scaleType);
287
+ GLES20.glUniform1i(uIsPtype, this.isPtype ? 1 : 0);
288
+ GLES20.glUniform1i(uIsMRMS, this.isMRMS ? 1 : 0);
289
+
290
+ GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
291
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, dataTextureId);
292
+ GLES20.glUniform1i(uDataTexture, 0);
293
+
294
+ GLES20.glActiveTexture(GLES20.GL_TEXTURE1);
295
+ GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, colormapTextureId);
296
+ GLES20.glUniform1i(uColormapTexture, 1);
297
+
298
+ GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vboId);
299
+ GLES20.glEnableVertexAttribArray(aPosition);
300
+ GLES20.glVertexAttribPointer(aPosition, 2, GLES20.GL_FLOAT, false, 16, 0);
301
+ GLES20.glEnableVertexAttribArray(aTexCoord);
302
+ GLES20.glVertexAttribPointer(aTexCoord, 2, GLES20.GL_FLOAT, false, 16, 8);
303
+ GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, iboId);
304
+
305
+ GLES20.glEnable(GLES20.GL_BLEND);
306
+ GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
307
+ GLES20.glDisable(GLES20.GL_DEPTH_TEST);
308
+
309
+ GLES20.glDrawElements(GLES20.GL_TRIANGLES, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);
310
+
311
+ GLES20.glDisableVertexAttribArray(aPosition);
312
+ GLES20.glDisableVertexAttribArray(aTexCoord);
313
+ GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
314
+ GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
315
+ }
316
+
317
+ @Override
318
+ public void deinitialize() {
319
+ if (program != 0) { GLES20.glDeleteProgram(program); program = 0; }
320
+ int[] texturesToDelete = {dataTextureId, colormapTextureId};
321
+ GLES20.glDeleteTextures(2, texturesToDelete, 0);
322
+ dataTextureId = 0; colormapTextureId = 0;
323
+ int[] buffersToDelete = {vboId, iboId};
324
+ GLES20.glDeleteBuffers(2, buffersToDelete, 0);
325
+ vboId = 0; iboId = 0;
326
+ }
327
+
328
+ @Override
329
+ public void contextLost() {
330
+ program = 0; dataTextureId = 0; colormapTextureId = 0; vboId = 0; iboId = 0;
331
+ }
332
+
333
+ public void setOpacity(float opacity) { this.opacity = opacity; }
334
+ public void setDataRange(float[] dataRange) { this.dataRange = dataRange; }
335
+ public void setConversionType(int type) { this.conversionType = type; }
336
+ public void setSmoothing(boolean enabled) {
337
+ if (this.smoothingEnabled != enabled) {
338
+ this.smoothingEnabled = enabled;
339
+ this.textureParametersDirty = true;
340
+ }
341
+ }
342
+
343
+ // Add this method to GridRenderLayer.java (around line 270)
344
+ public void updateDataParameters(float scale, float offset, float missing) {
345
+ synchronized (dataLock) {
346
+ this.scale = scale;
347
+ this.offset = offset;
348
+ this.missingQuantized = missing;
349
+ }
350
+ }
351
+
352
+ public void updateDataTexture(ByteBuffer dataBuffer, int nx, int ny, float scale, float offset, float missing, String scaleType) {
353
+ synchronized (dataLock) {
354
+ // Data is passed in already prepared as a DirectBuffer
355
+ this.pendingDataBuffer = dataBuffer;
356
+ this.pendingNx = nx;
357
+ this.pendingNy = ny;
358
+ this.pendingScale = scale;
359
+ this.pendingOffset = offset;
360
+ this.pendingMissing = missing;
361
+ this.pendingScaleType = "sqrt".equals(scaleType) ? 1 : 0;
362
+ }
363
+ this.isVisible = true;
364
+ }
365
+
366
+ public void updateColormapTexture(ByteBuffer data) {
367
+ synchronized (dataLock) { this.pendingColormapBuffer = data; }
368
+ }
369
+
370
+ private void generateLCCGeometry(ReadableMap gridDefMap, FloatBuffer vertices, ShortBuffer indices) {
371
+ ReadableMap gridParams = gridDefMap.getMap("grid_params");
372
+ ReadableMap projParams = gridDefMap.getMap("proj_params");
373
+
374
+ if (gridParams == null || projParams == null) {
375
+ Log.e(TAG, "Missing grid or projection parameters for LCC");
376
+ return;
377
+ }
378
+
379
+ int nx = gridParams.getInt("nx");
380
+ int ny = gridParams.getInt("ny");
381
+ double dx = getDouble(gridParams, "dx", 0);
382
+ double dy = getDouble(gridParams, "dy", 0);
383
+ double x_origin = getDouble(gridParams, "x_origin", 0);
384
+ double y_origin = getDouble(gridParams, "y_origin", 0);
385
+
386
+ int subdivisions = 60;
387
+ final double TILE_SIZE = 512.0;
388
+
389
+ double x_min = x_origin;
390
+ double y_max = y_origin;
391
+ double x_max = x_origin + (nx - 1) * dx;
392
+ double y_min = y_origin + (ny - 1) * dy;
393
+
394
+ // Store vertex info for index lookup when building triangles
395
+ // We only need the index and validity, not the coordinates again
396
+ short[][] indexGrid = new short[subdivisions + 1][subdivisions + 1];
397
+ boolean[][] validGrid = new boolean[subdivisions + 1][subdivisions + 1];
398
+
399
+ // Initialize all as invalid
400
+ for (int row = 0; row <= subdivisions; row++) {
401
+ for (int col = 0; col <= subdivisions; col++) {
402
+ validGrid[row][col] = false;
403
+ indexGrid[row][col] = -1;
404
+ }
405
+ }
406
+
407
+ for (int row = 0; row <= subdivisions; row++) {
408
+ for (int col = 0; col <= subdivisions; col++) {
409
+ double t_x = (double) col / subdivisions;
410
+ double t_y = (double) row / subdivisions;
411
+
412
+ double proj_x = x_min + t_x * (x_max - x_min);
413
+ double proj_y = y_max + t_y * (y_min - y_max);
414
+
415
+ double[] latLon = projectLCCToLatLon(proj_x, proj_y, projParams);
416
+
417
+ if (latLon == null) {
418
+ continue;
419
+ }
420
+
421
+ double lon = latLon[0];
422
+ double lat = latLon[1];
423
+
424
+ double mercX_normalized = (lon + 180.0) / 360.0;
425
+ double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, lat));
426
+ double sinLatitude = Math.sin(Math.toRadians(clampedLat));
427
+ double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
428
+
429
+ double mercX = mercX_normalized * TILE_SIZE;
430
+ double mercY = mercY_normalized * TILE_SIZE;
431
+
432
+ if (!Double.isFinite(mercX) || !Double.isFinite(mercY)) {
433
+ continue;
434
+ }
435
+
436
+ float tex_u = (float) t_x;
437
+ float tex_v = (float) t_y;
438
+
439
+ // Record index BEFORE writing the 4 floats
440
+ short vertexIndex = (short)(vertices.position() / 4);
441
+
442
+ vertices.put((float) mercX);
443
+ vertices.put((float) mercY);
444
+ vertices.put(tex_u);
445
+ vertices.put(tex_v);
446
+
447
+ indexGrid[row][col] = vertexIndex;
448
+ validGrid[row][col] = true;
449
+ }
450
+ }
451
+
452
+ if (vertices.position() == 0) {
453
+ Log.e(TAG, "No valid vertices generated for LCC grid");
454
+ return;
455
+ }
456
+
457
+ for (int row = 0; row < subdivisions; row++) {
458
+ for (int col = 0; col < subdivisions; col++) {
459
+ if (validGrid[row][col] &&
460
+ validGrid[row][col + 1] &&
461
+ validGrid[row + 1][col] &&
462
+ validGrid[row + 1][col + 1]) {
463
+
464
+ short topLeft = indexGrid[row][col];
465
+ short topRight = indexGrid[row][col + 1];
466
+ short bottomLeft = indexGrid[row + 1][col];
467
+ short bottomRight = indexGrid[row + 1][col + 1];
468
+
469
+ indices.put(topLeft);
470
+ indices.put(bottomLeft);
471
+ indices.put(topRight);
472
+
473
+ indices.put(topRight);
474
+ indices.put(bottomLeft);
475
+ indices.put(bottomRight);
476
+ }
477
+ }
478
+ }
479
+ }
480
+
481
+ private static class VertexInfo {
482
+ float mercX, mercY, texU, texV;
483
+ short index;
484
+ }
485
+
486
+ private double[] projectLCCToLatLon(double x, double y, ReadableMap projParams) {
487
+ try {
488
+ StringBuilder projString = new StringBuilder("+proj=lcc");
489
+
490
+ if (projParams.hasKey("lat_1")) projString.append(" +lat_1=").append(projParams.getDouble("lat_1"));
491
+ if (projParams.hasKey("lat_2")) projString.append(" +lat_2=").append(projParams.getDouble("lat_2"));
492
+ if (projParams.hasKey("lat_0")) projString.append(" +lat_0=").append(projParams.getDouble("lat_0"));
493
+ if (projParams.hasKey("lon_0")) projString.append(" +lon_0=").append(projParams.getDouble("lon_0"));
494
+ if (projParams.hasKey("x_0")) projString.append(" +x_0=").append(projParams.getDouble("x_0"));
495
+ if (projParams.hasKey("y_0")) projString.append(" +y_0=").append(projParams.getDouble("y_0"));
496
+ if (projParams.hasKey("ellps")) projString.append(" +ellps=").append(projParams.getString("ellps"));
497
+ if (projParams.hasKey("a")) projString.append(" +a=").append(projParams.getDouble("a"));
498
+ if (projParams.hasKey("b")) projString.append(" +b=").append(projParams.getDouble("b"));
499
+ projString.append(" +units=m +no_defs");
500
+
501
+ org.locationtech.proj4j.CRSFactory crsFactory = new org.locationtech.proj4j.CRSFactory();
502
+ org.locationtech.proj4j.CoordinateReferenceSystem srcCRS = crsFactory.createFromParameters("LCC", projString.toString());
503
+ org.locationtech.proj4j.CoordinateReferenceSystem dstCRS = crsFactory.createFromParameters("WGS84", "+proj=longlat +datum=WGS84 +no_defs");
504
+
505
+ org.locationtech.proj4j.CoordinateTransformFactory ctFactory = new org.locationtech.proj4j.CoordinateTransformFactory();
506
+ org.locationtech.proj4j.CoordinateTransform transform = ctFactory.createTransform(srcCRS, dstCRS);
507
+
508
+ org.locationtech.proj4j.ProjCoordinate srcCoord = new org.locationtech.proj4j.ProjCoordinate(x, y);
509
+ org.locationtech.proj4j.ProjCoordinate dstCoord = new org.locationtech.proj4j.ProjCoordinate();
510
+ transform.transform(srcCoord, dstCoord);
511
+
512
+ return new double[]{dstCoord.x, dstCoord.y};
513
+
514
+ } catch (Exception e) {
515
+ Log.e(TAG, "Error in LCC projection: " + e.getMessage());
516
+ return null;
517
+ }
518
+ }
519
+
520
+ private boolean isLCCType(ReadableMap gridDefMap) {
521
+ if (gridDefMap == null) return false;
522
+ ReadableMap projParams = gridDefMap.getMap("proj_params");
523
+ if (projParams == null) return false;
524
+ return projParams.hasKey("proj") && "lcc".equals(projParams.getString("proj"));
525
+ }
526
+
527
+ private int[] estimateBufferCounts(ReadableMap gridDefMap) {
528
+ // Returns [maxFloats, maxShorts]
529
+ ReadableMap gridParams = gridDefMap.getMap("grid_params");
530
+
531
+ if (isLCCType(gridDefMap)) {
532
+ int subdivisions = 60;
533
+ int maxVerts = (subdivisions + 1) * (subdivisions + 1);
534
+ int maxIdx = subdivisions * subdivisions * 6;
535
+ return new int[]{ maxVerts * 4, maxIdx };
536
+ }
537
+
538
+ if (gridParams != null && isGFSType(gridParams)) {
539
+ int subdivisions = 120;
540
+ int verticesPerRow = (subdivisions * 3) + 1;
541
+ int rows = subdivisions + 1;
542
+ int maxVerts = verticesPerRow * rows;
543
+ int maxIdx = subdivisions * (subdivisions * 3) * 6;
544
+ return new int[]{ maxVerts * 4, maxIdx };
545
+ }
546
+
547
+ // Regional grids: 3 world copies
548
+ int sx = 120, sy = 60;
549
+ int maxVerts = (sx + 1) * (sy + 1) * 3;
550
+ int maxIdx = sx * sy * 6 * 3;
551
+ return new int[]{ maxVerts * 4, maxIdx };
552
+ }
553
+
554
+ public void updateGeometry(ReadableMap cornersMap, ReadableMap gridDefMap) {
555
+ if (gridDefMap == null) return;
556
+
557
+ long tGeom0 = System.nanoTime();
558
+
559
+ // Pre-calculate buffer sizes to avoid ArrayList boxing entirely
560
+ int[] counts = estimateBufferCounts(gridDefMap);
561
+ int maxVertices = counts[0];
562
+ int maxIndices = counts[1];
563
+
564
+ FloatBuffer vb = ByteBuffer.allocateDirect(maxVertices * 4)
565
+ .order(ByteOrder.nativeOrder()).asFloatBuffer();
566
+ ShortBuffer ib = ByteBuffer.allocateDirect(maxIndices * 2)
567
+ .order(ByteOrder.nativeOrder()).asShortBuffer();
568
+
569
+ generateGeometryData(gridDefMap, vb, ib);
570
+
571
+ int vertexCount = vb.position();
572
+ int indexCount = ib.position();
573
+
574
+ long tGeom1 = System.nanoTime();
575
+ Log.d(TAG, "[Geometry] generateGeometryData: " + ((tGeom1 - tGeom0) / 1_000_000) + " ms | vertices=" + vertexCount + " indices=" + indexCount);
576
+
577
+ if (vertexCount == 0 || indexCount == 0) {
578
+ Log.e(TAG, "Generated geometry is empty, aborting GPU buffer update.");
579
+ return;
580
+ }
581
+
582
+ // Flip to position 0 for GPU upload
583
+ vb.position(0);
584
+ ib.position(0);
585
+
586
+ // Slice to actual size used
587
+ // (GPU upload uses capacity, so we wrap only what was written)
588
+ ByteBuffer vbBytes = ByteBuffer.allocateDirect(vertexCount * 4).order(ByteOrder.nativeOrder());
589
+ vb.limit(vertexCount);
590
+ vbBytes.asFloatBuffer().put(vb);
591
+ vbBytes.position(0);
592
+ FloatBuffer vbFinal = vbBytes.asFloatBuffer();
593
+
594
+ ByteBuffer ibBytes = ByteBuffer.allocateDirect(indexCount * 2).order(ByteOrder.nativeOrder());
595
+ ib.limit(indexCount);
596
+ ibBytes.asShortBuffer().put(ib);
597
+ ibBytes.position(0);
598
+ ShortBuffer ibFinal = ibBytes.asShortBuffer();
599
+
600
+ synchronized (dataLock) {
601
+ pendingVertexBuffer = vbFinal;
602
+ pendingIndexBuffer = ibFinal;
603
+ }
604
+
605
+ Log.d(TAG, "[Geometry] Buffer ready: VBO=" + (vertexCount * 4 / 1024) + "KB IBO=" + (indexCount * 2 / 1024) + "KB");
606
+ }
607
+
608
+ private boolean isGFSType(ReadableMap gridParams) {
609
+ if (gridParams == null) return false;
610
+ return getDouble(gridParams, "lon_first", -1) == 0.0 &&
611
+ Math.abs(getDouble(gridParams, "lat_first", -1)) == 90.0;
612
+ }
613
+
614
+ private boolean isECMWFType(ReadableMap gridParams) {
615
+ if (gridParams == null) return false;
616
+ return getDouble(gridParams, "lon_first", -1) == 180.0 &&
617
+ getDouble(gridParams, "lat_first", -1) == 90.0;
618
+ }
619
+
620
+ private void generateGeometryData(ReadableMap gridDefMap, FloatBuffer vertices, ShortBuffer indices) {
621
+ ReadableMap gridParams = gridDefMap.getMap("grid_params");
622
+ if (gridParams == null) {
623
+ Log.e(TAG, "❌ [Geometry] grid_params is null. Aborting mesh generation.");
624
+ return;
625
+ }
626
+
627
+ // --- Path 1: GFS ---
628
+ if (isGFSType(gridParams)) {
629
+ int subdivisions = 120;
630
+ int verticesPerRow = (subdivisions * 3) + 1;
631
+ final double TILE_SIZE = 512.0;
632
+
633
+ for (int row = 0; row <= subdivisions; row++) {
634
+ for (int col = 0; col <= subdivisions * 3; col++) {
635
+ float v_interp = (float) row / subdivisions;
636
+ float u_interp = (float) col / subdivisions;
637
+ double lon = -540.0 + u_interp * 1080.0;
638
+ double lat = -90.0 + v_interp * 180.0;
639
+ double mercX_normalized = (lon + 180.0) / 360.0;
640
+ double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, lat));
641
+ double sinLatitude = Math.sin(Math.toRadians(clampedLat));
642
+ double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
643
+ vertices.put((float)(mercX_normalized * TILE_SIZE));
644
+ vertices.put((float)(mercY_normalized * TILE_SIZE));
645
+ vertices.put((float)((lon + 180.0) / 360.0));
646
+ vertices.put(1.0f - v_interp);
647
+ }
648
+ }
649
+
650
+ for (short row = 0; row < subdivisions; row++) {
651
+ for (short col = 0; col < subdivisions * 3; col++) {
652
+ short tl = (short)(row * verticesPerRow + col);
653
+ short tr = (short)(tl + 1);
654
+ short bl = (short)((row + 1) * verticesPerRow + col);
655
+ short br = (short)(bl + 1);
656
+ indices.put(tl); indices.put(bl); indices.put(tr);
657
+ indices.put(tr); indices.put(bl); indices.put(br);
658
+ }
659
+ }
660
+ return;
661
+ }
662
+
663
+ // --- Path 2: LCC ---
664
+ if (isLCCType(gridDefMap)) {
665
+ generateLCCGeometry(gridDefMap, vertices, indices);
666
+ return;
667
+ }
668
+
669
+ // --- Path 3: Regional (ECMWF / NAM / HRRR etc.) ---
670
+ double lon_first = getDouble(gridParams, "lon_first", 0.0);
671
+ double lat_first = getDouble(gridParams, "lat_first", 90.0);
672
+ int nx = gridParams.getInt("nx");
673
+ int ny = gridParams.getInt("ny");
674
+ double dx = getDouble(gridParams, "dx_degrees", 0.0);
675
+ double dy = getDouble(gridParams, "dy_degrees", 0.0);
676
+ double lon_last = getDouble(gridParams, "lon_last", lon_first + (nx - 1) * dx);
677
+ double lat_last = getDouble(gridParams, "lat_last", lat_first + (ny - 1) * dy);
678
+ double lat_span = lat_last - lat_first;
679
+ boolean isSouthToNorth = lat_span > 0;
680
+ boolean isECMWF = isECMWFType(gridParams);
681
+
682
+ double data_lon_first_180 = isECMWF
683
+ ? (lon_first >= 180 ? lon_first - 360 : lon_first)
684
+ : (lon_first > 180 ? lon_first - 360 : lon_first);
685
+ double data_lon_last_180 = isECMWF
686
+ ? (lon_last >= 180 ? lon_last - 360 : lon_last)
687
+ : (lon_last > 180 ? lon_last - 360 : lon_last);
688
+ double data_lon_range = data_lon_last_180 - data_lon_first_180;
689
+
690
+ int subdivisions_x = 120;
691
+ int subdivisions_y = 60;
692
+ int verticesPerRow = subdivisions_x + 1;
693
+ final double TILE_SIZE = 512.0;
694
+
695
+ for (int world_copy = -1; world_copy <= 1; world_copy++) {
696
+ short vertexStartIndex = (short)(vertices.position() / 4);
697
+ double lon_offset = world_copy * 360.0;
698
+
699
+ for (int row = 0; row <= subdivisions_y; row++) {
700
+ for (int col = 0; col <= subdivisions_x; col++) {
701
+ float v_interp = (float) row / subdivisions_y;
702
+ float u_interp = (float) col / subdivisions_x;
703
+ double vertex_lon = data_lon_first_180 + (u_interp * data_lon_range);
704
+ double vertex_lat = lat_first + (v_interp * lat_span);
705
+ double mercX_normalized = ((vertex_lon + lon_offset) + 180.0) / 360.0;
706
+ double clampedLat = Math.max(-85.05112878, Math.min(85.05112878, vertex_lat));
707
+ double sinLatitude = Math.sin(Math.toRadians(clampedLat));
708
+ double mercY_normalized = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);
709
+ vertices.put((float)(mercX_normalized * TILE_SIZE));
710
+ vertices.put((float)(mercY_normalized * TILE_SIZE));
711
+ vertices.put(u_interp);
712
+ vertices.put(isSouthToNorth ? (1.0f - v_interp) : v_interp);
713
+ }
714
+ }
715
+
716
+ for (short row = 0; row < subdivisions_y; row++) {
717
+ for (short col = 0; col < subdivisions_x; col++) {
718
+ short tl = (short)(vertexStartIndex + row * verticesPerRow + col);
719
+ short tr = (short)(tl + 1);
720
+ short bl = (short)(vertexStartIndex + (row + 1) * verticesPerRow + col);
721
+ short br = (short)(bl + 1);
722
+ if (isSouthToNorth) {
723
+ indices.put(tl); indices.put(bl); indices.put(tr);
724
+ indices.put(tr); indices.put(bl); indices.put(br);
725
+ } else {
726
+ indices.put(tl); indices.put(tr); indices.put(bl);
727
+ indices.put(bl); indices.put(tr); indices.put(br);
728
+ }
729
+ }
730
+ }
731
+ }
732
+ }
689
733
  }