瀏覽代碼

Merge pull request #119 from liberostelios/feature/calculate-errors-empty

Add option to show empty tiles
Garrett Johnson 4 年之前
父節點
當前提交
963208cffe
共有 6 個文件被更改,包括 25 次插入3 次删除
  1. 17 1
      TESTCASES.md
  2. 3 0
      example/index.js
  3. 1 0
      src/base/TilesRendererBase.d.ts
  4. 1 0
      src/base/TilesRendererBase.js
  5. 2 1
      src/base/traverseFunctions.js
  6. 1 1
      src/utilities/FeatureTable.js

+ 17 - 1
TESTCASES.md

@@ -274,7 +274,7 @@ Verify no errors are logged.
 
 
 Verify that the stats display 125 geometries, 126 textures, and 1 programs.
 Verify that the stats display 125 geometries, 126 textures, and 1 programs.
 
 
-## Verify maxDepth limit does not stop at empty tiles
+## Verify stopAtEmptyTiles works
 
 
 #### steps
 #### steps
 
 
@@ -283,6 +283,20 @@ Verify that the stats display 125 geometries, 126 textures, and 1 programs.
 1. Verify that only 1 tile is visible.
 1. Verify that only 1 tile is visible.
 1. Open the kitchen sink example with the no root content tileset by navigating [here](https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/#../data/tileset-no-root-content.json).
 1. Open the kitchen sink example with the no root content tileset by navigating [here](https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/#../data/tileset-no-root-content.json).
 1. Set `maxDepth` to 1.
 1. Set `maxDepth` to 1.
+1. Verify that all tiles disappear.
+
+#### expected
+
+No tiles are visible when the active leafs have no content.
+
+## Verify maxDepth limit does not stop at empty tiles when stopAtEmptyTiles = false
+
+1. Open the kitchen sink example by navigating [here](https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/).
+1. Set `maxDepth` to 1.
+1. Verify that only 1 tile is visible.
+1. Open the kitchen sink example with the no root content tileset by navigating [here](https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/#../data/tileset-no-root-content.json).
+1. Disable `stopAtEmptyTiles`.
+1. Set `maxDepth` to 1.
 1. Verify that 4 tiles are visible.
 1. Verify that 4 tiles are visible.
 
 
 #### expected
 #### expected
@@ -298,6 +312,8 @@ The next shallowest tiles are visible past the `maxDepth` cutoff.
 1. Set `errorTarget` to 0.
 1. Set `errorTarget` to 0.
 1. Set `maxDepth` to 3.
 1. Set `maxDepth` to 3.
 1. Set `colorMode` to `RANDOM_COLOR`.
 1. Set `colorMode` to `RANDOM_COLOR`.
+1. Verify that one tile is missing.
+1. Disable `stopAtEmptyTiles`.
 1. Verify that there are four smaller tiles compared to the rest of the tileset where the missing midtile with content is.
 1. Verify that there are four smaller tiles compared to the rest of the tileset where the missing midtile with content is.
 
 
 #### expected
 #### expected

+ 3 - 0
example/index.js

@@ -58,6 +58,7 @@ let params = {
 	'errorThreshold': 60,
 	'errorThreshold': 60,
 	'maxDepth': 15,
 	'maxDepth': 15,
 	'loadSiblings': true,
 	'loadSiblings': true,
+	'stopAtEmptyTiles': true,
 	'displayActiveTiles': false,
 	'displayActiveTiles': false,
 	'resolutionScale': 1.0,
 	'resolutionScale': 1.0,
 
 
@@ -231,6 +232,7 @@ function init() {
 
 
 	const tileOptions = gui.addFolder( 'Tiles Options' );
 	const tileOptions = gui.addFolder( 'Tiles Options' );
 	tileOptions.add( params, 'loadSiblings' );
 	tileOptions.add( params, 'loadSiblings' );
+	tileOptions.add( params, 'stopAtEmptyTiles' );
 	tileOptions.add( params, 'displayActiveTiles' );
 	tileOptions.add( params, 'displayActiveTiles' );
 	tileOptions.add( params, 'errorTarget' ).min( 0 ).max( 50 );
 	tileOptions.add( params, 'errorTarget' ).min( 0 ).max( 50 );
 	tileOptions.add( params, 'errorThreshold' ).min( 0 ).max( 1000 );
 	tileOptions.add( params, 'errorThreshold' ).min( 0 ).max( 1000 );
@@ -442,6 +444,7 @@ function animate() {
 	tiles.errorTarget = params.errorTarget;
 	tiles.errorTarget = params.errorTarget;
 	tiles.errorThreshold = params.errorThreshold;
 	tiles.errorThreshold = params.errorThreshold;
 	tiles.loadSiblings = params.loadSiblings;
 	tiles.loadSiblings = params.loadSiblings;
+	tiles.stopAtEmptyTiles = params.stopAtEmptyTiles;
 	tiles.displayActiveTiles = params.displayActiveTiles;
 	tiles.displayActiveTiles = params.displayActiveTiles;
 	tiles.maxDepth = params.maxDepth;
 	tiles.maxDepth = params.maxDepth;
 	tiles.displayBoxBounds = params.displayBoxBounds;
 	tiles.displayBoxBounds = params.displayBoxBounds;

+ 1 - 0
src/base/TilesRendererBase.d.ts

@@ -11,6 +11,7 @@ export class TilesRendererBase {
 	loadSiblings : Boolean;
 	loadSiblings : Boolean;
 	displayActiveTiles : Boolean;
 	displayActiveTiles : Boolean;
 	maxDepth : Number;
 	maxDepth : Number;
+	stopAtEmptyTiles : Boolean;
 
 
 	fetchOptions : Object;
 	fetchOptions : Object;
 
 

+ 1 - 0
src/base/TilesRendererBase.js

@@ -70,6 +70,7 @@ export class TilesRendererBase {
 		this.loadSiblings = true;
 		this.loadSiblings = true;
 		this.displayActiveTiles = false;
 		this.displayActiveTiles = false;
 		this.maxDepth = Infinity;
 		this.maxDepth = Infinity;
+		this.stopAtEmptyTiles = true;
 
 
 	}
 	}
 
 

+ 2 - 1
src/base/traverseFunctions.js

@@ -118,6 +118,7 @@ export function determineFrustumSet( tile, renderer ) {
 	const maxDepth = renderer.maxDepth;
 	const maxDepth = renderer.maxDepth;
 	const loadSiblings = renderer.loadSiblings;
 	const loadSiblings = renderer.loadSiblings;
 	const lruCache = renderer.lruCache;
 	const lruCache = renderer.lruCache;
+	const stopAtEmptyTiles = renderer.stopAtEmptyTiles;
 	resetFrameState( tile, frameCount );
 	resetFrameState( tile, frameCount );
 
 
 	// Early out if this tile is not within view.
 	// Early out if this tile is not within view.
@@ -135,7 +136,7 @@ export function determineFrustumSet( tile, renderer ) {
 	stats.inFrustum ++;
 	stats.inFrustum ++;
 
 
 	// Early out if this tile has less error than we're targeting.
 	// Early out if this tile has less error than we're targeting.
-	if ( ! tile.__contentEmpty ) {
+	if ( stopAtEmptyTiles || ! tile.__contentEmpty ) {
 
 
 		const error = renderer.calculateError( tile );
 		const error = renderer.calculateError( tile );
 		tile.__error = error;
 		tile.__error = error;

+ 1 - 1
src/utilities/FeatureTable.js

@@ -55,7 +55,7 @@ export class FeatureTable {
 			const featureType = feature.type || defaultType;
 			const featureType = feature.type || defaultType;
 			const featureComponentType = feature.componentType || defaultComponentType;
 			const featureComponentType = feature.componentType || defaultComponentType;
 
 
-			if ( 'type' in feature && defaultType && feature.type !== defaultType) {
+			if ( 'type' in feature && defaultType && feature.type !== defaultType ) {
 
 
 				throw new Error( 'FeatureTable: Specified type does not match expected type.' );
 				throw new Error( 'FeatureTable: Specified type does not match expected type.' );