From c012f20e393c108cc47c3e02904d6117081d5775 Mon Sep 17 00:00:00 2001 From: Garrett Johnson Date: Wed, 25 Dec 2024 00:04:07 +0900 Subject: [PATCH] Move debug color modes to the class --- example/index.js | 27 +---------------- src/plugins/three/DebugTilesPlugin.js | 42 ++++++++++++++++++++------- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/example/index.js b/example/index.js index c5d866898..537b10176 100644 --- a/example/index.js +++ b/example/index.js @@ -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, @@ -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' ); diff --git a/src/plugins/three/DebugTilesPlugin.js b/src/plugins/three/DebugTilesPlugin.js index 1ae061531..1f391784f 100644 --- a/src/plugins/three/DebugTilesPlugin.js +++ b/src/plugins/three/DebugTilesPlugin.js @@ -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 = {