Przeglądaj źródła

fix RANDOM_NODE_COLOR

Garrett Johnson 4 lat temu
rodzic
commit
e531bd1b36
2 zmienionych plików z 12 dodań i 3 usunięć
  1. 2 0
      src/index.js
  2. 10 3
      src/three/DebugTilesRenderer.js

+ 2 - 0
src/index.js

@@ -8,6 +8,7 @@ import {
 	RELATIVE_DEPTH,
 	IS_LEAF,
 	RANDOM_COLOR,
+	RANDOM_NODE_COLOR,
 } from './three/DebugTilesRenderer.js';
 import { TilesRenderer } from './three/TilesRenderer.js';
 import { B3DMLoader } from './three/B3DMLoader.js';
@@ -49,4 +50,5 @@ export {
 	RELATIVE_DEPTH,
 	IS_LEAF,
 	RANDOM_COLOR,
+	RANDOM_NODE_COLOR,
 };

+ 10 - 3
src/three/DebugTilesRenderer.js

@@ -5,6 +5,7 @@ import { SphereHelper } from './SphereHelper.js';
 
 const ORIGINAL_MATERIAL = Symbol( 'ORIGINAL_MATERIAL' );
 const HAS_RANDOM_COLOR = Symbol( 'HAS_RANDOM_COLOR' );
+const HAS_RANDOM_NODE_COLOR = Symbol( 'HAS_RANDOM_NODE_COLOR' );
 
 function emptyRaycast() {}
 
@@ -253,12 +254,18 @@ export class DebugTilesRenderer extends TilesRenderer {
 
 					}
 
-					if ( colorMode !== RANDOM_COLOR && colorMode !== RANDOM_NODE_COLOR ) {
+					if ( colorMode !== RANDOM_COLOR ) {
 
 						delete c.material[ HAS_RANDOM_COLOR ];
 
 					}
 
+					if ( colorMode !== RANDOM_NODE_COLOR ) {
+
+						delete c.material[ HAS_RANDOM_NODE_COLOR ];
+
+					}
+
 					// Set the color on the basic material
 					switch ( colorMode ) {
 
@@ -324,10 +331,10 @@ export class DebugTilesRenderer extends TilesRenderer {
 						}
 						case RANDOM_NODE_COLOR: {
 
-							if ( ! c.material[ HAS_RANDOM_COLOR ] ) {
+							if ( ! c.material[ HAS_RANDOM_NODE_COLOR ] ) {
 
 								c.material.color.setHSL( h, s, l );
-								c.material[ HAS_RANDOM_COLOR ] = true;
+								c.material[ HAS_RANDOM_NODE_COLOR ] = true;
 
 							}
 							break;