@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reearth/core",
3
- "version": "0.0.7-alpha.33",
3
+ "version": "0.0.7-alpha.34",
4
4
  "author": "Re:Earth contributors <community@reearth.io>",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A library that abstracts a map engine as one common API.",
@@ -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
- !(tileFeature instanceof Model)
97
- ? JSON.stringify(
98
- // Read only root properties.
99
- Object.entries(convertCesium3DTileFeatureProperties(tileFeature))
100
- .filter((_k, v) => typeof v === "string" || typeof v === "number")
101
- .map(([k, v]) => `${k}${v}`),
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
- const tileset = await createGooglePhotorealistic3DTileset(googleMapApiKey);
736
- return tileset.resource;
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
- accessToken: meta?.cesiumIonAccessToken as string | undefined,
750
- }) // https://github.com/CesiumGS/cesium/blob/main/packages/engine/Source/Scene/createOsmBuildings.js#L53
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
- viewerProperty?.scene?.imageBasedLighting?.sphericalHarmonicCoefficients,
781
+ viewerProperty?.scene?.imageBasedLighting?.sphericalHarmonicCoefficients,
776
782
  imageBasedLightIntensity,
777
783
  );
778
784