@@ -41,8 +41,12 @@ export class DebugTilesRenderer extends TilesRenderer {
4141 this . maxDebugDepth = - 1 ;
4242 this . maxDebugDistance = - 1 ;
4343 this . maxDebugError = - 1 ;
44- this . minDebugColor = new Color ( 'black' ) ;
45- this . maxDebugColor = new Color ( 'white' ) ;
44+
45+ this . getDebugColor = ( value , target ) => {
46+
47+ target . setRGB ( value , value , value ) ;
48+
49+ } ;
4650
4751 this . extremeDebugDepth = - 1 ;
4852 this . extremeDebugError = - 1 ;
@@ -194,8 +198,6 @@ export class DebugTilesRenderer extends TilesRenderer {
194198
195199 }
196200
197- const minDebugColor = this . minDebugColor ;
198- const maxDebugColor = this . maxDebugColor ;
199201 const errorTarget = this . errorTarget ;
200202 const colorMode = this . colorMode ;
201203 const visibleTiles = this . visibleTiles ;
@@ -263,14 +265,14 @@ export class DebugTilesRenderer extends TilesRenderer {
263265 case DEPTH : {
264266
265267 const val = tile . __depth / maxDepth ;
266- c . material . color . copy ( minDebugColor ) . lerpHSL ( maxDebugColor , val ) ;
268+ this . getDebugColor ( val , c . material . color ) ;
267269 break ;
268270
269271 }
270272 case RELATIVE_DEPTH : {
271273
272274 const val = tile . __depthFromRenderedParent / maxDepth ;
273- c . material . color . copy ( minDebugColor ) . lerpHSL ( maxDebugColor , val ) ;
275+ this . getDebugColor ( val , c . material . color ) ;
274276 break ;
275277
276278 }
@@ -283,7 +285,7 @@ export class DebugTilesRenderer extends TilesRenderer {
283285
284286 } else {
285287
286- c . material . color . copy ( minDebugColor ) . lerpHSL ( maxDebugColor , val ) ;
288+ this . getDebugColor ( val , c . material . color ) ;
287289
288290 }
289291 break ;
@@ -292,7 +294,7 @@ export class DebugTilesRenderer extends TilesRenderer {
292294 case GEOMETRIC_ERROR : {
293295
294296 const val = Math . min ( tile . geometricError / maxError , 1 ) ;
295- c . material . color . copy ( minDebugColor ) . lerpHSL ( maxDebugColor , val ) ;
297+ this . getDebugColor ( val , c . material . color ) ;
296298 break ;
297299
298300 }
@@ -301,19 +303,20 @@ export class DebugTilesRenderer extends TilesRenderer {
301303 // We don't update the distance if the geometric error is 0.0 so
302304 // it will always be black.
303305 const val = Math . min ( tile . __distanceFromCamera / maxDistance , 1 ) ;
304- c . material . color . copy ( minDebugColor ) . lerpHSL ( maxDebugColor , val ) ;
306+ this . getDebugColor ( val , c . material . color ) ;
305307 break ;
306308
307309 }
308310 case IS_LEAF : {
309311
310312 if ( ! tile . children || tile . children . length === 0 ) {
311313
312- c . material . color . copy ( maxDebugColor ) ;
314+ this . getDebugColor ( 1.0 , c . material . color ) ;
315+
313316
314317 } else {
315318
316- c . material . color . set ( minDebugColor ) ;
319+ this . getDebugColor ( 0.0 , c . material . color ) ;
317320
318321 }
319322 break ;
0 commit comments