Przeglądaj źródła

Merge branch 'master' of github.com:NASA-AMMOS/3DTilesRendererJS

Garrett Johnson 5 lat temu
rodzic
commit
11a1460355

+ 197 - 2
TESTCASES.md

@@ -2,6 +2,201 @@
 
 Series of manually performed test cases for scenarios that are difficult / not feasible to test in an automated fashion.
 
-## Tests
+## Verify all sibling tiles load when loadSiblings = true
 
-TODO
+#### steps
+
+1. Open the kitchen sink example.
+1. Ensure `loadSiblings` is enabled.
+1. Ensure `displayActiveTiles` is enabled.
+1. Zoom in as much as possible so much of the tileset is not visible.
+1. Wait until all tiles have loaded.
+1. Disable the `enableUpdate` option.
+1. Zoom out to view the whole tileset.
+
+#### expected
+
+Tiles are displayed all the way out to the edge of the tileset.
+
+## Verify sibling tiles do _not_ load when loadSiblings = false
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Ensure `loadSiblings` is disabled.
+1. Ensure `displayActiveTiles` is enabled.
+1. Zoom in as much as possible so much of the tileset is not visible.
+1. Wait until all tiles have loaded.
+1. Disable the `enableUpdate` option.
+1. Zoom out to view the whole tileset.
+
+#### expected
+
+Only tiles that were visible when zoomed in are displayed.
+
+## Verify that active tiles render when displayActiveTiles = true
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Ensure `loadSiblings` is enabled.
+1. Ensure `displayActiveTiles` is enabled.
+1. Zoom in as much as possible so much of the tileset is not visible.
+1. Wait until all tiles have loaded.
+1. Disable the `enableUpdate` option.
+1. Zoom out to view the whole tileset.
+
+#### expected
+
+Tiles are displayed all the way out to the edge of the tileset but they are not when `displayActiveTiles` is false.
+
+## Verify tiles load up to errorTarget option
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Open the Javascript console.
+1. Ensure `errorTarget` is set to `6`.
+1. Enable `SCREEN_ERROR` color mode.
+1. Zoom to various levels.
+1. Click on tiles to view current screen space error in the console.
+
+#### expected
+
+No tiles are above the 6.0 error target threshold.
+
+## Verify parent tiles do not load outside of the errorThreshold option
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Set error target to 2.
+1. Set error threshold to 6.
+1. Open the javascript console.
+1. Hit "reload".
+1. Inspect the tileset using the following script:
+
+```js
+tiles.traverse( tile => {
+
+  let str = new Array( tile.__depth + 1 ).join( '  ' );
+  str += tile.__error.toFixed( 2 );
+  str += ' : ';
+  str += tile.__loadingState;
+  console.log( str )
+	return tile.__isLeaf;
+
+} );
+```
+
+#### expected
+
+Verify that no parent tiles have loaded ( `__loadingState = 0` ) if they have a threshold above 18 ( `( target + 1 ) * threshold` ).
+
+## Verify tiles do not display past the maxDepth threshold
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Open the Javascript console.
+1. Ensure `maxDepth` is set to `2`.
+1. Enable `DEPTH` color mode.
+1. Click on tiles to view current depth in the console.
+
+#### expected
+
+No tiles are above or equal to the 2 max depth value.
+
+## Verify that tiles do not change when update() is not called
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Zoom all the way in.
+1. Disable the `enableUpdate` option.
+1. Zoom out.
+
+#### expected
+
+Verify tiles no longer update with the camera view.
+
+## Verify tiles are only displayed within the camera frustum.
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Enable the third person camera view.
+1. Zoom in the main view so part of the tileset is cut off.
+
+#### expected
+
+Verify only tiles in view of the frustum are displayed in the third person camera view.
+
+## Verify that multiple cameras are taken into account when calculating error
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Enable the third person camera view.
+1. Enable the second camera view.
+1. Enable `GEOMETRIC_ERROR` color mode.
+1. Zoom in the both cameras on opposite sides of the terrain so part of the tileset is cut off.
+
+#### expected
+
+Verify only tiles in view of both cameras frustums are displayed in the third person camera view and that tiles nearest the cameras have the lowest geometric error.
+
+## Verify that raycasting works as expected
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Enable raycasting.
+1. Hover over the surface of the terrain.
+1. Repeat with firstHitOnly = false.
+
+#### expected
+
+Verify the hit marker is on the point under the mouse and that the normal lines up with the surface.
+
+## Verify that raycasting works as expected with maxDepth = 0
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Enable raycasting.
+1. Set max depth option to 0.
+1. Hover over the surface of the terrain.
+1. Repeat with firstHitOnly = false.
+
+#### expected
+
+Verify the hit marker is on the point under the mouse and that the normal lines up with the surface.
+
+## Verify debug bounds display when displayBoxBounds = true
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Enable display box bounds option.
+1. Move the camera around and zoom in and out.
+
+#### expected
+
+Verify the boxes change with the level of detail of the terrain.
+
+## Verify it does not pop to higher lod on zoom out
+
+#### steps
+
+1. Open the kitchen sink example.
+1. Set the error target to 2.
+1. Set the error threshold to 6.
+1. Zoom in all the way.
+1. Click rebuild.
+1. Wait for all tiles to load.
+1. Set the error threshold to 1000 (or zoom out).
+
+#### expected
+
+Verify the display does not change and the tiles to not disappear while parent tiles load.

