@reearth/core 0.0.7-alpha.72 → 0.0.7-alpha.76
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 +4149 -4138
- package/dist/core.umd.cjs +64 -64
- package/package.json +9 -2
- package/src/engines/Cesium/hooks/useViewerProperty.ts +16 -1
- package/src/engines/Cesium/hooks.ts +6 -4
- package/src/engines/Cesium/index.tsx +2 -1
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reearth/core",
|
|
3
|
-
"version": "0.0.7-alpha.
|
|
3
|
+
"version": "0.0.7-alpha.76",
|
|
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.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/reearth/core.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/reearth/core#readme",
|
|
12
|
+
"bugs": "https://github.com/reearth/core/issues",
|
|
7
13
|
"type": "module",
|
|
8
14
|
"main": "dist/core.umd.cjs",
|
|
9
15
|
"module": "dist/core.js",
|
|
@@ -131,5 +137,6 @@
|
|
|
131
137
|
},
|
|
132
138
|
"resolutions": {
|
|
133
139
|
"jackspeak": "3.1.2"
|
|
134
|
-
}
|
|
140
|
+
},
|
|
141
|
+
"packageManager": "npm@11.5.1+sha512.232e6f5d9e799bcb486920b3e9ba907fdf96e576cf7e8c9446c8162e33a416096a1d37a9e910d9a918f6b1f606791c99bc6bb61ee2569b496ec74af13d0dbd95"
|
|
135
142
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Cartesian3, Color, DirectionalLight, SceneMode, SunLight, Viewer } from "cesium";
|
|
2
|
-
import { RefObject, useMemo } from "react";
|
|
2
|
+
import { RefObject, useEffect, useMemo } from "react";
|
|
3
3
|
import { CesiumComponentRef } from "resium";
|
|
4
4
|
|
|
5
5
|
import { ViewerProperty } from "../..";
|
|
@@ -61,6 +61,20 @@ export default ({
|
|
|
61
61
|
[property?.scene?.backgroundColor],
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
+
const showSkyBox = property?.sky?.skyBox?.show ?? true;
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const scene = cesium.current?.cesiumElement?.scene;
|
|
68
|
+
if (!scene) return;
|
|
69
|
+
// set backgroundColor
|
|
70
|
+
scene.backgroundColor = sceneBackgroundColor ?? Color.BLACK;
|
|
71
|
+
// Cesium 1.139 bug: SkyBox.show does not forward to _panorama.show,
|
|
72
|
+
// so we must set it directly.
|
|
73
|
+
const panorama = (scene.skyBox as any)?._panorama;
|
|
74
|
+
if (panorama) panorama.show = showSkyBox;
|
|
75
|
+
scene.requestRender();
|
|
76
|
+
}, [cesium, sceneBackgroundColor, showSkyBox]);
|
|
77
|
+
|
|
64
78
|
const sceneMsaaSamples = useMemo(() => {
|
|
65
79
|
// TODO: FXAA doesn't support alpha blending in Cesium, so we will enable FXAA when this is fixed.
|
|
66
80
|
// viewer.scene.postProcessStages.fxaa.enabled = property?.render?.antialias === "high";
|
|
@@ -86,5 +100,6 @@ export default ({
|
|
|
86
100
|
sceneBackgroundColor,
|
|
87
101
|
sceneMsaaSamples,
|
|
88
102
|
sceneMode,
|
|
103
|
+
showSkyBox,
|
|
89
104
|
};
|
|
90
105
|
};
|
|
@@ -732,10 +732,11 @@ export default ({
|
|
|
732
732
|
});
|
|
733
733
|
}, [time, timelineManagerRef]);
|
|
734
734
|
|
|
735
|
-
const { sceneLight, sceneBackgroundColor, sceneMsaaSamples, sceneMode } =
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
735
|
+
const { sceneLight, sceneBackgroundColor, sceneMsaaSamples, sceneMode, showSkyBox } =
|
|
736
|
+
useViewerProperty({
|
|
737
|
+
property,
|
|
738
|
+
cesium,
|
|
739
|
+
});
|
|
739
740
|
|
|
740
741
|
useLayerDragDrop({ cesium, onLayerDrag, onLayerDrop, isLayerDraggable });
|
|
741
742
|
|
|
@@ -792,6 +793,7 @@ export default ({
|
|
|
792
793
|
sceneBackgroundColor,
|
|
793
794
|
sceneMsaaSamples,
|
|
794
795
|
sceneMode,
|
|
796
|
+
showSkyBox,
|
|
795
797
|
cameraViewBoundaries,
|
|
796
798
|
cameraViewOuterBoundaries,
|
|
797
799
|
cameraViewBoundariesMaterial,
|
|
@@ -80,6 +80,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
|
|
|
80
80
|
sceneBackgroundColor,
|
|
81
81
|
sceneMsaaSamples,
|
|
82
82
|
sceneMode,
|
|
83
|
+
showSkyBox,
|
|
83
84
|
cameraViewBoundaries,
|
|
84
85
|
cameraViewOuterBoundaries,
|
|
85
86
|
cameraViewBoundariesMaterial,
|
|
@@ -261,7 +262,7 @@ const Cesium: React.ForwardRefRenderFunction<EngineRef, EngineProps> = (
|
|
|
261
262
|
verticalExaggerationRelativeHeight={property?.scene?.verticalExaggerationRelativeHeight}
|
|
262
263
|
verticalExaggeration={verticalExaggeration}
|
|
263
264
|
/>
|
|
264
|
-
<SkyBox show={
|
|
265
|
+
<SkyBox show={showSkyBox} />
|
|
265
266
|
<Fog enabled={property?.sky?.fog?.enabled ?? true} density={property?.sky?.fog?.density} />
|
|
266
267
|
<Sun show={property?.sky?.sun?.show ?? true} />
|
|
267
268
|
<Moon show={property?.sky?.moon?.show ?? true} />
|