react-native-cesium 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +12 -0
- package/README.md +308 -0
- package/ReactNativeCesium.podspec +54 -0
- package/android/CMakeLists.txt +146 -0
- package/android/build.gradle +178 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/assets/cacert.pem +3529 -0
- package/android/src/main/cpp/CesiumBridgeAndroid.cpp +487 -0
- package/android/src/main/cpp/CesiumBridgeAndroid.h +94 -0
- package/android/src/main/cpp/cpp-adapter.cpp +17 -0
- package/android/src/main/cpp/vulkan/VulkanBackend.cpp +1781 -0
- package/android/src/main/cpp/vulkan/VulkanBackend.h +190 -0
- package/android/src/main/cpp/vulkan/shaders/sky.frag +86 -0
- package/android/src/main/cpp/vulkan/shaders/sky.vert +9 -0
- package/android/src/main/cpp/vulkan/shaders/terrain.frag +144 -0
- package/android/src/main/cpp/vulkan/shaders/terrain.vert +25 -0
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/CesiumBridgeJNI.kt +84 -0
- package/android/src/main/java/com/margelo/nitro/reactnativecesium/HybridCesiumView.kt +225 -0
- package/android/src/main/java/com/reactnativecesium/ReactNativeCesiumPackage.kt +28 -0
- package/cpp/engine/CesiumEngine.cpp +413 -0
- package/cpp/engine/CesiumEngine.hpp +90 -0
- package/cpp/engine/DeletionQueue.cpp +28 -0
- package/cpp/engine/DeletionQueue.hpp +28 -0
- package/cpp/engine/GlobeCamera.cpp +181 -0
- package/cpp/engine/GlobeCamera.hpp +64 -0
- package/cpp/engine/GltfToMesh.cpp +154 -0
- package/cpp/engine/GltfToMesh.hpp +20 -0
- package/cpp/engine/ResourcePreparer.cpp +224 -0
- package/cpp/engine/ResourcePreparer.hpp +96 -0
- package/cpp/engine/TaskProcessor.cpp +61 -0
- package/cpp/engine/TaskProcessor.hpp +43 -0
- package/cpp/engine/TileLifecycleManager.cpp +30 -0
- package/cpp/engine/TileLifecycleManager.hpp +25 -0
- package/cpp/fmt/format.h +9 -0
- package/cpp/renderer/IGPUBackend.hpp +22 -0
- package/cpp/renderer/RenderTypes.hpp +112 -0
- package/cpp/renderer/ShaderTypes.hpp +29 -0
- package/example/README.md +43 -0
- package/example/react-native-cesium-example.jpg +0 -0
- package/ios/CesiumBridge.h +55 -0
- package/ios/CesiumBridge.mm +393 -0
- package/ios/HybridCesiumView.swift +299 -0
- package/ios/ReactNativeCesium-umbrella.h +16 -0
- package/ios/metal/MetalBackend.h +82 -0
- package/ios/metal/MetalBackend.mm +839 -0
- package/ios/react_native_cesium_ensure_native.rb +12 -0
- package/ios/react_native_cesium_post_install.rb +30 -0
- package/lib/commonjs/CesiumView.js +13 -0
- package/lib/commonjs/CesiumView.js.map +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/cesium-view.nitro.js +6 -0
- package/lib/commonjs/specs/cesium-view.nitro.js.map +1 -0
- package/lib/module/CesiumView.js +9 -0
- package/lib/module/CesiumView.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/cesium-view.nitro.js +4 -0
- package/lib/module/specs/cesium-view.nitro.js.map +1 -0
- package/lib/typescript/src/CesiumView.d.ts +5 -0
- package/lib/typescript/src/CesiumView.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts +43 -0
- package/lib/typescript/src/specs/cesium-view.nitro.d.ts.map +1 -0
- package/nitro.json +30 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/ReactNativeCesium+autolinking.cmake +83 -0
- package/nitrogen/generated/android/ReactNativeCesium+autolinking.gradle +27 -0
- package/nitrogen/generated/android/ReactNativeCesiumOnLoad.cpp +58 -0
- package/nitrogen/generated/android/ReactNativeCesiumOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JCameraState.hpp +81 -0
- package/nitrogen/generated/android/c++/JCesiumMetrics.hpp +81 -0
- package/nitrogen/generated/android/c++/JFunc_void_CesiumMetrics.hpp +78 -0
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.cpp +178 -0
- package/nitrogen/generated/android/c++/JHybridCesiumViewSpec.hpp +83 -0
- package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.cpp +92 -0
- package/nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CameraState.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/CesiumMetrics.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/Func_void_CesiumMetrics.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/HybridCesiumViewSpec.kt +126 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/ReactNativeCesiumOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewManager.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/reactnativecesium/views/HybridCesiumViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/ReactNativeCesium+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.cpp +57 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Bridge.hpp +164 -0
- package/nitrogen/generated/ios/ReactNativeCesium-Swift-Cxx-Umbrella.hpp +53 -0
- package/nitrogen/generated/ios/ReactNativeCesiumAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ReactNativeCesiumAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCesiumViewSpecSwift.hpp +157 -0
- package/nitrogen/generated/ios/c++/views/HybridCesiumViewComponent.mm +167 -0
- package/nitrogen/generated/ios/swift/CameraState.swift +59 -0
- package/nitrogen/generated/ios/swift/CesiumMetrics.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_CameraState.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CesiumMetrics.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCesiumViewSpec_cxx.swift +306 -0
- package/nitrogen/generated/shared/c++/CameraState.hpp +107 -0
- package/nitrogen/generated/shared/c++/CesiumMetrics.hpp +107 -0
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.cpp +42 -0
- package/nitrogen/generated/shared/c++/HybridCesiumViewSpec.hpp +90 -0
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.cpp +182 -0
- package/nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.hpp +122 -0
- package/nitrogen/generated/shared/json/CesiumViewConfig.json +19 -0
- package/package.json +140 -0
- package/react-native.config.js +16 -0
- package/scripts/cesium/build.mjs +901 -0
- package/scripts/cesium/clean.mjs +35 -0
- package/scripts/cesium/clone.mjs +32 -0
- package/scripts/cesium/ensure-native.mjs +116 -0
- package/scripts/cesium/vcpkg-ports/zstd/fix-emscripten-and-clang-cl.patch +31 -0
- package/scripts/cesium/vcpkg-ports/zstd/fix-windows-rc-compile.patch +13 -0
- package/scripts/cesium/vcpkg-ports/zstd/no-static-suffix.patch +13 -0
- package/scripts/cesium/vcpkg-ports/zstd/portfile.cmake +77 -0
- package/scripts/cesium/vcpkg-ports/zstd/usage +4 -0
- package/scripts/cesium/vcpkg-ports/zstd/vcpkg.json +23 -0
- package/scripts/cesium/vcpkg-triplets/arm64-ios-simulator.cmake +10 -0
- package/scripts/cesium/vcpkg-triplets/arm64-ios.cmake +14 -0
- package/src/CesiumView.tsx +13 -0
- package/src/index.ts +7 -0
- package/src/specs/cesium-view.nitro.ts +51 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Call from your app Podfile inside `pre_install` (see package README). Runs
|
|
2
|
+
# scripts/cesium/ensure-native.mjs --ios so Cesium Native is cloned/built when
|
|
3
|
+
# vendor/ios/CesiumNative.xcframework is missing.
|
|
4
|
+
def react_native_cesium_ensure_native
|
|
5
|
+
package_root = File.expand_path("..", __dir__)
|
|
6
|
+
script = File.join(package_root, "scripts", "cesium", "ensure-native.mjs")
|
|
7
|
+
unless File.exist?(script)
|
|
8
|
+
raise "react-native-cesium: expected #{script}"
|
|
9
|
+
end
|
|
10
|
+
ok = system("node", script, "--ios")
|
|
11
|
+
raise "react-native-cesium: ensure-native failed (see package README)" unless ok
|
|
12
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Prepend this package's cpp/ to HEADER_SEARCH_PATHS for ReactNativeCesium so
|
|
2
|
+
# cpp/fmt/format.h shadows CesiumNative.xcframework's fmt before <fmt/format.h>.
|
|
3
|
+
#
|
|
4
|
+
# CesiumNative.xcframework simulator slice is arm64-only; exclude x86_64 so
|
|
5
|
+
# generic "iOS Simulator" builds link (Apple Silicon). Intel Mac simulators
|
|
6
|
+
# need an xcframework that includes x86_64.
|
|
7
|
+
def react_native_cesium_post_install(installer)
|
|
8
|
+
cpp_root = File.expand_path("../cpp", __dir__)
|
|
9
|
+
sim_arch_key = "EXCLUDED_ARCHS[sdk=iphonesimulator*]"
|
|
10
|
+
|
|
11
|
+
installer.pods_project.targets.each do |target|
|
|
12
|
+
next unless target.name == "ReactNativeCesium"
|
|
13
|
+
|
|
14
|
+
target.build_configurations.each do |config|
|
|
15
|
+
existing = config.build_settings["HEADER_SEARCH_PATHS"] || "$(inherited)"
|
|
16
|
+
config.build_settings["HEADER_SEARCH_PATHS"] = "\"#{cpp_root}\" #{existing}"
|
|
17
|
+
config.build_settings[sim_arch_key] = "x86_64"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
installer.aggregate_targets.each do |aggregate_target|
|
|
22
|
+
aggregate_target.user_project.native_targets.each do |native_target|
|
|
23
|
+
native_target.build_configurations.each do |config|
|
|
24
|
+
cur = config.build_settings[sim_arch_key].to_s.strip
|
|
25
|
+
config.build_settings[sim_arch_key] =
|
|
26
|
+
cur.empty? ? "x86_64" : "#{cur} x86_64".split.uniq.join(" ")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CesiumView = void 0;
|
|
7
|
+
var _reactNativeNitroModules = require("react-native-nitro-modules");
|
|
8
|
+
var _CesiumViewConfig = _interopRequireDefault(require("../nitrogen/generated/shared/json/CesiumViewConfig.json"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/** For `hybridRef`, use `callback(...)` from `react-native-nitro-modules` or a ref object —
|
|
11
|
+
* unwrapped functions are turned into booleans by RN and never reach native. */
|
|
12
|
+
const CesiumView = exports.CesiumView = (0, _reactNativeNitroModules.getHostComponent)('CesiumView', () => _CesiumViewConfig.default);
|
|
13
|
+
//# sourceMappingURL=CesiumView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNativeNitroModules","require","_CesiumViewConfig","_interopRequireDefault","e","__esModule","default","CesiumView","exports","getHostComponent","CesiumViewConfig"],"sourceRoot":"../../src","sources":["CesiumView.tsx"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAsF,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtF;AACA;AACO,MAAMG,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG,IAAAE,yCAAgB,EACxC,YAAY,EACZ,MAAMC,yBACR,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "CesiumView", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CesiumView.CesiumView;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CesiumView = require("./CesiumView");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_CesiumView","require"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/cesium-view.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getHostComponent } from 'react-native-nitro-modules';
|
|
4
|
+
import CesiumViewConfig from '../nitrogen/generated/shared/json/CesiumViewConfig.json';
|
|
5
|
+
|
|
6
|
+
/** For `hybridRef`, use `callback(...)` from `react-native-nitro-modules` or a ref object —
|
|
7
|
+
* unwrapped functions are turned into booleans by RN and never reach native. */
|
|
8
|
+
export const CesiumView = getHostComponent('CesiumView', () => CesiumViewConfig);
|
|
9
|
+
//# sourceMappingURL=CesiumView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getHostComponent","CesiumViewConfig","CesiumView"],"sourceRoot":"../../src","sources":["CesiumView.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,4BAA4B;AAK7D,OAAOC,gBAAgB,MAAM,yDAAyD;;AAEtF;AACA;AACA,OAAO,MAAMC,UAAU,GAAGF,gBAAgB,CACxC,YAAY,EACZ,MAAMC,gBACR,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CesiumView"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["specs/cesium-view.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CesiumViewProps, CesiumViewMethods } from './specs/cesium-view.nitro';
|
|
2
|
+
/** For `hybridRef`, use `callback(...)` from `react-native-nitro-modules` or a ref object —
|
|
3
|
+
* unwrapped functions are turned into booleans by RN and never reach native. */
|
|
4
|
+
export declare const CesiumView: import("react-native-nitro-modules").ReactNativeView<CesiumViewProps, CesiumViewMethods>;
|
|
5
|
+
//# sourceMappingURL=CesiumView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CesiumView.d.ts","sourceRoot":"","sources":["../../../src/CesiumView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAGlC;iFACiF;AACjF,eAAO,MAAM,UAAU,0FAGtB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EACV,WAAW,EACX,aAAa,EACb,eAAe,EACf,iBAAiB,GAClB,MAAM,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { HybridView, HybridViewProps, HybridViewMethods } from 'react-native-nitro-modules';
|
|
2
|
+
/** Snapshot of the native camera for persistence / sync with React state. */
|
|
3
|
+
export interface CameraState {
|
|
4
|
+
latitude: number;
|
|
5
|
+
longitude: number;
|
|
6
|
+
altitude: number;
|
|
7
|
+
heading: number;
|
|
8
|
+
pitch: number;
|
|
9
|
+
roll: number;
|
|
10
|
+
verticalFovDeg: number;
|
|
11
|
+
}
|
|
12
|
+
/** Throttled telemetry for dashboards (see `onMetrics` prop). */
|
|
13
|
+
export interface CesiumMetrics {
|
|
14
|
+
fps: number;
|
|
15
|
+
tilesRendered: number;
|
|
16
|
+
tilesLoading: number;
|
|
17
|
+
tilesVisited: number;
|
|
18
|
+
ionTokenConfigured: boolean;
|
|
19
|
+
tilesetReady: boolean;
|
|
20
|
+
creditsPlainText: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CesiumViewProps extends HybridViewProps {
|
|
23
|
+
ionAccessToken: string;
|
|
24
|
+
ionAssetId: number;
|
|
25
|
+
/** Construction-time seed camera. Use `setCamera()` for runtime updates. */
|
|
26
|
+
initialCamera: CameraState;
|
|
27
|
+
pauseRendering: boolean;
|
|
28
|
+
maximumScreenSpaceError: number;
|
|
29
|
+
maximumSimultaneousTileLoads: number;
|
|
30
|
+
loadingDescendantLimit: number;
|
|
31
|
+
/** 1 = off; 2 or 4 = MSAA when supported. */
|
|
32
|
+
msaaSampleCount: number;
|
|
33
|
+
ionImageryAssetId: number;
|
|
34
|
+
onMetrics?: (metrics: CesiumMetrics) => void;
|
|
35
|
+
}
|
|
36
|
+
export interface CesiumViewMethods extends HybridViewMethods {
|
|
37
|
+
/** Returns the current native camera state. */
|
|
38
|
+
getCameraState(): Promise<CameraState>;
|
|
39
|
+
/** Runtime camera control path after the view has been created. */
|
|
40
|
+
setCamera(camera: CameraState): void;
|
|
41
|
+
}
|
|
42
|
+
export type CesiumView = HybridView<CesiumViewProps, CesiumViewMethods>;
|
|
43
|
+
//# sourceMappingURL=cesium-view.nitro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cesium-view.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/cesium-view.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,4BAA4B,CAAA;AAEnC,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,iEAAiE;AACjE,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,kBAAkB,EAAE,OAAO,CAAA;IAC3B,YAAY,EAAE,OAAO,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,4EAA4E;IAC5E,aAAa,EAAE,WAAW,CAAA;IAC1B,cAAc,EAAE,OAAO,CAAA;IACvB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,4BAA4B,EAAE,MAAM,CAAA;IACpC,sBAAsB,EAAE,MAAM,CAAA;IAC9B,6CAA6C;IAC7C,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAC7C;AAED,MAAM,WAAW,iBAAkB,SAAQ,iBAAiB;IAC1D,+CAA+C;IAC/C,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAA;IACtC,mEAAmE;IACnE,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;CACrC;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAA"}
|
package/nitro.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
|
+
"cxxNamespace": [
|
|
4
|
+
"reactnativecesium"
|
|
5
|
+
],
|
|
6
|
+
"ios": {
|
|
7
|
+
"iosModuleName": "ReactNativeCesium"
|
|
8
|
+
},
|
|
9
|
+
"android": {
|
|
10
|
+
"androidNamespace": [
|
|
11
|
+
"reactnativecesium"
|
|
12
|
+
],
|
|
13
|
+
"androidCxxLibName": "ReactNativeCesium"
|
|
14
|
+
},
|
|
15
|
+
"autolinking": {
|
|
16
|
+
"CesiumView": {
|
|
17
|
+
"ios": {
|
|
18
|
+
"language": "swift",
|
|
19
|
+
"implementationClassName": "HybridCesiumView"
|
|
20
|
+
},
|
|
21
|
+
"android": {
|
|
22
|
+
"language": "kotlin",
|
|
23
|
+
"implementationClassName": "HybridCesiumView"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"ignorePaths": [
|
|
28
|
+
"**/node_modules"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
** linguist-generated=true
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#
|
|
2
|
+
# ReactNativeCesium+autolinking.cmake
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/ReactNativeCesium+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_REACTNATIVECESIUM_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
ReactNativeCesium PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/ReactNativeCesiumOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridCesiumViewSpec.cpp
|
|
37
|
+
../nitrogen/generated/shared/c++/views/HybridCesiumViewComponent.cpp
|
|
38
|
+
# Android-specific Nitrogen C++ sources
|
|
39
|
+
../nitrogen/generated/android/c++/JHybridCesiumViewSpec.cpp
|
|
40
|
+
../nitrogen/generated/android/c++/views/JHybridCesiumViewStateUpdater.cpp
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
44
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
45
|
+
target_compile_definitions(
|
|
46
|
+
ReactNativeCesium PRIVATE
|
|
47
|
+
-DFOLLY_NO_CONFIG=1
|
|
48
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
49
|
+
-DFOLLY_USE_LIBCPP=1
|
|
50
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
51
|
+
-DFOLLY_MOBILE=1
|
|
52
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
53
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
54
|
+
# Once we target android-23 above, we can comment
|
|
55
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
56
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Add all libraries required by the generated specs
|
|
60
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
61
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
62
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
63
|
+
|
|
64
|
+
# Link all libraries together
|
|
65
|
+
target_link_libraries(
|
|
66
|
+
ReactNativeCesium
|
|
67
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
68
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
69
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
73
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
74
|
+
target_link_libraries(
|
|
75
|
+
ReactNativeCesium
|
|
76
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
77
|
+
)
|
|
78
|
+
else()
|
|
79
|
+
target_link_libraries(
|
|
80
|
+
ReactNativeCesium
|
|
81
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
82
|
+
)
|
|
83
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeCesium+autolinking.gradle
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/ReactNativeCesium+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 ReactNativeCesium is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeCesiumOnLoad.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#ifndef BUILDING_REACTNATIVECESIUM_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error ReactNativeCesiumOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "ReactNativeCesiumOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridCesiumViewSpec.hpp"
|
|
19
|
+
#include "JFunc_void_CesiumMetrics.hpp"
|
|
20
|
+
#include "views/JHybridCesiumViewStateUpdater.hpp"
|
|
21
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::reactnativecesium {
|
|
24
|
+
|
|
25
|
+
int initialize(JavaVM* vm) {
|
|
26
|
+
return facebook::jni::initialize(vm, []() {
|
|
27
|
+
::margelo::nitro::reactnativecesium::registerAllNatives();
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
struct JHybridCesiumViewSpecImpl: public jni::JavaClass<JHybridCesiumViewSpecImpl, JHybridCesiumViewSpec::JavaPart> {
|
|
32
|
+
static constexpr auto kJavaDescriptor = "Lcom/reactnativecesium/HybridCesiumView;";
|
|
33
|
+
static std::shared_ptr<JHybridCesiumViewSpec> create() {
|
|
34
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridCesiumViewSpecImpl::javaobject()>();
|
|
35
|
+
jni::local_ref<JHybridCesiumViewSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
36
|
+
return javaPart->getJHybridCesiumViewSpec();
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
void registerAllNatives() {
|
|
41
|
+
using namespace margelo::nitro;
|
|
42
|
+
using namespace margelo::nitro::reactnativecesium;
|
|
43
|
+
|
|
44
|
+
// Register native JNI methods
|
|
45
|
+
margelo::nitro::reactnativecesium::JHybridCesiumViewSpec::CxxPart::registerNatives();
|
|
46
|
+
margelo::nitro::reactnativecesium::JFunc_void_CesiumMetrics_cxx::registerNatives();
|
|
47
|
+
margelo::nitro::reactnativecesium::views::JHybridCesiumViewStateUpdater::registerNatives();
|
|
48
|
+
|
|
49
|
+
// Register Nitro Hybrid Objects
|
|
50
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
51
|
+
"CesiumView",
|
|
52
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
53
|
+
return JHybridCesiumViewSpecImpl::create();
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
} // namespace margelo::nitro::reactnativecesium
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNativeCesiumOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::reactnativecesium {
|
|
13
|
+
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the native (C++) part of ReactNativeCesium, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
21
|
+
* Example:
|
|
22
|
+
* ```cpp (cpp-adapter.cpp)
|
|
23
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all ReactNativeCesium HybridObjects
|
|
26
|
+
* margelo::nitro::reactnativecesium::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
void registerAllNatives();
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::reactnativecesium
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JCameraState.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "CameraState.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativecesium {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "CameraState" and the the Kotlin data class "CameraState".
|
|
21
|
+
*/
|
|
22
|
+
struct JCameraState final: public jni::JavaClass<JCameraState> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativecesium/CameraState;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct CameraState by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
CameraState toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldLatitude = clazz->getField<double>("latitude");
|
|
35
|
+
double latitude = this->getFieldValue(fieldLatitude);
|
|
36
|
+
static const auto fieldLongitude = clazz->getField<double>("longitude");
|
|
37
|
+
double longitude = this->getFieldValue(fieldLongitude);
|
|
38
|
+
static const auto fieldAltitude = clazz->getField<double>("altitude");
|
|
39
|
+
double altitude = this->getFieldValue(fieldAltitude);
|
|
40
|
+
static const auto fieldHeading = clazz->getField<double>("heading");
|
|
41
|
+
double heading = this->getFieldValue(fieldHeading);
|
|
42
|
+
static const auto fieldPitch = clazz->getField<double>("pitch");
|
|
43
|
+
double pitch = this->getFieldValue(fieldPitch);
|
|
44
|
+
static const auto fieldRoll = clazz->getField<double>("roll");
|
|
45
|
+
double roll = this->getFieldValue(fieldRoll);
|
|
46
|
+
static const auto fieldVerticalFovDeg = clazz->getField<double>("verticalFovDeg");
|
|
47
|
+
double verticalFovDeg = this->getFieldValue(fieldVerticalFovDeg);
|
|
48
|
+
return CameraState(
|
|
49
|
+
latitude,
|
|
50
|
+
longitude,
|
|
51
|
+
altitude,
|
|
52
|
+
heading,
|
|
53
|
+
pitch,
|
|
54
|
+
roll,
|
|
55
|
+
verticalFovDeg
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
/**
|
|
61
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
62
|
+
*/
|
|
63
|
+
[[maybe_unused]]
|
|
64
|
+
static jni::local_ref<JCameraState::javaobject> fromCpp(const CameraState& value) {
|
|
65
|
+
using JSignature = JCameraState(double, double, double, double, double, double, double);
|
|
66
|
+
static const auto clazz = javaClassStatic();
|
|
67
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
68
|
+
return create(
|
|
69
|
+
clazz,
|
|
70
|
+
value.latitude,
|
|
71
|
+
value.longitude,
|
|
72
|
+
value.altitude,
|
|
73
|
+
value.heading,
|
|
74
|
+
value.pitch,
|
|
75
|
+
value.roll,
|
|
76
|
+
value.verticalFovDeg
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro::reactnativecesium
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JCesiumMetrics.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "CesiumMetrics.hpp"
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::reactnativecesium {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "CesiumMetrics" and the the Kotlin data class "CesiumMetrics".
|
|
21
|
+
*/
|
|
22
|
+
struct JCesiumMetrics final: public jni::JavaClass<JCesiumMetrics> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/reactnativecesium/CesiumMetrics;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct CesiumMetrics by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
CesiumMetrics toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldFps = clazz->getField<double>("fps");
|
|
35
|
+
double fps = this->getFieldValue(fieldFps);
|
|
36
|
+
static const auto fieldTilesRendered = clazz->getField<double>("tilesRendered");
|
|
37
|
+
double tilesRendered = this->getFieldValue(fieldTilesRendered);
|
|
38
|
+
static const auto fieldTilesLoading = clazz->getField<double>("tilesLoading");
|
|
39
|
+
double tilesLoading = this->getFieldValue(fieldTilesLoading);
|
|
40
|
+
static const auto fieldTilesVisited = clazz->getField<double>("tilesVisited");
|
|
41
|
+
double tilesVisited = this->getFieldValue(fieldTilesVisited);
|
|
42
|
+
static const auto fieldIonTokenConfigured = clazz->getField<jboolean>("ionTokenConfigured");
|
|
43
|
+
jboolean ionTokenConfigured = this->getFieldValue(fieldIonTokenConfigured);
|
|
44
|
+
static const auto fieldTilesetReady = clazz->getField<jboolean>("tilesetReady");
|
|
45
|
+
jboolean tilesetReady = this->getFieldValue(fieldTilesetReady);
|
|
46
|
+
static const auto fieldCreditsPlainText = clazz->getField<jni::JString>("creditsPlainText");
|
|
47
|
+
jni::local_ref<jni::JString> creditsPlainText = this->getFieldValue(fieldCreditsPlainText);
|
|
48
|
+
return CesiumMetrics(
|
|
49
|
+
fps,
|
|
50
|
+
tilesRendered,
|
|
51
|
+
tilesLoading,
|
|
52
|
+
tilesVisited,
|
|
53
|
+
static_cast<bool>(ionTokenConfigured),
|
|
54
|
+
static_cast<bool>(tilesetReady),
|
|
55
|
+
creditsPlainText->toStdString()
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
/**
|
|
61
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
62
|
+
*/
|
|
63
|
+
[[maybe_unused]]
|
|
64
|
+
static jni::local_ref<JCesiumMetrics::javaobject> fromCpp(const CesiumMetrics& value) {
|
|
65
|
+
using JSignature = JCesiumMetrics(double, double, double, double, jboolean, jboolean, jni::alias_ref<jni::JString>);
|
|
66
|
+
static const auto clazz = javaClassStatic();
|
|
67
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
68
|
+
return create(
|
|
69
|
+
clazz,
|
|
70
|
+
value.fps,
|
|
71
|
+
value.tilesRendered,
|
|
72
|
+
value.tilesLoading,
|
|
73
|
+
value.tilesVisited,
|
|
74
|
+
value.ionTokenConfigured,
|
|
75
|
+
value.tilesetReady,
|
|
76
|
+
jni::make_jstring(value.creditsPlainText)
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
} // namespace margelo::nitro::reactnativecesium
|