소스 검색

Update index.js

Garrett Johnson 4 년 전
부모
커밋
ff27965b1e
1개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 10 3
      example/index.js

+ 10 - 3
example/index.js

@@ -109,9 +109,16 @@ function reinstantiateTiles() {
 	tiles.customColorCallback = ( tile, child ) => {
 
 		const depthIsEven = tile.__depth % 2 === 0;
-		const color = depthIsEven ? [ 255, 0, 0 ] : [ 255, 255, 255 ];
-
-		child.material.color.setRGB( ...color );
+		const hex = depthIsEven ? 0xff0000 : 0xffffff;
+		child.traverse( c => {
+			
+			if ( c.isMesh ) {
+			
+				c.material.color.set( hex );
+				
+			}
+			
+		} );
 
 	};