Selaa lähdekoodia

comments, updates

Garrett Johnson 5 vuotta sitten
vanhempi
commit
fd56f1a094

+ 16 - 9
example/bundle/example.e31bb0bc.js

@@ -35297,6 +35297,8 @@ function traverseSet(tile, beforeCb = null, afterCb = null, parent = null, depth
     afterCb(tile, parent, depth);
   }
 } // TODO: include frustum mask here?
+// TODO: this is marking items as used in the lrucache, which means some data is
+// being kept around that isn't being used -- is that okay?
 
 
 function determineFrustumSet(tile, renderer) {
@@ -35507,20 +35509,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
 // TODO: See if declaring function inline improves performance
 // TODO: Make sure active state works as expected
 class TilesRendererBase {
-  get root() {
-    const tileSet = this.tileSets[this.rootSet];
+  get rootTileSet() {
+    const tileSet = this.tileSets[this.rootURL];
 
     if (!tileSet || tileSet instanceof Promise) {
       return null;
     } else {
-      return tileSet.root;
+      return tileSet;
     }
   }
 
+  get root() {
+    const tileSet = this.rootTileSet;
+    return tileSet ? tileSet.root : null;
+  }
+
   constructor(url, cache = new _LRUCache.LRUCache(), downloadQueue = new _PriorityQueue.PriorityQueue(6), parseQueue = new _PriorityQueue.PriorityQueue(1)) {
     // state
     this.tileSets = {};
-    this.rootSet = url;
+    this.rootURL = url;
     this.lruCache = cache;
     this.fetchOptions = {};
     this.downloadQueue = downloadQueue;
@@ -35543,7 +35550,7 @@ class TilesRendererBase {
 
   traverse(cb) {
     const tileSets = this.tileSets;
-    const rootTileSet = tileSets[this.rootSet];
+    const rootTileSet = tileSets[this.rootURL];
     if (!rootTileSet || !rootTileSet.root) return;
     (0, _traverseFunctions.traverseSet)(rootTileSet.root, cb);
   } // Public API
@@ -35553,10 +35560,10 @@ class TilesRendererBase {
     const stats = this.stats;
     const lruCache = this.lruCache;
     const tileSets = this.tileSets;
-    const rootTileSet = tileSets[this.rootSet];
+    const rootTileSet = tileSets[this.rootURL];
 
-    if (!(this.rootSet in tileSets)) {
-      this.loadTileSet(this.rootSet);
+    if (!(this.rootURL in tileSets)) {
+      this.loadTileSet(this.rootURL);
       return;
     } else if (!rootTileSet || !rootTileSet.root) {
       return;
@@ -43837,7 +43844,7 @@ function render() {
   });
   const cacheFullness = tiles.lruCache.itemList.length / tiles.lruCache.minSize;
   statsContainer.innerHTML = `
-			Downloading: ${tiles.stats.downloading} Parsing: ${tiles.stats.parsing} Visible: ${tiles.group.children.length}
+			Downloading: ${tiles.stats.downloading} Parsing: ${tiles.stats.parsing} Visible: ${tiles.group.children.length - 2}
 			<br/>
 			Cache: ${(100 * cacheFullness).toFixed(2)}% ~${(count / 1000 / 1000).toFixed(2)}mb
 		`;

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
example/bundle/example.e31bb0bc.js.map


+ 1 - 1
example/index.js

@@ -458,7 +458,7 @@ function render() {
 	const cacheFullness = tiles.lruCache.itemList.length / tiles.lruCache.minSize;
 	statsContainer.innerHTML =
 		`
-			Downloading: ${ tiles.stats.downloading } Parsing: ${ tiles.stats.parsing } Visible: ${ tiles.group.children.length }
+			Downloading: ${ tiles.stats.downloading } Parsing: ${ tiles.stats.parsing } Visible: ${ tiles.group.children.length - 2 }
 			<br/>
 			Cache: ${ ( 100 * cacheFullness ).toFixed( 2 ) }% ~${ ( count / 1000 / 1000 ).toFixed( 2 ) }mb
 		`;

+ 15 - 8
src/base/TilesRendererBase.js

@@ -13,26 +13,33 @@ import { UNLOADED, LOADING, PARSING, LOADED, FAILED } from './constants.js';
 
 export class TilesRendererBase {
 
-	get root() {
+	get rootTileSet() {
 
-		const tileSet = this.tileSets[ this.rootSet ];
+		const tileSet = this.tileSets[ this.rootURL ];
 		if ( ! tileSet || tileSet instanceof Promise ) {
 
 			return null;
 
 		} else {
 
-			return tileSet.root;
+			return tileSet;
 
 		}
 
 	}
 
+	get root() {
+
+		const tileSet = this.rootTileSet;
+		return tileSet ? tileSet.root : null;
+
+	}
+
 	constructor( url, cache = new LRUCache(), downloadQueue = new PriorityQueue( 6 ), parseQueue = new PriorityQueue( 1 ) ) {
 
 		// state
 		this.tileSets = {};
-		this.rootSet = url;
+		this.rootURL = url;
 		this.lruCache = cache;
 		this.fetchOptions = {};
 
@@ -59,7 +66,7 @@ export class TilesRendererBase {
 	traverse( cb ) {
 
 		const tileSets = this.tileSets;
-		const rootTileSet = tileSets[ this.rootSet ];
+		const rootTileSet = tileSets[ this.rootURL ];
 		if ( ! rootTileSet || ! rootTileSet.root ) return;
 
 		traverseSet( rootTileSet.root, cb );
@@ -72,10 +79,10 @@ export class TilesRendererBase {
 		const stats = this.stats;
 		const lruCache = this.lruCache;
 		const tileSets = this.tileSets;
-		const rootTileSet = tileSets[ this.rootSet ];
-		if ( ! ( this.rootSet in tileSets ) ) {
+		const rootTileSet = tileSets[ this.rootURL ];
+		if ( ! ( this.rootURL in tileSets ) ) {
 
-			this.loadTileSet( this.rootSet );
+			this.loadTileSet( this.rootURL );
 			return;
 
 		} else if ( ! rootTileSet || ! rootTileSet.root ) {

+ 2 - 0
src/base/traverseFunctions.js

@@ -71,6 +71,8 @@ export function traverseSet( tile, beforeCb = null, afterCb = null, parent = nul
 }
 
 // TODO: include frustum mask here?
+// TODO: this is marking items as used in the lrucache, which means some data is
+// being kept around that isn't being used -- is that okay?
 export function determineFrustumSet( tile, renderer ) {
 
 	const stats = renderer.stats;