@reearth/core 0.0.7-alpha.33 → 0.0.7-alpha.34
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/dist/core.js +5 -3
- package/dist/core.umd.cjs +2 -2
- package/package.json +1 -1
- package/src/engines/Cesium/Feature/Tileset/hooks.ts +21 -15
package/package.json
CHANGED
|
@@ -92,15 +92,14 @@ const makeFeatureId = (
|
|
|
92
92
|
}
|
|
93
93
|
const featureId = getBuiltinFeatureId(tileFeature);
|
|
94
94
|
return generateIDWithMD5(
|
|
95
|
-
`${coordinates.x}-${coordinates.y}-${coordinates.z}-${featureId}-${
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
: ""
|
|
95
|
+
`${coordinates.x}-${coordinates.y}-${coordinates.z}-${featureId}-${!(tileFeature instanceof Model)
|
|
96
|
+
? JSON.stringify(
|
|
97
|
+
// Read only root properties.
|
|
98
|
+
Object.entries(convertCesium3DTileFeatureProperties(tileFeature))
|
|
99
|
+
.filter((_k, v) => typeof v === "string" || typeof v === "number")
|
|
100
|
+
.map(([k, v]) => `${k}${v}`),
|
|
101
|
+
)
|
|
102
|
+
: ""
|
|
104
103
|
}`,
|
|
105
104
|
);
|
|
106
105
|
};
|
|
@@ -732,8 +731,15 @@ export const useHooks = ({
|
|
|
732
731
|
|
|
733
732
|
const loadTileset = async () => {
|
|
734
733
|
try {
|
|
735
|
-
|
|
736
|
-
|
|
734
|
+
if (googleMapApiKey) {
|
|
735
|
+
const tileset = await createGooglePhotorealistic3DTileset(googleMapApiKey);
|
|
736
|
+
return tileset.resource;
|
|
737
|
+
} else {
|
|
738
|
+
const resource = IonResource.fromAssetId(2275207, {
|
|
739
|
+
accessToken: meta?.cesiumIonAccessToken as string | undefined,
|
|
740
|
+
});
|
|
741
|
+
return resource;
|
|
742
|
+
}
|
|
737
743
|
} catch (error) {
|
|
738
744
|
console.error(`Error loading Photorealistic 3D Tiles tileset: ${error}`);
|
|
739
745
|
throw error;
|
|
@@ -741,13 +747,13 @@ export const useHooks = ({
|
|
|
741
747
|
};
|
|
742
748
|
|
|
743
749
|
return loadTileset();
|
|
744
|
-
}, [type, isVisible, googleMapApiKey]);
|
|
750
|
+
}, [type, isVisible, googleMapApiKey, meta?.cesiumIonAccessToken]);
|
|
745
751
|
|
|
746
752
|
const tilesetUrl = useMemo(() => {
|
|
747
753
|
return type === "osm-buildings" && isVisible
|
|
748
754
|
? IonResource.fromAssetId(96188, {
|
|
749
|
-
|
|
750
|
-
|
|
755
|
+
accessToken: meta?.cesiumIonAccessToken as string | undefined,
|
|
756
|
+
}) // https://github.com/CesiumGS/cesium/blob/main/packages/engine/Source/Scene/createOsmBuildings.js#L53
|
|
751
757
|
: googleMapPhotorealisticResource && isVisible
|
|
752
758
|
? googleMapPhotorealisticResource
|
|
753
759
|
: type === "3dtiles" && isVisible
|
|
@@ -772,7 +778,7 @@ export const useHooks = ({
|
|
|
772
778
|
property?.imageBasedLightIntensity ?? viewerProperty?.scene?.imageBasedLighting?.intensity;
|
|
773
779
|
const sphericalHarmonicCoefficients = arrayToCartecian3(
|
|
774
780
|
property?.sphericalHarmonicCoefficients ??
|
|
775
|
-
|
|
781
|
+
viewerProperty?.scene?.imageBasedLighting?.sphericalHarmonicCoefficients,
|
|
776
782
|
imageBasedLightIntensity,
|
|
777
783
|
);
|
|
778
784
|
|