Skip to content

Commit b131691

Browse files
committed
Merge remote-tracking branch 'origin' into cesium.com
2 parents 6163bcc + 8f923ed commit b131691

File tree

255 files changed

+15209
-6108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+15209
-6108
lines changed

.github/workflows/cla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v5
1414
- name: install node 22
15-
uses: actions/setup-node@v5
15+
uses: actions/setup-node@v6
1616
with:
1717
node-version: '22'
1818
- name: install npm packages

.github/workflows/deploy.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: deploy
22
on:
33
push:
44
branches-ignore:
5-
- 'cesium.com'
5+
- "cesium.com"
66
- production
77
concurrency:
88
group: deploy-${{ github.ref }}
@@ -22,14 +22,13 @@ jobs:
2222
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2323
GITHUB_REPO: ${{ github.repository }}
2424
GITHUB_SHA: ${{ github.sha }}
25-
BASE_URL: /cesium/${{ github.ref_name }}/
2625
DEPLOYED_URL: https://ci-builds.cesium.com/cesium/${{ github.ref_name }}/
2726
steps:
2827
- uses: actions/checkout@v5
2928
- name: install node 22
30-
uses: actions/setup-node@v5
29+
uses: actions/setup-node@v6
3130
with:
32-
node-version: '22'
31+
node-version: "22"
3332
- name: npm install
3433
run: npm install
3534
- name: set the version in package.json
@@ -42,8 +41,6 @@ jobs:
4241
run: npm pack --workspaces &> /dev/null
4342
- name: build apps
4443
run: npm run build-apps
45-
- name: build sandcastle v2
46-
run: npm run build-ci -w packages/sandcastle -- -l warn
4744
- uses: ./.github/actions/verify-package
4845
- name: deploy to s3
4946
if: ${{ env.AWS_ACCESS_KEY_ID != '' }}

.github/workflows/dev.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v5
1515
- name: install node 22
16-
uses: actions/setup-node@v5
16+
uses: actions/setup-node@v6
1717
with:
1818
node-version: '22'
1919
- name: npm install
@@ -34,7 +34,7 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v5
3636
- name: install node 22
37-
uses: actions/setup-node@v5
37+
uses: actions/setup-node@v6
3838
with:
3939
node-version: '22'
4040
- name: npm install
@@ -51,7 +51,7 @@ jobs:
5151
steps:
5252
- uses: actions/checkout@v5
5353
- name: install node 22
54-
uses: actions/setup-node@v5
54+
uses: actions/setup-node@v6
5555
with:
5656
node-version: '22'
5757
- name: npm install
@@ -121,7 +121,7 @@ jobs:
121121
steps:
122122
- uses: actions/checkout@v5
123123
- name: install node 20
124-
uses: actions/setup-node@v5
124+
uses: actions/setup-node@v6
125125
with:
126126
node-version: '20'
127127
- name: npm install

