react-native-cesium 1.2.13 → 1.2.14
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.
|
@@ -147,7 +147,17 @@ void CameraIntegrator::extrapolate(
|
|
|
147
147
|
if (maxRateAbs > 0.0) {
|
|
148
148
|
s.velocity = clampAbs(s.velocity, maxRateAbs);
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
|
|
151
|
+
// While measurements are still arriving (gesture / sensor stream), advance
|
|
152
|
+
// along the learned velocity for smooth inter-frame motion. Once they stop
|
|
153
|
+
// (fling decay finished, finger lifted), do not coast on that velocity —
|
|
154
|
+
// only demand-pull toward the last set value. Coasting past demand is what
|
|
155
|
+
// users perceive as the camera "springing back" after a fling.
|
|
156
|
+
const bool measurementsStopped =
|
|
157
|
+
silence > grace && s.tLastMeas.time_since_epoch().count() > 0;
|
|
158
|
+
if (!measurementsStopped) {
|
|
159
|
+
s.value += s.velocity * dt;
|
|
160
|
+
}
|
|
151
161
|
s.tState = now;
|
|
152
162
|
|
|
153
163
|
// Demand pull — guarantees convergence to the last demanded value for
|
|
@@ -155,7 +165,7 @@ void CameraIntegrator::extrapolate(
|
|
|
155
165
|
// when measurements have stopped (silence > grace); continuous gesture or
|
|
156
166
|
// sensor streams always deliver a new update before the grace window
|
|
157
167
|
// expires, so this term is never active for them.
|
|
158
|
-
if (
|
|
168
|
+
if (measurementsStopped && tunables::kDemandPullTauSec > 1.0e-6) {
|
|
159
169
|
s.value += (1.0 - std::exp(-dt / tunables::kDemandPullTauSec))
|
|
160
170
|
* (demand - s.value);
|
|
161
171
|
}
|
|
@@ -193,8 +203,20 @@ void CameraIntegrator::setAltitude(double altitudeMeters) {
|
|
|
193
203
|
}
|
|
194
204
|
|
|
195
205
|
altitudeMeters = std::min(altitudeMeters, kMaxAltMeters);
|
|
206
|
+
|
|
207
|
+
// Adaptive alpha based on altitude error magnitude:
|
|
208
|
+
// - Large changes (pinch gesture, cliffs) → fast (α ≈ 0.7)
|
|
209
|
+
// - Small changes (gentle terrain) → smooth (α ≈ 0.3)
|
|
210
|
+
const double error = std::abs(altitudeMeters - alt_.value);
|
|
211
|
+
constexpr double kMinAlpha = 0.3; // Smooth for small changes
|
|
212
|
+
constexpr double kMaxAlpha = 0.7; // Fast for large changes
|
|
213
|
+
constexpr double kErrorScale = 20.0; // 20m error → max alpha
|
|
214
|
+
|
|
215
|
+
const double adaptiveAlpha = kMinAlpha + (kMaxAlpha - kMinAlpha) *
|
|
216
|
+
std::min(error / kErrorScale, 1.0);
|
|
217
|
+
|
|
196
218
|
updateAlphaBeta(alt_, altitudeMeters, now,
|
|
197
|
-
|
|
219
|
+
adaptiveAlpha, tunables::kBetaAlt, false);
|
|
198
220
|
demand_.altitude = altitudeMeters;
|
|
199
221
|
}
|
|
200
222
|
|
package/ios/CesiumBridge.mm
CHANGED
|
@@ -383,9 +383,10 @@
|
|
|
383
383
|
// `nowSeconds` is still used below for the FPS-EMA dt only.
|
|
384
384
|
auto actual = _integrator->step();
|
|
385
385
|
|
|
386
|
-
// ── Terrain floor
|
|
387
|
-
//
|
|
388
|
-
//
|
|
386
|
+
// ── Terrain floor following using integrator's alpha-beta smoothing ───
|
|
387
|
+
// Set demand altitude to terrain floor, let the integrator's alpha-beta
|
|
388
|
+
// tracker smoothly interpolate. The tracker already provides adaptive
|
|
389
|
+
// exponential easing (alpha=0.6, beta=0.05 in EngineTunables.hpp).
|
|
389
390
|
const float minAbove = _engine->getConfig().minAltitudeAboveTerrain;
|
|
390
391
|
if (minAbove > 0.0f && _engine->terrainFloorKnown()) {
|
|
391
392
|
const double geoidN =
|
|
@@ -394,9 +395,17 @@
|
|
|
394
395
|
const double floorMsl = floorEllipsoid - geoidN;
|
|
395
396
|
const double minMsl = floorMsl + static_cast<double>(minAbove);
|
|
396
397
|
|
|
397
|
-
//
|
|
398
|
+
// Continuously update demand to follow terrain
|
|
399
|
+
const double demandAlt = _integrator->getDemand().altitude;
|
|
400
|
+
if (demandAlt <= 0.0) {
|
|
401
|
+
_integrator->setAltitude(minMsl);
|
|
402
|
+
actual = _integrator->getActual();
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Safety floor: hard clamp if already below terrain (shouldn't happen with look-ahead)
|
|
398
406
|
if (actual.altitude < minMsl) {
|
|
399
|
-
|
|
407
|
+
_integrator->clampActualAltitude(minMsl);
|
|
408
|
+
actual = _integrator->getActual();
|
|
400
409
|
}
|
|
401
410
|
}
|
|
402
411
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-cesium",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.14",
|
|
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",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"node": ">=18"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"react-native-nitro-modules": "^0.35.
|
|
67
|
+
"react-native-nitro-modules": "^0.35.9"
|
|
68
68
|
},
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"@types/jest": "^29.5.14",
|
|
78
78
|
"@types/react": "19.2.14",
|
|
79
79
|
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
80
|
-
"nitrogen": "0.35.
|
|
80
|
+
"nitrogen": "0.35.9",
|
|
81
81
|
"react": "19.2.3",
|
|
82
82
|
"react-native": "0.85.3",
|
|
83
83
|
"react-native-builder-bob": "^0.41.0",
|