Skip to content

Commit

Permalink
Merge branch 'main' into procedural-ibl
Browse files Browse the repository at this point in the history
  • Loading branch information
ggetz committed Oct 3, 2024
2 parents 3597350 + baaabaa commit 4a868aa
Show file tree
Hide file tree
Showing 352 changed files with 7,970 additions and 6,251 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ Specs/jasmine/**
Apps/Sandcastle/ThirdParty
Tools/jsdoc/cesium_template/static/javascript/prism.js
Tools/jsdoc/cesium_template/static/styles/prism.css
**/LICENSE.md

1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions Apps/Sandcastle/gallery/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 90
}
59 changes: 15 additions & 44 deletions Apps/Sandcastle/gallery/3D Models Coloring.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
></script>
<script type="module" src="../load-cesium-es6.js"></script>
</head>
<body
class="sandcastle-loading"
data-sandcastle-bucket="bucket-requirejs.html"
>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
#toolbar {
Expand Down Expand Up @@ -72,9 +69,7 @@
</td>
</tr>
<tr>
<td
data-bind="style: { color: colorBlendAmountEnabled ? '' : 'gray'}"
>
<td data-bind="style: { color: colorBlendAmountEnabled ? '' : 'gray'}">
Mix
</td>
<td>
Expand Down Expand Up @@ -176,17 +171,13 @@
const toolbar = document.getElementById("toolbar");
Cesium.knockout.applyBindings(viewModel, toolbar);

Cesium.knockout
.getObservable(viewModel, "color")
.subscribe(function (newValue) {
entity.model.color = getColor(newValue, viewModel.alpha);
});
Cesium.knockout.getObservable(viewModel, "color").subscribe(function (newValue) {
entity.model.color = getColor(newValue, viewModel.alpha);
});

Cesium.knockout
.getObservable(viewModel, "alpha")
.subscribe(function (newValue) {
entity.model.color = getColor(viewModel.color, newValue);
});
Cesium.knockout.getObservable(viewModel, "alpha").subscribe(function (newValue) {
entity.model.color = getColor(viewModel.color, newValue);
});

Cesium.knockout
.getObservable(viewModel, "colorBlendMode")
Expand All @@ -206,19 +197,13 @@
Cesium.knockout
.getObservable(viewModel, "silhouetteColor")
.subscribe(function (newValue) {
entity.model.silhouetteColor = getColor(
newValue,
viewModel.silhouetteAlpha
);
entity.model.silhouetteColor = getColor(newValue, viewModel.silhouetteAlpha);
});

Cesium.knockout
.getObservable(viewModel, "silhouetteAlpha")
.subscribe(function (newValue) {
entity.model.silhouetteColor = getColor(
viewModel.silhouetteColor,
newValue
);
entity.model.silhouetteColor = getColor(viewModel.silhouetteColor, newValue);
});

Cesium.knockout
Expand All @@ -239,10 +224,7 @@
const pitch = 0;
const roll = 0;
const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
const orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
hpr
);
const orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