.github/workflows/prod.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v5
1111
- name: install node 22
12-
uses: actions/setup-node@v5
12+
uses: actions/setup-node@v6
1313
with:
1414
node-version: "22"
1515
- name: npm install
@@ -34,21 +34,24 @@ jobs:
3434
steps:
3535
- uses: actions/checkout@v5
3636
- name: install node 22
37-
uses: actions/setup-node@v5
37+
uses: actions/setup-node@v6
3838
with:
3939
node-version: "22"
4040
- name: npm install
4141
run: npm install
4242
- name: build website release
4343
run: npm run website-release
44-
- name: build apps
45-
run: npm run build-apps
4644
- name: build types
4745
run: npm run build-ts
48-
- name: build prod sandcastle
49-
run: npm run build-prod -w packages/sandcastle -- -l warn
46+
- name: build apps
47+
run: npm run build-apps
5048
- name: deploy to cesium.com
5149
if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
50+
# Download zip from the Github release and unzip to Build/release/
51+
# Publish that unzipped code to the bucket for https://cesium.com/downloads/cesiumjs/releases/[version]/... urls
52+
# Publish the documentation files to the bucket for https://cesium.com/learn/cesiumjs/ref-doc/
53+
# Publish the simple viewer app to the bucket for https://cesium.com/cesiumjs/cesium-viewer/
54+
# Publish sandcastle to the bucket for https://sandcastle.cesium.com/
5255
run: |
5356
curl -LO $(curl https://api.github.com/repos/CesiumGS/cesium/releases/latest -H "Authorization: ${GITHUB_TOKEN}" | jq -r '.assets[0].browser_download_url')
5457
unzip Cesium-$(cat package.json | jq -r '.version' | sed 's/\.0$//').zip -d Build/release/ -x "Apps"

.github/workflows/sandcastle-dev.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: sandcastle-dev
22
on:
33
push:
44
branches:
5-
- 'cesium.com'
5+
- "main"
66
jobs:
77
deploy:
88
runs-on: ubuntu-latest
@@ -18,17 +18,17 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v5
2020
- name: install node 22
21-
uses: actions/setup-node@v5
21+
uses: actions/setup-node@v6
2222
with:
23-
node-version: '22'
23+
node-version: "22"
2424
- name: npm install
2525
run: npm install
2626
- name: build website release
2727
run: npm run website-release
2828
- name: build types
2929
run: npm run build-ts
3030
- name: build prod sandcastle
31-
run: npm run build-prod -w packages/sandcastle -- -l warn
31+
run: npm run build-sandcastle
3232
- name: deploy to dev-sandcastle.cesium.com
3333
if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
3434
run: |

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
/scripts/
2424
/favicon.ico
2525
/gulpfile.js
26+
/gulpfile.apps.js
27+
/gulpfile.makezip.js
2628
/index.html
2729
/index.release.html
2830
/launches

Apps/CesiumViewer/CesiumViewer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// eslint-disable-next-line no-undef
21
window.CESIUM_BASE_URL = window.CESIUM_BASE_URL
32
? window.CESIUM_BASE_URL
43
: "../../Build/CesiumUnminified/";

Apps/Sandcastle/gallery/Custom DataSource.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
/**
6565
* Gets a human-readable name for this instance.
6666
* @memberof WebGLGlobeDataSource.prototype
67-
* @type {String}
67+
* @type {string}
6868
*/
6969
name: {
7070
get: function () {
@@ -93,7 +93,7 @@
9393
/**
9494
* Gets a value indicating if the data source is currently loading data.
9595
* @memberof WebGLGlobeDataSource.prototype
96-
* @type {Boolean}
96+
* @type {boolean}
9797
*/
9898
isLoading: {
9999
get: function () {
@@ -150,7 +150,7 @@
150150
* so that only one series is viewed at a time. Valid values are defined
151151
* in the seriesNames property.
152152
* @memberof WebGLGlobeDataSource.prototype
153-
* @type {String}
153+
* @type {string}
154154
*/
155155
seriesToDisplay: {
156156
get: function () {
@@ -174,7 +174,7 @@
174174
/**
175175
* Gets or sets the scale factor applied to the height of each line.
176176
* @memberof WebGLGlobeDataSource.prototype
177-
* @type {Number}
177+
* @type {number}
178178
*/
179179
heightScale: {
180180
get: function () {
@@ -190,7 +190,7 @@
190190
/**
191191
* Gets whether or not this data source should be displayed.
192192
* @memberof WebGLGlobeDataSource.prototype
193-
* @type {Boolean}
193+
* @type {boolean}
194194
*/
195195
show: {
196196
get: function () {
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta
7+
name="viewport"
8+
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
9+
/>
10+
<meta name="description" content="Apply materials to the globe." />
11+
<meta name="cesium-sandcastle-labels" content="Showcases" />
12+
<title>Cesium Demo</title>
13+
<script type="text/javascript" src="../Sandcastle-header.js"></script>
14+
<script
15+
type="text/javascript"
16+
src="../../../Build/CesiumUnminified/Cesium.js"
17+
nomodule
18+
></script>
19+
<script type="module" src="../load-cesium-es6.js"></script>
20+
</head>
21+
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
22+
<style>
23+
@import url(../templates/bucket.css);
24+
</style>
25+
<div id="cesiumContainer" class="fullSize"></div>
26+
<div id="loadingOverlay"><h1>Loading...</h1></div>
27+
<div id="toolbar">
28+
<div id="zoomButtons"></div>
29+
</div>
30+
<script id="cesium_sandcastle_script">
31+
window.startup = async function (Cesium) {
32+
"use strict";
33+
//Sandcastle_Begin
34+
const terrainProvider = await Cesium.Cesium3DTilesTerrainProvider.fromIonAssetId(
35+
3923568,
36+
{
37+
requestVertexNormals: true, // Needed for hillshade lighting
38+
requestWaterMask: true, // Needed to distinguish land from water
39+
},
40+
);
41+
42+
const viewer = new Cesium.Viewer("cesiumContainer", {
43+
terrainProvider: terrainProvider,
44+
scene3DOnly: true,
45+
sceneModePicker: false,
46+
navigationHelpButton: false,
47+
});
48+
49+
// Create a globe material for shading elevation only on land
50+
const customElevationMaterial = new Cesium.Material({
51+
fabric: {
52+
type: "ElevationLand",
53+
materials: {
54+
waterMaskMaterial: {
55+
type: "WaterMask",
56+
},
57+
elevationRampMaterial: {
58+
type: "ElevationRamp",
59+
},
60+
},
61+
components: {
62+
diffuse: "elevationRampMaterial.diffuse",
63+
alpha: "1.0 - waterMaskMaterial.alpha", // We'll need the inverse of the watermask to shade land
64+
},
65+
},
66+
translucent: false,
67+
});
68+
69+
const minHeight = -414.0; // approximate dead sea elevation
70+
const maxHeight = 8777.0; // approximate everest elevation
71+
const elevationRamp = [0.0, 0.045, 0.45, 0.5, 0.55, 1.0];
72+
function getColorRamp() {
73+
const ramp = document.createElement("canvas");
74+
ramp.width = 100;
75+
ramp.height = 1;
76+
const ctx = ramp.getContext("2d");
77+
78+
const values = elevationRamp;
79+
80+
const grd = ctx.createLinearGradient(0, 0, 100, 0);
81+
82+
// See https://gis.stackexchange.com/questions/25099/choosing-colour-ramp-to-use-for-elevation
83+
grd.addColorStop(values[0], "#344f31");
84+
grd.addColorStop(values[1], "#5b8742");
85+
grd.addColorStop(values[2], "#e6daa5");
86+
grd.addColorStop(values[3], "#fdc771");
87+
grd.addColorStop(values[4], "#b99d89");
88+
grd.addColorStop(values[5], "#f0f0f0");
89+
90+
ctx.fillStyle = grd;
91+
ctx.fillRect(0, 0, 100, 1);
92+
93+
return ramp;
94+
}
95+
96+
const globe = viewer.scene.globe;
97+
const material = customElevationMaterial;
98+
const shadingUniforms = material.materials.elevationRampMaterial.uniforms;
99+
100+
globe.showWaterEffect = false;
101+
globe.enableLighting = true;
102+
103+
shadingUniforms.minimumHeight = minHeight;
104+
shadingUniforms.maximumHeight = maxHeight;
105+
shadingUniforms.image = getColorRamp();
106+
globe.material = material;
107+
108+
// Light the scene with a hillshade effect similar to https://pro.arcgis.com/en/pro-app/latest/tool-reference/3d-analyst/how-hillshade-works.htm
109+
const scene = viewer.scene;
110+
scene.light = new Cesium.DirectionalLight({
111+
direction: new Cesium.Cartesian3(1, 0, 0), // Updated every frame
112+
});
113+
114+
// Update the light position base on the camera
115+
const scratchNormal = new Cesium.Cartesian3();
116+
scene.preRender.addEventListener(function (scene, time) {
117+
const surfaceNormal = Cesium.Ellipsoid.WGS84.geodeticSurfaceNormal(
118+
scene.camera.positionWC,
119+
scratchNormal,
120+
);
121+
const negativeNormal = Cesium.Cartesian3.negate(surfaceNormal, surfaceNormal);
122+
scene.light.direction = Cesium.Cartesian3.normalize(
123+
Cesium.Cartesian3.add(negativeNormal, scene.camera.rightWC, surfaceNormal),
124+
scene.light.direction,
125+
);
126+
});
127+
//Sandcastle_End
128+
};
129+
if (typeof Cesium !== "undefined") {
130+
window.startupCalled = true;
131+
window.startup(Cesium).catch((error) => {
132+
"use strict";
133+
console.error(error);
134+
});
135+
Sandcastle.finishedLoading();
136+
}
137+
</script>
138+
</body>
139+
</html>
21.6 KB
Loading

0 commit comments

Comments
 (0)