react-native-cesium 1.2.18 → 1.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +11 -8
  2. package/android/CMakeLists.txt +1 -0
  3. package/android/build.gradle +1 -1
  4. package/android/gradle.properties +4 -4
  5. package/android/src/main/cpp/CesiumBridgeAndroid.cpp +44 -18
  6. package/android/src/main/cpp/CesiumBridgeAndroid.h +9 -0
  7. package/android/src/main/java/com/margelo/nitro/reactnativecesium/CesiumBridgeJNI.kt +3 -0
  8. package/android/src/main/java/com/margelo/nitro/reactnativecesium/HybridCesiumView.kt +9 -0
  9. package/cpp/engine/CameraIntegrator.cpp +82 -47
  10. package/cpp/engine/CameraIntegrator.hpp +27 -8
  11. package/cpp/engine/CesiumEngine.cpp +183 -312
  12. package/cpp/engine/CesiumEngine.hpp +41 -28
  13. package/cpp/engine/EngineTunables.hpp +6 -5
  14. package/cpp/engine/GeoidConverter.cpp +32 -11
  15. package/cpp/engine/GeoidConverter.hpp +41 -0
  16. package/cpp/engine/GltfToMesh.cpp +14 -5
  17. package/cpp/engine/ResourcePreparer.cpp +3 -3
  18. package/cpp/engine/ResourcePreparer.hpp +1 -1
  19. package/cpp/engine/TerrainFloor.hpp +70 -0
  20. package/cpp/engine/TerrainHeight.hpp +113 -0
  21. package/cpp/engine/test/CameraIntegratorTest.cpp +264 -0
  22. package/cpp/engine/test/GeoidConverterTest.cpp +77 -0
  23. package/cpp/engine/test/build_and_run.sh +20 -6
  24. package/ios/CesiumBridge.h +5 -0
  25. package/ios/CesiumBridge.mm +61 -32
  26. package/ios/HybridCesiumView.swift +11 -0
  27. package/lib/typescript/src/specs/cesium-view.nitro.d.ts +34 -9
  28. package/lib/typescript/src/specs/cesium-view.nitro.d.ts.map +1 -1
  29. package/nitrogen/generated/android/c++/JCameraState.hpp +1 -1
  30. package/nitrogen/generated/android/c++/JCesiumMetrics.hpp +1 -1
  31. package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.cpp +9 -0
  32. package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.hpp +2 -0
  33. package/nitrogen/generated/android/c++/JQuaternion.hpp +1 -1
  34. package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.cpp +182 -131
  35. package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.hpp +6 -1
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CameraState.kt +1 -1
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CesiumMetrics.kt +1 -1
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/Func_void_CameraState.kt +0 -2
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/Func_void_CesiumMetrics.kt +0 -2
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/HybridCesiumViewSpec.kt +8 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/Quaternion.kt +1 -1
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewManager.kt +26 -10
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewStateUpdater.kt +2 -2
  44. package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.hpp +15 -0
  45. package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.hpp +7 -0
  46. package/nitrogen/generated/ios/c++/views/HybridCesiumViewComponent.mm +217 -161
  47. package/nitrogen/generated/ios/swift/HybridCesiumViewSpec.swift +1 -0
  48. package/nitrogen/generated/ios/swift/HybridCesiumViewSpec_cxx.swift +24 -0
  49. package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.cpp +2 -0
  50. package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.hpp +2 -0
  51. package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.cpp +36 -335
  52. package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.hpp +110 -77
  53. package/nitrogen/generated/shared/json/CesiumViewConfig.json +1 -0
  54. package/package.json +12 -12
  55. package/scripts/cesium/config.mjs +1 -1
  56. package/scripts/cesium/vcpkg-triplets/arm64-ios-simulator.cmake +3 -0
  57. package/scripts/cesium/vcpkg-triplets/arm64-ios.cmake +4 -0
  58. package/src/specs/cesium-view.nitro.ts +34 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-cesium",
3
- "version": "1.2.18",
3
+ "version": "1.2.20",
4
4
  "description": "Experimental Cesium rendering for React Native via Nitro",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -65,7 +65,7 @@
65
65
  "node": ">=18"
66
66
  },