entity = viewer.entities.add({
name: url,
Expand All @@ -269,19 +251,13 @@
{
text: "Aircraft",
onselect: function () {
createModel(
"../../SampleData/models/CesiumAir/Cesium_Air.glb",
5000.0
);
createModel("../../SampleData/models/CesiumAir/Cesium_Air.glb", 5000.0);
},
},
{
text: "Ground Vehicle",
onselect: function () {
createModel(
"../../SampleData/models/GroundVehicle/GroundVehicle.glb",
0
);
createModel("../../SampleData/models/GroundVehicle/GroundVehicle.glb", 0);
},
},
{
Expand All @@ -305,19 +281,14 @@
{
text: "Skinned Character",
onselect: function () {
createModel(
"../../SampleData/models/CesiumMan/Cesium_Man.glb",
0
);
createModel("../../SampleData/models/CesiumMan/Cesium_Man.glb", 0);
},
},
];

Sandcastle.addToolbarMenu(options);

Sandcastle.addToggleButton("Shadows", viewer.shadows, function (
checked
) {
Sandcastle.addToggleButton("Shadows", viewer.shadows, function (checked) {
viewer.shadows = checked;
});

Expand Down
40 changes: 8 additions & 32 deletions Apps/Sandcastle/gallery/3D Models.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@
></script>
<script type="module" src="../load-cesium-es6.js"></script>
</head>
<body
class="sandcastle-loading"
data-sandcastle-bucket="bucket-requirejs.html"
>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
Expand Down Expand Up @@ -51,10 +48,7 @@
const pitch = 0;
const roll = 0;
const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
const orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
hpr
);
const orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

const entity = viewer.entities.add({
name: url,
Expand All @@ -73,28 +67,19 @@
{
text: "Aircraft",
onselect: function () {
createModel(
"../../SampleData/models/CesiumAir/Cesium_Air.glb",
5000.0
);
createModel("../../SampleData/models/CesiumAir/Cesium_Air.glb", 5000.0);
},
},
{
text: "Drone",
onselect: function () {
createModel(
"../../SampleData/models/CesiumDrone/CesiumDrone.glb",
150.0
);
createModel("../../SampleData/models/CesiumDrone/CesiumDrone.glb", 150.0);
},
},
{
text: "Ground Vehicle",
onselect: function () {
createModel(
"../../SampleData/models/GroundVehicle/GroundVehicle.glb",
0
);
createModel("../../SampleData/models/GroundVehicle/GroundVehicle.glb", 0);
},
},
{
Expand All @@ -118,19 +103,13 @@
{
text: "Skinned Character",
onselect: function () {
createModel(
"../../SampleData/models/CesiumMan/Cesium_Man.glb",
0
);
createModel("../../SampleData/models/CesiumMan/Cesium_Man.glb", 0);
},
},
{
text: "Unlit Box",
onselect: function () {
createModel(
"../../SampleData/models/BoxUnlit/BoxUnlit.gltf",
10.0
);
createModel("../../SampleData/models/BoxUnlit/BoxUnlit.gltf", 10.0);
},
},
{
Expand Down Expand Up @@ -159,10 +138,7 @@
{
text: "Instanced Box",
onselect: function () {
createModel(
"../../SampleData/models/BoxInstanced/BoxInstanced.gltf",
15
);
createModel("../../SampleData/models/BoxInstanced/BoxInstanced.gltf", 15);
},
},
];
Expand Down
76 changes: 22 additions & 54 deletions Apps/Sandcastle/gallery/3D Tiles 1.1 CDB Yemen.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta
name="description"
content="Load a 3D Tiles 1.1 tileset converted from CDB."
/>
<meta name="description" content="Load a 3D Tiles 1.1 tileset converted from CDB." />
<meta name="cesium-sandcastle-labels" content="3D Tiles" />
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
Expand All @@ -21,10 +18,7 @@
></script>
<script type="module" src="../load-cesium-es6.js"></script>
</head>
<body
class="sandcastle-loading"
data-sandcastle-bucket="bucket-requirejs.html"
>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
table,
Expand Down Expand Up @@ -142,18 +136,9 @@
color: {
conditions: [
["${HGT} !== undefined && ${HGT} < 5", "color('#f5fd2d')"],
[
"${HGT} !== undefined && ${HGT} >= 5 && ${HGT} < 10",
"color('#d3a34a')",
],
[
"${HGT} !== undefined && ${HGT} >= 10 && ${HGT} < 15",
"color('#947e75')",
],
[
"${HGT} !== undefined && ${HGT} >= 15 && ${HGT} < 20",
"color('#565a9f')",
],
["${HGT} !== undefined && ${HGT} >= 5 && ${HGT} < 10", "color('#d3a34a')"],
["${HGT} !== undefined && ${HGT} >= 10 && ${HGT} < 15", "color('#947e75')"],
["${HGT} !== undefined && ${HGT} >= 15 && ${HGT} < 20", "color('#565a9f')"],
["${HGT} !== undefined && ${HGT} > 20", "color('#223bc3')"],
["true", "color('white')"],
],
Expand Down Expand Up @@ -225,10 +210,8 @@
const feature = scene.pick(movement.endPosition);
const featurePicked = feature instanceof Cesium.Cesium3DTileFeature;

const isTerrainFeature =
featurePicked && feature.hasProperty("substrates");
const isBuildingFeature =
featurePicked && feature.hasProperty("HGT");
const isTerrainFeature = featurePicked && feature.hasProperty("substrates");
const isBuildingFeature = featurePicked && feature.hasProperty("HGT");

if (isTerrainFeature) {
metadataOverlay.style.display = "block";
Expand Down Expand Up @@ -290,10 +273,7 @@

// Save the selected feature's original color
if (feature === highlighted.feature) {
Cesium.Color.clone(
highlighted.originalColor,
selected.originalColor
);
Cesium.Color.clone(highlighted.originalColor, selected.originalColor);
highlighted.feature = undefined;
} else {
Cesium.Color.clone(feature.color, selected.originalColor);
Expand All @@ -303,8 +283,7 @@
tableHtmlScratch = "<table class='cesium-infoBox-defaultTable'>";
tableHtmlScratch +=
"<tr><th>Property Name</th><th>ID</th><th>Type</th><th>Value</th></tr><tbody>";
const metadataClass =
feature.content.batchTable._propertyTable.class;
const metadataClass = feature.content.batchTable._propertyTable.class;
const propertyIds = feature.getPropertyIds();
const length = propertyIds.length;
for (let i = 0; i < length; ++i) {
Expand Down Expand Up @@ -384,22 +363,13 @@

try {
// 3D Tiles 1.1 converted from CDB of Aden, Yemen (CDB provided by Presagis)
const terrainTileset = await Cesium.Cesium3DTileset.fromIonAssetId(
2389063
);
const terrainTileset = await Cesium.Cesium3DTileset.fromIonAssetId(2389063);
viewer.scene.primitives.add(terrainTileset);
const buildingsTileset = await Cesium.Cesium3DTileset.fromIonAssetId(
2389064,
{
maximumScreenSpaceError: 12,
}
);
const buildingsTileset = await Cesium.Cesium3DTileset.fromIonAssetId(2389064, {
maximumScreenSpaceError: 12,
});
viewer.scene.primitives.add(buildingsTileset);
const center = Cesium.Cartesian3.fromDegrees(
45.04192,
12.753525,
2000
);
const center = Cesium.Cartesian3.fromDegrees(45.04192, 12.753525, 2000);

viewer.camera.flyTo({
duration: 0,
Expand Down Expand Up @@ -441,17 +411,15 @@
}

Sandcastle.addToolbarMenu(locations);
Sandcastle.addToggleButton(
"Enable terrain picking",
enablePicking,
function (checked) {
if (enablePicking) {
metadataOverlay.style.display = "none";
}

enablePicking = checked;
Sandcastle.addToggleButton("Enable terrain picking", enablePicking, function (
checked
) {
if (enablePicking) {
metadataOverlay.style.display = "none";
}
);

enablePicking = checked;
});

//Sandcastle_End
};
Expand Down
Loading

0 comments on commit 4a868aa

Please sign in to comment.