Skip to content

DebugTilesPlugin: add boundsColorMode for independent bounds coloring#1489

Merged
gkjohnson merged 2 commits intoNASA-AMMOS:masterfrom
diegomazala:1488-leaf-bbox-white-color
Mar 16, 2026
Merged

DebugTilesPlugin: add boundsColorMode for independent bounds coloring#1489
gkjohnson merged 2 commits intoNASA-AMMOS:masterfrom
diegomazala:1488-leaf-bbox-white-color

Conversation

@diegomazala
Copy link
Copy Markdown
Contributor

@diegomazala diegomazala commented Feb 28, 2026

Summary

Adds a boundsColorMode property to DebugTilesPlugin that accepts all the same
options as colorMode, but applies them to bounding volume helpers (box, sphere,
region) instead of tile materials.

  • Shared applyColor() function handles color logic for both colorMode and
    boundsColorMode, avoiding redundancy
  • Defaults to NONE — existing depth-based random colors preserved
  • No breaking changes, no new dependencies

Closes #1488.

Test plan

  • npm test passes (1177 tests)
  • Visual: set boundsColorMode to various modes with displayBoxBounds: true. Bounds reflect chosen color mode, tile materials remain untouched

@diegomazala diegomazala changed the title DebugTilesPlugin: color leaf tile bounding boxes in white DebugTilesPlugin: color leaf tile bounding volumes in white Feb 28, 2026
Add a boundsColorMode property that accepts the same color modes as
colorMode but applies them to bounding box, sphere, and region helpers
independently. This allows visualizing debug info on bounds wireframes
without replacing tile materials, preserving custom shaders.

Extract shared color logic into a local closure to avoid duplicating
the switch block between tile materials and bounds helpers.

Closes NASA-AMMOS#1488
@diegomazala diegomazala force-pushed the 1488-leaf-bbox-white-color branch from d8f5ae5 to fc9f080 Compare March 14, 2026 13:02
@diegomazala diegomazala changed the title DebugTilesPlugin: color leaf tile bounding volumes in white DebugTilesPlugin: add boundsColorMode for independent bounds coloring Mar 14, 2026
Comment thread src/three/plugins/DebugTilesPlugin.js Outdated
Comment on lines +113 to +119
this._boundsColorMode = v;

if ( v === NONE ) {

this._resetBoundsColors();

}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use the same pattern as above and set "materialsNeedUpdate" to true?

Copy link
Copy Markdown
Contributor Author

@diegomazala diegomazala Mar 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The setter now follows the same pattern as colorMode and unlit. No special-case logic needed since the bounds color loop in update() runs unconditionally now.

Comment thread src/three/plugins/DebugTilesPlugin.js Outdated
} );

// update bounds helper colors
if ( boundsColorMode !== NONE ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just create a special INDEXED_COLOR flag that we can pass into the "applyColor" function when NONE is set rather than relying on on "_resetBoundsColors"? Then we can get rid of that function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an INDEXED_COLOR case to applyColor and mapped boundsColorMode === NONE to it. The bounds color loop now runs unconditionally through the same path. Removed _resetBoundsColors.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these commits pushed? I'm not seeing it in the diff

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. My bad. Pushed now

Comment thread src/three/plugins/DebugTilesPlugin.js Outdated
Comment on lines +648 to +649
const tile = helper.userData.tile;
if ( ! tile ) continue;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the situation where this will not be present?

Copy link
Copy Markdown
Contributor Author

@diegomazala diegomazala Mar 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't happen. userData.tile is always set in _createBoundHelper. Removed the guard

@gkjohnson
Copy link
Copy Markdown
Contributor

Looks great, thanks!

@gkjohnson gkjohnson merged commit 96a109a into NASA-AMMOS:master Mar 16, 2026
1 check passed
@gkjohnson gkjohnson added this to the v0.4.23 milestone Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DebugTilesPlugin: color leaf tile bounding boxes in white

2 participants