Skip to content

Commit

Permalink
Move debug color modes to the class
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson committed Dec 24, 2024
1 parent 0935e07 commit c012f20
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 37 deletions.
27 changes: 1 addition & 26 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import {
TilesRenderer,
NONE,
SCREEN_ERROR,
GEOMETRIC_ERROR,
DISTANCE,
DEPTH,
RELATIVE_DEPTH,
IS_LEAF,
RANDOM_COLOR,
RANDOM_NODE_COLOR,
CUSTOM_COLOR,
LOAD_ORDER,
} from '3d-tiles-renderer';
import {
DebugTilesPlugin,
Expand Down Expand Up @@ -278,21 +267,7 @@ function init() {
debug.add( params, 'displayBoxBounds' );
debug.add( params, 'displaySphereBounds' );
debug.add( params, 'displayRegionBounds' );
debug.add( params, 'colorMode', {

NONE,
SCREEN_ERROR,
GEOMETRIC_ERROR,
DISTANCE,
DEPTH,
RELATIVE_DEPTH,
IS_LEAF,
RANDOM_COLOR,
RANDOM_NODE_COLOR,
CUSTOM_COLOR,
LOAD_ORDER,

} );
debug.add( params, 'colorMode', DebugTilesPlugin.ColorModes );
debug.open();

const exampleOptions = gui.addFolder( 'Example Options' );
Expand Down
42 changes: 31 additions & 11 deletions src/plugins/three/DebugTilesPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,40 @@ export function getIndexedRandomColor( index ) {
}

// color modes
export const NONE = 0;
export const SCREEN_ERROR = 1;
export const GEOMETRIC_ERROR = 2;
export const DISTANCE = 3;
export const DEPTH = 4;
export const RELATIVE_DEPTH = 5;
export const IS_LEAF = 6;
export const RANDOM_COLOR = 7;
export const RANDOM_NODE_COLOR = 8;
export const CUSTOM_COLOR = 9;
export const LOAD_ORDER = 10;
const NONE = 0;
const SCREEN_ERROR = 1;
const GEOMETRIC_ERROR = 2;
const DISTANCE = 3;
const DEPTH = 4;
const RELATIVE_DEPTH = 5;
const IS_LEAF = 6;
const RANDOM_COLOR = 7;
const RANDOM_NODE_COLOR = 8;
const CUSTOM_COLOR = 9;
const LOAD_ORDER = 10;

const ColorModes = Object.freeze( {
NONE,
SCREEN_ERROR,
GEOMETRIC_ERROR,
DISTANCE,
DEPTH,
RELATIVE_DEPTH,
IS_LEAF,
RANDOM_COLOR,
RANDOM_NODE_COLOR,
CUSTOM_COLOR,
LOAD_ORDER,
} );

export class DebugTilesPlugin {

static get ColorModes() {

return ColorModes;

}

constructor( options ) {

options = {
Expand Down

0 comments on commit c012f20

Please sign in to comment.