Skip to content

Commit

Permalink
Adjust type info to fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeshurun Hembd committed Jan 8, 2025
1 parent a91a15a commit 639f532
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 37 deletions.
139 changes: 121 additions & 18 deletions packages/engine/Source/Scene/Cesium3DTilesVoxelProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,46 +49,137 @@ import ComponentDatatype from "../Core/ComponentDatatype.js";
function Cesium3DTilesVoxelProvider(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

/** @inheritdoc */
/**
* A transform from shape space to local space. If undefined, the identity matrix will be used instead.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {Matrix4|undefined}
* @readonly
*/
this.shapeTransform = undefined;

/** @inheritdoc */
/**
* A transform from local space to global space. If undefined, the identity matrix will be used instead.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {Matrix4|undefined}
* @readonly
*/
this.globalTransform = undefined;

/** @inheritdoc */
/**
* Gets the {@link VoxelShapeType}
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {VoxelShapeType}
* @readonly
*/
this.shape = undefined;

/** @inheritdoc */
/**
* Gets the minimum bounds.
* If undefined, the shape's default minimum bounds will be used instead.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {Cartesian3|undefined}
* @readonly
*/
this.minBounds = undefined;

/** @inheritdoc */
/**
* Gets the maximum bounds.
* If undefined, the shape's default maximum bounds will be used instead.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {Cartesian3|undefined}
* @readonly
*/
this.maxBounds = undefined;

/** @inheritdoc */
/**
* Gets the number of voxels per dimension of a tile.
* This is the same for all tiles in the dataset.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {Cartesian3}
* @readonly
*/
this.dimensions = undefined;

/** @inheritdoc */
/**
* Gets the number of padding voxels before the tile.
* This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {Cartesian3|undefined}
* @readonly
*/
this.paddingBefore = undefined;

/** @inheritdoc */
/**
* Gets the number of padding voxels after the tile.
* This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {Cartesian3|undefined}
* @readonly
*/
this.paddingAfter = undefined;

/** @inheritdoc */
/**
* Gets the metadata names.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {string[]}
* @readonly
*/
this.names = undefined;

/** @inheritdoc */
/**
* Gets the metadata types.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {MetadataType[]}
* @readonly
*/
this.types = undefined;

/** @inheritdoc */
/**
* Gets the metadata component types.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {MetadataComponentType[]}
* @readonly
*/
this.componentTypes = undefined;

/** @inheritdoc */
/**
* Gets the metadata minimum values.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {number[][]|undefined}
* @readonly
*/
this.minimumValues = undefined;

/** @inheritdoc */
/**
* Gets the metadata maximum values.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {number[][]|undefined}
* @readonly
*/
this.maximumValues = undefined;

/** @inheritdoc */
/**
* The maximum number of tiles that exist for this provider.
* This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory.
* If this value is not known it can be undefined.
*
* @memberof Cesium3DTilesVoxelProvider.prototype
* @type {number|undefined}
* @readonly
*/
this.maximumTileCount = undefined;

/**
Expand All @@ -104,7 +195,7 @@ function Cesium3DTilesVoxelProvider(options) {
}

/**
* Creates a {@link VoxelProvider} that fetches voxel data from a 3D Tiles tileset.
* Creates a {@link Cesium3DTilesVoxelProvider} that fetches voxel data from a 3D Tiles tileset.
*
* @param {Resource|string} url The URL to a tileset JSON file
* @returns {Promise<Cesium3DTilesVoxelProvider>} The created provider
Expand Down Expand Up @@ -390,7 +481,20 @@ async function getSubtree(provider, subtreeCoord) {
return subtree;
}

/** @inheritdoc */
/**
* Requests the data for a given tile. The data is a flattened 3D array ordered by X, then Y, then Z.
*
* @private
*
* @param {object} [options] Object with the following properties:
* @param {number} [options.tileLevel=0] The tile's level.
* @param {number} [options.tileX=0] The tile's X coordinate.
* @param {number} [options.tileY=0] The tile's Y coordinate.
* @param {number} [options.tileZ=0] The tile's Z coordinate.
* @param {FrameState} options.frameState The frame state
* @privateparam {number} [options.keyframe=0] The requested keyframe.
* @returns {Promise<Array[]>|undefined} A promise to an array of typed arrays containing the requested voxel data or undefined if there was a problem loading the data.
*/
Cesium3DTilesVoxelProvider.prototype.requestData = async function (options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
const {
Expand Down Expand Up @@ -448,14 +552,13 @@ Cesium3DTilesVoxelProvider.prototype.requestData = async function (options) {
: subtree.tileIsAvailableAtCoordinates(tileCoordinates);

if (!available) {
//console.log(`requestData: not available. isSubtreeRoot = ${isSubtreeRoot}, tileLevel = ${tileLevel}`);
return Promise.reject("Tile is not available");
}

const gltfLoader = getGltfLoader(implicitTileset, tileCoordinates);
that._gltfLoaders.push(gltfLoader);
// TODO: try / catch
await gltfLoader.load(true);
await gltfLoader.load();
gltfLoader.process(frameState);
await gltfLoader._loadResourcesPromise;
gltfLoader.process(frameState);
Expand Down
28 changes: 9 additions & 19 deletions packages/engine/Source/Scene/VoxelProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the {@link VoxelShapeType}
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {VoxelShapeType}
Expand All @@ -55,7 +54,6 @@ Object.defineProperties(VoxelProvider.prototype, {
/**
* Gets the minimum bounds.
* If undefined, the shape's default minimum bounds will be used instead.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {Cartesian3|undefined}
Expand All @@ -68,7 +66,6 @@ Object.defineProperties(VoxelProvider.prototype, {
/**
* Gets the maximum bounds.
* If undefined, the shape's default maximum bounds will be used instead.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {Cartesian3|undefined}
Expand All @@ -80,7 +77,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the number of voxels per dimension of a tile. This is the same for all tiles in the dataset.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {Cartesian3}
Expand All @@ -92,7 +88,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the number of padding voxels before the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {Cartesian3|undefined}
Expand All @@ -104,7 +99,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the number of padding voxels after the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {Cartesian3|undefined}
Expand All @@ -116,7 +110,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the metadata names.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {string[]}
Expand All @@ -128,7 +121,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the metadata types.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {MetadataType[]}
Expand All @@ -140,7 +132,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the metadata component types.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {MetadataComponentType[]}
Expand All @@ -152,7 +143,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the metadata minimum values.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {number[][]|undefined}
Expand All @@ -164,7 +154,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the metadata maximum values.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {number[][]|undefined}
Expand All @@ -175,8 +164,9 @@ Object.defineProperties(VoxelProvider.prototype, {
},

/**
* The maximum number of tiles that exist for this provider. This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory. If this value is not known it can be undefined.
* This should not be called before {@link VoxelProvider#ready} returns true.
* The maximum number of tiles that exist for this provider.
* This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory.
* If this value is not known it can be undefined.
*
* @memberof VoxelProvider.prototype
* @type {number|undefined}
Expand All @@ -188,7 +178,6 @@ Object.defineProperties(VoxelProvider.prototype, {

/**
* Gets the number of keyframes in the dataset.
* This should not be called before {@link VoxelProvider#ready} returns true.
*
* @memberof VoxelProvider.prototype
* @type {number}
Expand All @@ -200,8 +189,8 @@ Object.defineProperties(VoxelProvider.prototype, {
},

/**
* Gets the {@link TimeIntervalCollection} for the dataset, or undefined if it doesn't have timestamps.
* This should not be called before {@link VoxelProvider#ready} returns true.
* Gets the {@link TimeIntervalCollection} for the dataset,
* or undefined if it doesn't have timestamps.
*
* @memberof VoxelProvider.prototype
* @type {TimeIntervalCollection}
Expand All @@ -214,9 +203,10 @@ Object.defineProperties(VoxelProvider.prototype, {
});

/**
* Requests the data for a given tile. The data is a flattened 3D array ordered by X, then Y, then Z.
* This function should not be called before {@link VoxelProvider#ready} returns true.
* @function
* Requests the data for a given tile.
* The data is a flattened 3D array ordered by X, then Y, then Z.
*
* @private
*
* @param {object} [options] Object with the following properties:
* @param {number} [options.tileLevel=0] The tile's level.
Expand Down

0 comments on commit 639f532

Please sign in to comment.