瀏覽代碼

Add relative depth display

Garrett Johnson 5 年之前
父節點
當前提交
83b8a4b996
共有 2 個文件被更改,包括 13 次插入4 次删除
  1. 3 2
      example/index.js
  2. 10 2
      src/three/DebugTilesRenderer.js

+ 3 - 2
example/index.js

@@ -213,8 +213,9 @@ function init() {
 		GEOMETRIC_ERROR: 2,
 		DISTANCE: 3,
 		DEPTH: 4,
-		IS_LEAF: 5,
-		RANDOM_COLOR: 6,
+		RELATIVE_DEPTH: 5,
+		IS_LEAF: 6,
+		RANDOM_COLOR: 7,
 
 	} );
 	debug.open();

+ 10 - 2
src/three/DebugTilesRenderer.js

@@ -9,8 +9,9 @@ const SCREEN_ERROR = 1;
 const GEOMETRIC_ERROR = 2;
 const DISTANCE = 3;
 const DEPTH = 4;
-const IS_LEAF = 5;
-const RANDOM_COLOR = 6;
+const RELATIVE_DEPTH = 5;
+const IS_LEAF = 6;
+const RANDOM_COLOR = 7;
 
 function emptyRaycast() {}
 
@@ -205,6 +206,13 @@ export class DebugTilesRenderer extends TilesRenderer {
 							break;
 
 						}
+						case RELATIVE_DEPTH: {5
+
+							const val = tile.__depthFromRenderedParent / maxDepth;
+							c.material.color.setRGB( val, val, val );
+							break;
+
+						}
 						case SCREEN_ERROR: {
 
 							const val = tile.__error / errorTarget;