Skip to content

Commit

Permalink
add tile visible event
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemckinstry committed Jan 15, 2025
1 parent bfe4c11 commit fcd9a9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/engine/Source/Scene/VoxelPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,22 @@ function VoxelPrimitive(options) {
*/
this.tileLoad = new Event();

/**
* This event fires once for each visible tile in a frame.
* <p>
* This event is fired during the traversal while the frame is being rendered.
*
* @type {Event}
* @default new Event()
*
* @example
* tileset.tileVisible.addEventListener(function() {
* console.log('A tile is visible.');
* });
*
*/
this.tileVisible = new Event();

/**
* The event fired to indicate that a tile's content failed to load.
* <p>
Expand Down
1 change: 1 addition & 0 deletions packages/engine/Source/Scene/VoxelTraversal.js
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,7 @@ function generateOctree(that, sampleCount, levelBlendFactor) {
} else {
// Store the leaf node information instead
// Recursion stops here because there are no renderable children
that._primitive.tileVisible.raiseEvent();
if (useLeafNodes) {
const baseIdx = leafNodeCount * 5;
const keyframeNode = node.renderableKeyframeNodePrevious;
Expand Down

0 comments on commit fcd9a9c

Please sign in to comment.