+ 3 - 2
example/bundle/customMaterial.dd39ecee.js

@@ -39502,8 +39502,9 @@ function raycastTraverseFirstHit(root, group, activeTiles, raycaster) {
         _hitArray.sort(distanceSort);
       }
 
+      const res = _hitArray[0];
       _hitArray.length = 0;
-      return _hitArray[0];
+      return res;
     } else {
       return null;
     }
@@ -44863,7 +44864,7 @@ var parent = module.bundle.parent;
 if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
   var hostname = "" || location.hostname;
   var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
-  var ws = new WebSocket(protocol + '://' + hostname + ':' + "65167" + '/');
+  var ws = new WebSocket(protocol + '://' + hostname + ':' + "55097" + '/');
 
   ws.onmessage = function (event) {
     checkedAssets = {};

Plik diff jest za duży
+ 1 - 1
example/bundle/customMaterial.dd39ecee.js.map


+ 1 - 1
example/bundle/customMaterial.js

@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
 if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
   var hostname = "" || location.hostname;
   var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
-  var ws = new WebSocket(protocol + '://' + hostname + ':' + "65167" + '/');
+  var ws = new WebSocket(protocol + '://' + hostname + ':' + "55097" + '/');
 
   ws.onmessage = function (event) {
     checkedAssets = {};

Plik diff jest za duży
+ 1 - 1
example/bundle/customMaterial.js.map


Plik diff jest za duży
+ 13 - 6
example/bundle/example.e31bb0bc.js


Plik diff jest za duży
+ 1 - 1
example/bundle/example.e31bb0bc.js.map


+ 1 - 1
example/bundle/index.js

@@ -212,7 +212,7 @@ var parent = module.bundle.parent;
 if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
   var hostname = "" || location.hostname;
   var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
-  var ws = new WebSocket(protocol + '://' + hostname + ':' + "65167" + '/');
+  var ws = new WebSocket(protocol + '://' + hostname + ':' + "55097" + '/');
 
   ws.onmessage = function (event) {
     checkedAssets = {};

Plik diff jest za duży
+ 1 - 1
example/bundle/index.js.map


+ 8 - 4
example/index.js

@@ -32,6 +32,9 @@ import { BufferGeometryUtils } from 'three/examples/jsm/utils/BufferGeometryUtil
 import * as dat from 'three/examples/jsm/libs/dat.gui.module.js';
 import Stats from 'three/examples/jsm/libs/stats.module.js';
 
+const ALL_HITS = 1;
+const FIRST_HIT_ONLY = 2;
+
 let camera, controls, scene, renderer, tiles, cameraHelper;
 let thirdPersonCamera, thirdPersonRenderer, thirdPersonControls;
 let secondRenderer, secondCameraHelper, secondControls, secondCamera;
@@ -44,7 +47,7 @@ let statsContainer, stats;
 let params = {
 
 	'enableUpdate': true,
-	'enableRaycast': false,
+	'raycast': NONE,
 	'enableCacheDisplay': false,
 	'orthographic': false,
 
@@ -248,7 +251,7 @@ function init() {
 		}
 
 	} );
-	exampleOptions.add( params, 'enableRaycast' );
+	exampleOptions.add( params, 'raycast', { NONE, ALL_HITS, FIRST_HIT_ONLY } );
 	exampleOptions.add( params, 'enableCacheDisplay' );
 	exampleOptions.open();
 
@@ -463,7 +466,7 @@ function animate() {
 
 	}
 
-	if ( params.enableRaycast && lastHoveredElement !== null ) {
+	if ( parseFloat( params.raycast ) !== NONE && lastHoveredElement !== null ) {
 
 		if ( lastHoveredElement === renderer.domElement ) {
 
@@ -475,7 +478,8 @@ function animate() {
 
 		}
 
-		raycaster.firstHitOnly = true;
+		raycaster.firstHitOnly = parseFloat( params.raycast ) === FIRST_HIT_ONLY;
+
 		const results = raycaster.intersectObject( tiles.group, true );
 		if ( results.length ) {
 

+ 3 - 1
src/three/raycastTraverse.js

@@ -35,6 +35,7 @@ export function raycastTraverseFirstHit( root, group, activeTiles, raycaster ) {
 	if ( activeTiles.has( root ) ) {
 
 		intersectTileScene( root.cached.scene, raycaster, _hitArray );
+
 		if ( _hitArray.length > 0 ) {
 
 			if ( _hitArray.length > 1 ) {
@@ -43,8 +44,9 @@ export function raycastTraverseFirstHit( root, group, activeTiles, raycaster ) {
 
 			}
 
+			const res = _hitArray[ 0 ];
 			_hitArray.length = 0;
-			return _hitArray[ 0 ];
+			return res;
 
 		} else {