Skip to content

Commit e531bd1

Browse files
committed
fix RANDOM_NODE_COLOR
1 parent 438f67c commit e531bd1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
RELATIVE_DEPTH,
99
IS_LEAF,
1010
RANDOM_COLOR,
11+
RANDOM_NODE_COLOR,
1112
} from './three/DebugTilesRenderer.js';
1213
import { TilesRenderer } from './three/TilesRenderer.js';
1314
import { B3DMLoader } from './three/B3DMLoader.js';
@@ -49,4 +50,5 @@ export {
4950
RELATIVE_DEPTH,
5051
IS_LEAF,
5152
RANDOM_COLOR,
53+
RANDOM_NODE_COLOR,
5254
};

src/three/DebugTilesRenderer.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { SphereHelper } from './SphereHelper.js';
55

66
const ORIGINAL_MATERIAL = Symbol( 'ORIGINAL_MATERIAL' );
77
const HAS_RANDOM_COLOR = Symbol( 'HAS_RANDOM_COLOR' );
8+
const HAS_RANDOM_NODE_COLOR = Symbol( 'HAS_RANDOM_NODE_COLOR' );
89

910
function emptyRaycast() {}
1011

@@ -253,12 +254,18 @@ export class DebugTilesRenderer extends TilesRenderer {
253254

254255
}
255256

256-
if ( colorMode !== RANDOM_COLOR && colorMode !== RANDOM_NODE_COLOR ) {
257+
if ( colorMode !== RANDOM_COLOR ) {
257258

258259
delete c.material[ HAS_RANDOM_COLOR ];
259260

260261
}
261262

263+
if ( colorMode !== RANDOM_NODE_COLOR ) {
264+
265+
delete c.material[ HAS_RANDOM_NODE_COLOR ];
266+
267+
}
268+
262269
// Set the color on the basic material
263270
switch ( colorMode ) {
264271

@@ -324,10 +331,10 @@ export class DebugTilesRenderer extends TilesRenderer {
324331
}
325332
case RANDOM_NODE_COLOR: {
326333

327-
if ( ! c.material[ HAS_RANDOM_COLOR ] ) {
334+
if ( ! c.material[ HAS_RANDOM_NODE_COLOR ] ) {
328335

329336
c.material.color.setHSL( h, s, l );
330-
c.material[ HAS_RANDOM_COLOR ] = true;
337+
c.material[ HAS_RANDOM_NODE_COLOR ] = true;
331338

332339
}
333340
break;

0 commit comments

Comments
 (0)