Skip to content

Commit

Permalink
PR feedback part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeshurun Hembd committed Jan 29, 2025
1 parent 3957db7 commit 078c98e
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 17 deletions.
7 changes: 5 additions & 2 deletions Apps/Sandcastle/gallery/Voxel Picking.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta name="description" content="For debugging voxel picking." />
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles" />
<meta
name="description"
content="Use the cursor to select and inspect individual voxel cells."
/>
<meta name="cesium-sandcastle-labels" content="Showcases, Voxels" />
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="module" src="../load-cesium-es6.js"></script>
Expand Down
4 changes: 2 additions & 2 deletions Apps/Sandcastle/gallery/Voxels in 3D Tiles.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta name="description" content="For debugging voxels." />
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles" />
<meta name="description" content="Load voxel datasets as 3D tiles." />
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles, Voxels" />
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script
Expand Down
7 changes: 5 additions & 2 deletions Apps/Sandcastle/gallery/Voxels.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta name="description" content="For debugging voxels." />
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles" />
<meta
name="description"
content="Render voxel primitives with different shape types."
/>
<meta name="cesium-sandcastle-labels" content="Showcases, Voxels" />
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#### Breaking Changes :mega:

- Changed behavior of `DataSourceDisplay.ready` to always stay `true` once it is initially set to `true`. [#12429](https://github.com/CesiumGS/cesium/pull/12429)
- Updated `Cesium3DTilesVoxelProvider` to load glTF tiles using the new [`EXT_primitive_voxels` extension](https://github.com/CesiumGS/glTF/pull/69). Tilesets using the previous custom JSON format are no longer supported. [#12432](https://github.com/CesiumGS/cesium/pull/12432)
- Updated `Cesium3DTilesVoxelProvider` to load glTF tiles using the new [`EXT_primitive_voxels` extension](https://github.com/CesiumGS/glTF/pull/69) to more closely align with the rest of the 3D Tiles ecosystem. Tilesets using the previous custom JSON format are no longer supported. [#12432](https://github.com/CesiumGS/cesium/pull/12432)
- Updated the `requestData` method of the `VoxelProvider` interface to return a `Promise` to a `VoxelContent`. Custom providers should now use the `VoxelContent.fromMetadataArray` method to construct the returned data object. For example:

```js
Expand Down
8 changes: 5 additions & 3 deletions packages/engine/Source/Scene/Cesium3DTilesVoxelProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,11 @@ Cesium3DTilesVoxelProvider.prototype.requestData = async function (options) {

const subtree = await getSubtree(that, subtreeCoord);
// NOTE: these two subtree methods are ONLY used by voxels!
const available = isSubtreeRoot
? subtree.childSubtreeIsAvailableAtCoordinates(tileCoordinates)
: subtree.tileIsAvailableAtCoordinates(tileCoordinates);
const isAvailable = isSubtreeRoot
? subtree.childSubtreeIsAvailableAtCoordinates
: subtree.tileIsAvailableAtCoordinates;

const available = isAvailable(tileCoordinates);

if (!available) {
return Promise.reject(
Expand Down
2 changes: 2 additions & 0 deletions packages/engine/Source/Scene/ImplicitSubtree.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ ImplicitSubtree.prototype.tileIsAvailableAtIndex = function (index) {

/**
* Check if a specific tile is available at an implicit tile coordinate
* NOTE: only used for voxels.
*
* @param {ImplicitTileCoordinates} implicitCoordinates The global coordinates of a tile
* @returns {boolean} The value of the i-th bit
Expand Down Expand Up @@ -249,6 +250,7 @@ ImplicitSubtree.prototype.childSubtreeIsAvailableAtIndex = function (index) {

/**
* Check if a specific child subtree is available at an implicit tile coordinate
* NOTE: only used for voxels.
*
* @param {ImplicitTileCoordinates} implicitCoordinates The global coordinates of a child subtree
* @returns {boolean} The value of the i-th bit
Expand Down
13 changes: 6 additions & 7 deletions packages/engine/Source/Scene/VoxelContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import MetadataType from "./MetadataType.js";

/**
* <div class="notice">
* To construct a Model, call {@link Model.fromGltfAsync}. Do not call the constructor directly.
* To construct a VoxelContent, call {@link VoxelContent.fromMetadataArray} or {@link VoxelContent.fromGltf}. Do not call the constructor directly.
* </div>
* An object representing voxel content for a {@link Cesium3DTilesVoxelProvider}.
*
Expand All @@ -26,21 +26,20 @@ import MetadataType from "./MetadataType.js";
* @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
*/
function VoxelContent(options) {
const { loader, metadata } = options;
//>>includeStart('debug', pragmas.debug);
Check.typeOf.object("options", options);
if (!defined(loader)) {
if (!defined(metadata)) {
if (!defined(options.loader)) {
if (!defined(options.metadata)) {
throw new DeveloperError("One of loader and metadata must be defined.");
}
if (!Array.isArray(metadata)) {
if (!Array.isArray(options.metadata)) {
throw new DeveloperError("metadata must be an array of TypedArrays.");
}
}
//>>includeEnd('debug');

this._loader = loader;
this._metadata = metadata;
this._loader = options.loader;
this._metadata = options.metadata;
this._resourcesLoaded = false;
this._ready = false;
}
Expand Down

0 comments on commit 078c98e

Please sign in to comment.