67
67
  "dependencies": {
68
- "react-native-nitro-modules": "^0.35.9"
68
+ "react-native-nitro-modules": "^0.37.1"
69
69
  },
70
70
  "publishConfig": {
71
71
  "access": "public",
@@ -73,17 +73,17 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
76
- "@semantic-release/changelog": "^6.0.3",
77
- "@semantic-release/git": "^10.0.1",
76
+ "@semantic-release/changelog": "^7.0.0",
77
+ "@semantic-release/git": "^11.0.1",
78
78
  "@types/jest": "^29.5.14",
79
- "@types/react": "19.2.17",
80
- "conventional-changelog-conventionalcommits": "^9.3.1",
81
- "nitrogen": "0.35.9",
82
- "react": "19.2.3",
83
- "react-native": "0.86.0",
84
- "react-native-builder-bob": "^0.43.0",
85
- "semantic-release": "^25.0.5",
86
- "typescript": "^5.9.3"
79
+ "@types/react": "^19.3.0",
80
+ "conventional-changelog-conventionalcommits": "^10.4.1",
81
+ "nitrogen": "^0.37.1",
82
+ "react": "^19.3.0",
83
+ "react-native": "^0.87.1",
84
+ "react-native-builder-bob": "^0.43.2",
85
+ "semantic-release": "^25.0.9",
86
+ "typescript": "^6.0.3"
87
87
  },
