@reearth/core 0.0.7-alpha.33 → 0.0.7-alpha.35
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/index.d.ts
CHANGED
|
@@ -160,6 +160,7 @@ export declare type CameraProperty = {
|
|
|
160
160
|
|
|
161
161
|
export declare type Cesium3DTilesAppearance = {
|
|
162
162
|
show?: boolean;
|
|
163
|
+
height?: number;
|
|
163
164
|
color?: string;
|
|
164
165
|
styleUrl?: string;
|
|
165
166
|
shadows?: "disabled" | "enabled" | "cast_only" | "receive_only";
|
|
@@ -1163,6 +1164,7 @@ export declare type ModelAppearance = {
|
|
|
1163
1164
|
model?: string;
|
|
1164
1165
|
url?: string;
|
|
1165
1166
|
heightReference?: "none" | "clamp" | "relative";
|
|
1167
|
+
height?: number;
|
|
1166
1168
|
heading?: number;
|
|
1167
1169
|
pitch?: number;
|
|
1168
1170
|
roll?: number;
|
package/package.json
CHANGED
|
@@ -32,9 +32,7 @@ export type Props = FeatureProps<Property>;
|
|
|
32
32
|
|
|
33
33
|
export type Property = ModelAppearance & {
|
|
34
34
|
location?: { lat: number; lng: number };
|
|
35
|
-
height?: number;
|
|
36
35
|
};
|
|
37
|
-
|
|
38
36
|
export default function Model({
|
|
39
37
|
id,
|
|
40
38
|
isVisible,
|
|
@@ -50,7 +48,9 @@ export default function Model({
|
|
|
50
48
|
const coordinates = useMemo(
|
|
51
49
|
() =>
|
|
52
50
|
geometry?.type === "Point"
|
|
53
|
-
?
|
|
51
|
+
? property?.height === undefined
|
|
52
|
+
? geometry.coordinates
|
|
53
|
+
: [...geometry.coordinates.slice(0, 2), property.height]
|
|
54
54
|
: property?.location
|
|
55
55
|
? [property.location.lng, property.location.lat, property.height ?? 0]
|
|
56
56
|
: undefined,
|
|
@@ -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
|
|
|
@@ -60,14 +60,14 @@ export type MarkerAppearance = {
|
|
|
60
60
|
label?: boolean;
|
|
61
61
|
labelText?: string;
|
|
62
62
|
labelPosition?:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
63
|
+
| "left"
|
|
64
|
+
| "right"
|
|
65
|
+
| "top"
|
|
66
|
+
| "bottom"
|
|
67
|
+
| "lefttop"
|
|
68
|
+
| "leftbottom"
|
|
69
|
+
| "righttop"
|
|
70
|
+
| "rightbottom";
|
|
71
71
|
labelTypography?: Typography;
|
|
72
72
|
labelBackground?: boolean;
|
|
73
73
|
labelBackgroundColor?: string;
|
|
@@ -157,6 +157,7 @@ export type ModelAppearance = {
|
|
|
157
157
|
model?: string; // For compat
|
|
158
158
|
url?: string;
|
|
159
159
|
heightReference?: "none" | "clamp" | "relative";
|
|
160
|
+
height?: number;
|
|
160
161
|
heading?: number;
|
|
161
162
|
pitch?: number;
|
|
162
163
|
roll?: number;
|
|
@@ -192,6 +193,7 @@ export type FrustumAppearance = {
|
|
|
192
193
|
|
|
193
194
|
export type Cesium3DTilesAppearance = {
|
|
194
195
|
show?: boolean;
|
|
196
|
+
height?: number;
|
|
195
197
|
color?: string;
|
|
196
198
|
styleUrl?: string;
|
|
197
199
|
shadows?: "disabled" | "enabled" | "cast_only" | "receive_only";
|