DebugTilesPlugin: add boundsColorMode for independent bounds coloring#1489
Conversation
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
d8f5ae5 to
fc9f080
Compare
| this._boundsColorMode = v; | ||
|
|
||
| if ( v === NONE ) { | ||
|
|
||
| this._resetBoundsColors(); | ||
|
|
||
| } |
There was a problem hiding this comment.
Why not just use the same pattern as above and set "materialsNeedUpdate" to true?
There was a problem hiding this comment.
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.
| } ); | ||
|
|
||
| // update bounds helper colors | ||
| if ( boundsColorMode !== NONE ) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Are these commits pushed? I'm not seeing it in the diff
There was a problem hiding this comment.
Sorry. My bad. Pushed now
| const tile = helper.userData.tile; | ||
| if ( ! tile ) continue; |
There was a problem hiding this comment.
What's the situation where this will not be present?
There was a problem hiding this comment.
It shouldn't happen. userData.tile is always set in _createBoundHelper. Removed the guard
|
Looks great, thanks! |
Summary
Adds a
boundsColorModeproperty toDebugTilesPluginthat accepts all the sameoptions as
colorMode, but applies them to bounding volume helpers (box, sphere,region) instead of tile materials.
applyColor()function handles color logic for bothcolorModeandboundsColorMode, avoiding redundancyNONE— existing depth-based random colors preservedCloses #1488.
Test plan
npm testpasses (1177 tests)boundsColorModeto various modes withdisplayBoxBounds: true. Bounds reflect chosen color mode, tile materials remain untouched