88
88
  "peerDependencies": {
89
89
  "react": ">=18.0.0",
@@ -5,4 +5,4 @@
5
5
  */
6
6
 
7
7
  /** Git tag of CesiumGS/cesium-native to clone and build. */
8
- export const CESIUM_NATIVE_REF = 'v0.61.0'
8
+ export const CESIUM_NATIVE_REF = 'v0.65.0'
@@ -7,4 +7,7 @@ set(VCPKG_CRT_LINKAGE dynamic)
7
7
  set(VCPKG_LIBRARY_LINKAGE static)
8
8
  set(VCPKG_CMAKE_SYSTEM_NAME iOS)
9
9
  set(VCPKG_OSX_SYSROOT iphonesimulator)
10
+ # Same iOS 15.1 floor as arm64-ios: Xcode 27 libc++ rejects older deployment
11
+ # targets under -Werror (ktx/astc-encoder).
12
+ set(VCPKG_OSX_DEPLOYMENT_TARGET 15.1)
10
13
  set(VCPKG_CMAKE_CONFIGURE_OPTIONS "-DHAVE_PIPE2=OFF;-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY")
@@ -11,4 +11,8 @@ set(VCPKG_CMAKE_SYSTEM_NAME iOS)
11
11
  # CMake defaults CMAKE_OSX_SYSROOT to the host MacOSX SDK and Clang builds with an invalid
12
12
  # --target=…-macabi mix (breaks ktx/astc-encoder on newer Xcode).
13
13
  set(VCPKG_OSX_SYSROOT iphoneos)
14
+ # Xcode 27 libc++ warns (and ktx/astc-encoder builds with -Werror) when the
15
+ # deployment target is below iOS 15. CMake's iOS default is 12.0. Match the
16
+ # Cesium Native iOS build (CMAKE_OSX_DEPLOYMENT_TARGET=15.1).
17
+ set(VCPKG_OSX_DEPLOYMENT_TARGET 15.1)
14
18
  set(VCPKG_CMAKE_CONFIGURE_OPTIONS "-DHAVE_PIPE2=OFF;-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY")
@@ -11,6 +11,11 @@ import type {
11
11
  export interface CameraState {
12
12
  latitude: number
13
13
  longitude: number
14
+ /**
15
+ * Metres. Mean sea level unless `altitudeDatum` is `"ellipsoid"`, in which
16
+ * case this is WGS84 ellipsoidal height. `getActualCamera`,
17
+ * `getDemandCamera`, and `onActualCamera` report altitude in that same unit.
18
+ */
14
19
  altitude: number
15
20
  heading: number
16
21
  pitch: number
@@ -59,6 +64,16 @@ export interface CesiumViewProps extends HybridViewProps {
59
64
  /** 1 = off; 2 or 4 = MSAA when supported. */
60
65
  msaaSampleCount: number
61
66
  ionImageryAssetId: number
67
+ /**
68
+ * Vertical datum of public altitude numbers, in both directions.
69
+ * `"msl"` (default) is metres above mean sea level.
70
+ * `"ellipsoid"` is WGS84 ellipsoidal height (Android `Location.getAltitude`).
71
+ * Ellipsoidal heights are converted to mean sea level with EGM96 before the
72
+ * camera integrator, and converted back on read. Switching this prop does
73
+ * not move the camera: later reads use the new unit, and the next
74
+ * `setAltitude`, `setPosition`, or `teleport` is interpreted in that unit.
75
+ */
76
+ altitudeDatum?: string
62
77
 
63
78
  // ── Optional perf / quality knobs ────────────────────────────────────────
64
79
  // Note: all optional props below use "set once" semantics. Once a value has
@@ -98,12 +113,13 @@ export interface CesiumViewProps extends HybridViewProps {
98
113
  */
99
114
  taskProcessorThreads?: number
100
115
  /**
101
- * Minimum clearance above the loaded terrain surface, in metres (added on top of the
102
- * terrain MSL height at the camera position). Default 0 (no constraint).
103
- * Set to e.g. 2 to prevent the camera from going underground.
104
- * The clamp runs only after terrain tiles have been sampled; until then the demand
105
- * altitude is used as-is. The demand altitude is not modified — only the rendered
106
- * (actual) camera may be raised to meet this minimum.
116
+ * Clearance above the rendered terrain surface, in metres, added on top of the
117
+ * terrain height at the camera position. The floor is always on. 0 means the
118
+ * camera may sit on the surface and may not go below it.
119
+ * Until a terrain tile has been sampled, the camera is held at or above the
120
+ * WGS84 ellipsoid. The demand altitude is not modified — only the rendered
121
+ * (actual) camera is held to this minimum, and it follows the surface down
122
+ * when the demand is at or below the floor.
107
123
  */
108
124
  minAltitudeAboveTerrain?: number
109
125
 
@@ -156,10 +172,18 @@ export interface CesiumViewMethods extends HybridViewMethods {
156
172
  * for GPS or scripted position updates. Latitude is clamped to ±90 by the
157
173
  * integrator; longitude is continuous (no wrap normalisation) so the
158
174
  * shortest-arc residual maths stays correct across the antimeridian.
175
+ * When `altitudeDatum` is `"ellipsoid"`, a horizontal move keeps the
176
+ * demanded ellipsoidal height and recomputes mean sea level at the new
177
+ * point. Mean-sea-level mode leaves altitude unchanged.
159
178
  */
160
179
  setPosition(latitude: number, longitude: number): void
161
180
 
162
- /** New altitude demand (metres above mean sea level). */
181
+ /**
182
+ * New altitude demand, in metres. Interpreted as mean sea level unless
183
+ * `altitudeDatum` is `"ellipsoid"`, in which case it is WGS84 height and
184
+ * converted to MSL before the integrator. A later read reports the same
185
+ * sample back in this unit.
186
+ */
163
187
  setAltitude(altitudeMeters: number): void
164
188
 
165
189
  /** New heading demand (degrees, 0 = north, increasing clockwise). */
@@ -194,14 +218,15 @@ export interface CesiumViewMethods extends HybridViewMethods {
194
218
  * Most recent camera that was rendered (post-integration). This is what
195
219
  * the user is currently looking at and is what a HUD overlay should
196
220
  * mirror. Differs from `getDemandCamera()` while a glide is in progress
197
- * or when the terrain-floor clamp has raised the altitude.
221
+ * or when the terrain-floor clamp has raised the altitude. Altitude is in
222
+ * the unit selected by `altitudeDatum`.
198
223
  */
199
224
  getActualCamera(): Promise<CameraState>
200
225
 
201
226
  /**
202
227
  * What the consumer last asked for (per-DoF demand). Useful for
203
228
  * diagnostics or for showing the requested camera alongside the rendered
204
- * one.
229
+ * one. Altitude is in the unit selected by `altitudeDatum`.
205
230
  */
206
231
  getDemandCamera(): Promise<CameraState>
207
232