From 169760b1afd9622549c3f0b0b363a62afd0093ea Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 20 Apr 2017 11:00:31 -0400 Subject: [PATCH 01/19] creating tile info stats section and updating labels --- Source/Scene/Cesium3DTileset.js | 112 +++++++++++-- .../Cesium3DTilesInspector.js | 11 +- .../Cesium3DTilesInspectorViewModel.js | 157 +++++++++++++++++- Specs/Scene/Cesium3DTilesetSpec.js | 44 ++--- 4 files changed, 286 insertions(+), 38 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 801e202191df..9f41ff20d747 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -401,7 +401,63 @@ define([ * @default false */ this.debugShowGeometricError = defaultValue(options.debugShowGeometricError, false); - this._geometricErrorLabels = undefined; + this._tileInfoLabels = undefined; + + /** + * This property is for debugging only; it is not optimized for production use. + *

+ * When true, draws labels to indicate the number of commands used. + *

+ * + * @type {Boolean} + * @default false + */ + this.debugShowNumberOfCommands = defaultValue(options.debugShowNumberOfCommands, false); + + /** + * This property is for debugging only; it is not optimized for production use. + *

+ * When true, draws labels to indicate the number of triangles in each tile. + *

+ * + * @type {Boolean} + * @default false + */ + this.debugShowNumberOfPoints = defaultValue(options.debugShowNumberOfPoints, false); + + + /** + * This property is for debugging only; it is not optimized for production use. + *

+ * When true, draws labels to indicate the number of triangles in each tile. + *

+ * + * @type {Boolean} + * @default false + */ + this.debugShowNumberOfTriangles = defaultValue(options.debugShowNumberOfTriangles, false); + + /** + * This property is for debugging only; it is not optimized for production use. + *

+ * When true, draws labels to indicate the texture memory usage. + *

+ * + * @type {Boolean} + * @default false + */ + this.debugShowTextureMemoryUsage = defaultValue(options.debugShowTextureMemoryUsage, false); + + /** + * This property is for debugging only; it is not optimized for production use. + *

+ * When true, draws labels to indicate the vertex memory usage. + *

+ * + * @type {Boolean} + * @default false + */ + this.debugShowVertexMemoryUsage = defaultValue(options.debugShowVertexMemoryUsage, false); /** * The event fired to indicate progress of loading new tiles. This event is fired when a new tile @@ -1848,10 +1904,10 @@ define([ var scratchCartesian2 = new Cartesian3(); - function updateGeometricErrorLabels(tileset, frameState) { + function updateTileInfoLabels(tileset, frameState) { var selectedTiles = tileset._selectedTiles; var length = selectedTiles.length; - tileset._geometricErrorLabels.removeAll(); + tileset._tileInfoLabels.removeAll(); for (var i = 0; i < length; ++i) { var tile = selectedTiles[i]; var boundingVolume = tile._boundingVolume.boundingVolume; @@ -1868,12 +1924,43 @@ define([ normal = Cartesian3.multiplyByScalar(normal, 0.75 * radius, scratchCartesian2); position = Cartesian3.add(normal, boundingVolume.center, scratchCartesian2); } - tileset._geometricErrorLabels.add({ - text: tile.geometricError.toString(), - position: position + + var labelString = ""; + var attribCounter = 0; + + if (tileset.debugShowGeometricError) { + labelString += "\nGeometric error: " + tile.geometricError.toString(); + attribCounter++; + } + if (tileset.debugShowNumberOfCommands) { + labelString += "\nCommands: " + tileset._statistics.numberOfCommands.toString(); + attribCounter++; + } + if (tileset.debugShowTextureMemoryUsage) { + labelString += "\nTexture Memory: " + tileset._statistics.textureMemorySizeInBytes.toString(); + attribCounter++; + } + if (tileset.debugShowVertexMemoryUsage) { + labelString += "\nVertex Memory: " + tileset._statistics.vertexMemorySizeInBytes.toString(); + attribCounter++; + } + if (tileset.debugShowNumberOfPoints) { + labelString += "\nPoints: " + tile.content.pointsLength.toString(); + attribCounter++; + } + if (tileset.debugShowNumberOfTriangles) { + labelString += "\nTriangles: " + tile.content.trianglesLength.toString(); + attribCounter++; + } + tileset._tileInfoLabels.add({ + text: labelString.substring(1), + position: position, + font : (18-attribCounter).toString() + 'px sans-serif', + showBackground: true, + backgroundColor: new Color(0.165, 0.165, 0.165, 0.8) }); } - tileset._geometricErrorLabels.update(frameState); + tileset._tileInfoLabels.update(frameState); } var stencilClearCommand = new ClearCommand({ @@ -1958,13 +2045,14 @@ define([ // Number of commands added by each update above tileset._statistics.numberOfCommands = (commandList.length - numberOfInitialCommands); - if (tileset.debugShowGeometricError) { - if (!defined(tileset._geometricErrorLabels)) { - tileset._geometricErrorLabels = new LabelCollection(); + if (tileset.debugShowGeometricError || tileset.debugShowNumberOfCommands || tileset.debugShowTextureMemoryUsage + || tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles) { + if (!defined(tileset._tileInfoLabels)) { + tileset._tileInfoLabels = new LabelCollection(); } - updateGeometricErrorLabels(tileset, frameState); + updateTileInfoLabels(tileset, frameState); } else { - tileset._geometricErrorLabels = tileset._geometricErrorLabels && tileset._geometricErrorLabels.destroy(); + tileset._tileInfoLabels = tileset._tileInfoLabels && tileset._tileInfoLabels.destroy(); } } diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index e01bfdb9889b..64efe177e879 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -132,6 +132,7 @@ define([ var updatePanelContents = document.createElement('div'); var loggingPanelContents = document.createElement('div'); var stylePanelContents = document.createElement('div'); + var tileInfoPanelContents = document.createElement('div'); var properties = document.createElement('div'); properties.className = 'field-group'; @@ -152,7 +153,6 @@ define([ displayPanelContents.appendChild(makeCheckbox('showBoundingVolumes', 'Bounding Volumes')); displayPanelContents.appendChild(makeCheckbox('showContentBoundingVolumes', 'Content Volumes')); displayPanelContents.appendChild(makeCheckbox('showRequestVolumes', 'Request Volumes')); - displayPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); updatePanelContents.appendChild(makeCheckbox('freezeFrame', 'Freeze Frame')); updatePanelContents.appendChild(makeCheckbox('dynamicScreenSpaceError', 'Dynamic Screen Space Error')); @@ -196,11 +196,19 @@ define([ errorBox.setAttribute('data-bind', 'text: editorError'); stylePanelContents.appendChild(errorBox); + tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); + tileInfoPanelContents.appendChild(makeCheckbox('textureMemory', 'Texture Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('vertexMemory', 'Vertex Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfCommands', 'Number of Commands')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfPoints', 'Number Of Points')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfTriangles', 'Number Of Triangles')); + var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents); var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); var updatePanel = makeSection('Update', 'updateVisible', 'toggleUpdate', updatePanelContents); var loggingPanel = makeSection('Logging', 'loggingVisible', 'toggleLogging', loggingPanelContents); var stylePanel = makeSection('Style', 'styleVisible', 'toggleStyle', stylePanelContents); + var tileInfoPanel = makeSection('Tile Info', 'tileInfoVisible', 'toggleTileInfo', tileInfoPanelContents); // first add and bind all the toggleable panels element.appendChild(tilesetPanel); @@ -208,6 +216,7 @@ define([ element.appendChild(updatePanel); element.appendChild(loggingPanel); element.appendChild(stylePanel); + element.appendChild(tileInfoPanel); knockout.applyBindings(viewModel, element); } diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index f75f88b00db9..356278bc0b45 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -221,6 +221,15 @@ define([ */ this.styleVisible = false; + /** + * Gets or sets the flag to show the tile info section. This property is observable. + * + * @type {Boolean} + * @default false + */ + this.tileInfoVisible = false; + + /** * Gets or sets the JSON for the tileset style. This property is observable. * @@ -230,7 +239,7 @@ define([ this.styleString = '{}'; knockout.track(this, ['performance', 'inspectorVisible', '_statsText', '_pickStatsText', '_editorError', 'showPickStats', 'showStats', - 'tilesetVisible', 'displayVisible', 'updateVisible', 'loggingVisible', 'styleVisible', 'styleString']); + 'tilesetVisible', 'displayVisible', 'updateVisible', 'loggingVisible', 'styleVisible', 'tileInfoVisible', 'styleString']); this._properties = knockout.observable({}); /** @@ -313,6 +322,8 @@ define([ } } }); + + /** * Gets or sets the flag to enable picking. This property is observable. * @@ -465,6 +476,132 @@ define([ */ this.freezeFrame = false; + var onlyPickedTileInfo = knockout.observable(); + knockout.defineProperty(this, 'onlyPickedTileInfo', { + get : function() { + return onlyPickedTileInfo(); + }, + set : function(val) { + onlyPickedTileInfo(val); + if (that._tileset) { + that._tileset.debugShowOnlyPickedTile = val; + } + } + }); + /** + * Displays tile info for only picked tile. This property is observable. + * @memberof Cesium3DTilesInspectorViewModel.prototype + * + * @type {Boolean} + * @default false + */ + this.onlyPickedTileInfo = false; + + var textureMemory = knockout.observable(); + knockout.defineProperty(this, 'textureMemory', { + get : function() { + return textureMemory(); + }, + set : function(val) { + textureMemory(val); + if (that._tileset) { + that._tileset.debugShowTextureMemoryUsage = val; + } + } + }); + /** + * Displays the texture memory used per tile. This property is observable. + * @memberof Cesium3DTilesInspectorViewModel.prototype + * + * @type {Boolean} + * @default false + */ + this.textureMemory = false; + + var numberOfTriangles = knockout.observable(); + knockout.defineProperty(this, 'numberOfTriangles', { + get : function() { + return numberOfTriangles(); + }, + set : function(val) { + numberOfTriangles(val); + if (that._tileset) { + that._tileset.debugShowNumberOfTriangles = val; + } + } + }); + /** + * Displays the number of triangles per tile. This property is observable. + * @memberof Cesium3DTilesInspectorViewModel.prototype + * + * @type {Boolean} + * @default false + */ + this.numberOfTriangles = false; + + var numberOfPoints = knockout.observable(); + knockout.defineProperty(this, 'numberOfPoints', { + get : function() { + return numberOfPoints(); + }, + set : function(val) { + numberOfPoints(val); + if (that._tileset) { + that._tileset.debugShowNumberOfPoints = val; + } + } + }); + /** + * Displays the number of points per tile. This property is observable. + * @memberof Cesium3DTilesInspectorViewModel.prototype + * + * @type {Boolean} + * @default false + */ + this.numberOfPoints = false; + + var vertexMemory = knockout.observable(); + knockout.defineProperty(this, 'vertexMemory', { + get : function() { + return vertexMemory(); + }, + set : function(val) { + vertexMemory(val); + if (that._tileset) { + that._tileset.debugShowVertexMemoryUsage = val; + } + } + }); + /** + * Displays the vertex memory used per tile. This property is observable. + * @memberof Cesium3DTilesInspectorViewModel.prototype + * + * @type {Boolean} + * @default false + */ + this.vertexMemory = false; + + var numberOfCommands = knockout.observable(); + knockout.defineProperty(this, 'numberOfCommands', { + get : function() { + return numberOfCommands(); + }, + set : function(val) { + numberOfCommands(val); + if (that._tileset) { + that._tileset.debugShowNumberOfCommands = val; + } + } + }); + /** + * Displays the number of commands used per tile. This property is observable. + * @memberof Cesium3DTilesInspectorViewModel.prototype + * + * @type {Boolean} + * @default false + */ + this.numberOfCommands = false; + var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { get : function() { @@ -572,7 +709,8 @@ define([ this._feature = undefined; this._definedProperties = ['propertiesText', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'showGeometricError', 'freezeFrame', 'maximumScreenSpaceError', - 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive']; + 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', + 'onlyPickedTileInfo', 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); @@ -655,7 +793,13 @@ define([ 'showContentBoundingVolumes', 'showRequestVolumes', 'showGeometricError', - 'freezeFrame']; + 'freezeFrame', + 'onlyPickedTileInfo', + 'textureMemory', + 'vertexMemory', + 'numberOfPoints', + 'numberOfTriangles', + 'numberOfCommands']; var length = settings.length; for (var i = 0; i < length; ++i) { var setting = settings[i]; @@ -759,6 +903,13 @@ define([ this.styleVisible = !this.styleVisible; }; + /** + * Toggles the visibility of the tile info section + */ + Cesium3DTilesInspectorViewModel.prototype.toggleTileInfo = function() { + this.tileInfoVisible = !this.tileInfoVisible; + }; + /** * Trims tile cache */ diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index e29a22aaad73..a3513929db34 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1342,17 +1342,17 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { tileset.debugShowGeometricError = true; scene.renderForSpecs(); - expect(tileset._geometricErrorLabels).toBeDefined(); - expect(tileset._geometricErrorLabels.length).toEqual(5); - expect(tileset._geometricErrorLabels._labels[0].text).toEqual('70'); - expect(tileset._geometricErrorLabels._labels[1].text).toEqual('0'); - expect(tileset._geometricErrorLabels._labels[2].text).toEqual('0'); - expect(tileset._geometricErrorLabels._labels[3].text).toEqual('0'); - expect(tileset._geometricErrorLabels._labels[4].text).toEqual('0'); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(5); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: 70'); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: 0'); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: 0'); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: 0'); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: 0'); tileset.debugShowGeometricError = false; scene.renderForSpecs(); - expect(tileset._geometricErrorLabels).not.toBeDefined(); + expect(tileset._tileInfoLabels).not.toBeDefined(); }); }); @@ -1361,14 +1361,14 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, tilesetWithTransformsUrl).then(function(tileset) { tileset.debugShowGeometricError = true; scene.renderForSpecs(); - expect(tileset._geometricErrorLabels).toBeDefined(); - expect(tileset._geometricErrorLabels.length).toEqual(2); - expect(tileset._geometricErrorLabels._labels[0].text).toEqual('70'); - expect(tileset._geometricErrorLabels._labels[1].text).toEqual('0'); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(2); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: 70'); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: 0'); tileset.debugShowGeometricError = false; scene.renderForSpecs(); - expect(tileset._geometricErrorLabels).not.toBeDefined(); + expect(tileset._tileInfoLabels).not.toBeDefined(); }); }); @@ -1377,18 +1377,18 @@ defineSuite([ return Cesium3DTilesTester.loadTileset(scene, tilesetWithViewerRequestVolumeUrl).then(function(tileset) { tileset.debugShowGeometricError = true; scene.renderForSpecs(); - expect(tileset._geometricErrorLabels).toBeDefined(); - expect(tileset._geometricErrorLabels.length).toEqual(6); - expect(tileset._geometricErrorLabels._labels[0].text).toEqual('70'); - expect(tileset._geometricErrorLabels._labels[1].text).toEqual('0'); - expect(tileset._geometricErrorLabels._labels[2].text).toEqual('0'); - expect(tileset._geometricErrorLabels._labels[3].text).toEqual('0'); - expect(tileset._geometricErrorLabels._labels[4].text).toEqual('0'); - expect(tileset._geometricErrorLabels._labels[5].text).toEqual('0'); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(6); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: 70'); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: 0'); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: 0'); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: 0'); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: 0'); + expect(tileset._tileInfoLabels._labels[5].text).toEqual('Geometric error: 0'); tileset.debugShowGeometricError = false; scene.renderForSpecs(); - expect(tileset._geometricErrorLabels).not.toBeDefined(); + expect(tileset._tileInfoLabels).not.toBeDefined(); }); }); From 94de1f95c568e4f5f172bc82f3a52b3757a8e4f9 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 20 Apr 2017 11:07:26 -0400 Subject: [PATCH 02/19] fix label clipping --- Source/Scene/Cesium3DTileset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 9f41ff20d747..90c0cd4cb485 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1957,7 +1957,7 @@ define([ position: position, font : (18-attribCounter).toString() + 'px sans-serif', showBackground: true, - backgroundColor: new Color(0.165, 0.165, 0.165, 0.8) + disableDepthTestDistance : Number.POSITIVE_INFINITY }); } tileset._tileInfoLabels.update(frameState); From 536304227bb1a5576771984f846db41a9ebbe001 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 20 Apr 2017 13:34:29 -0400 Subject: [PATCH 03/19] adding per tile commands used counting --- Source/Scene/Batched3DModel3DTileContent.js | 13 +++++++++++++ Source/Scene/Cesium3DTile.js | 2 ++ Source/Scene/Cesium3DTileContent.js | 14 ++++++++++++++ Source/Scene/Cesium3DTileset.js | 6 +++--- Source/Scene/Composite3DTileContent.js | 12 ++++++++++++ Source/Scene/Empty3DTileContent.js | 10 ++++++++++ Source/Scene/Instanced3DModel3DTileContent.js | 13 +++++++++++++ Source/Scene/PointCloud3DTileContent.js | 10 ++++++++++ Source/Scene/Tileset3DTileContent.js | 10 ++++++++++ 9 files changed, 87 insertions(+), 3 deletions(-) diff --git a/Source/Scene/Batched3DModel3DTileContent.js b/Source/Scene/Batched3DModel3DTileContent.js index 11bf088f2f2f..08d3999d09bf 100644 --- a/Source/Scene/Batched3DModel3DTileContent.js +++ b/Source/Scene/Batched3DModel3DTileContent.js @@ -75,6 +75,7 @@ define([ this._contentReadyToProcessPromise = when.defer(); this._readyPromise = when.defer(); this._featuresLength = 0; + this._commandsLength = 0; this._features = undefined; } @@ -112,6 +113,18 @@ define([ } }, + /** + * Part of the {@link Cesium3DTileContent} interface. + */ + commandsLength : { + get : function() { + return this._commandsLength; + }, + set : function(val) { + this._commandsLength = val; + } + }, + /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/Cesium3DTile.js b/Source/Scene/Cesium3DTile.js index ae1a1c0787e6..aa668fd36644 100644 --- a/Source/Scene/Cesium3DTile.js +++ b/Source/Scene/Cesium3DTile.js @@ -748,9 +748,11 @@ define([ * @private */ Cesium3DTile.prototype.update = function(tileset, frameState) { + var initCommandLength = frameState.commandList.length; applyDebugSettings(this, tileset, frameState); this._content.update(tileset, frameState); this._transformDirty = false; + this._content.commandsLength = frameState.commandList.length - initCommandLength; }; var scratchCommandList = []; diff --git a/Source/Scene/Cesium3DTileContent.js b/Source/Scene/Cesium3DTileContent.js index d5fe0bbdefc7..f45fa684caee 100644 --- a/Source/Scene/Cesium3DTileContent.js +++ b/Source/Scene/Cesium3DTileContent.js @@ -106,6 +106,20 @@ define([ } }, + /** + * Gets the number of commands used by the tile. + * + * @memberof Cesium3DTileContent.prototype + * + * @type {Number} + * @readonly + */ + commandsLength : { + get : function() { + DeveloperError.throwInstantiationError(); + } + }, + /** * Gets the tile's vertex memory in bytes. * diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 90c0cd4cb485..cfa575f34599 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1933,15 +1933,15 @@ define([ attribCounter++; } if (tileset.debugShowNumberOfCommands) { - labelString += "\nCommands: " + tileset._statistics.numberOfCommands.toString(); + labelString += "\nCommands: " + tile.content.commandsLength.toString(); attribCounter++; } if (tileset.debugShowTextureMemoryUsage) { - labelString += "\nTexture Memory: " + tileset._statistics.textureMemorySizeInBytes.toString(); + labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); attribCounter++; } if (tileset.debugShowVertexMemoryUsage) { - labelString += "\nVertex Memory: " + tileset._statistics.vertexMemorySizeInBytes.toString(); + labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); attribCounter++; } if (tileset.debugShowNumberOfPoints) { diff --git a/Source/Scene/Composite3DTileContent.js b/Source/Scene/Composite3DTileContent.js index 7bbc5d4b7350..de840b2faebe 100644 --- a/Source/Scene/Composite3DTileContent.js +++ b/Source/Scene/Composite3DTileContent.js @@ -89,6 +89,18 @@ define([ } }, + /** + * Part of the {@link Cesium3DTileContent} interface. Composite3DTileContent + * always returns 0. Instead call pointsLength for a tile in the composite. + */ + commandsLength : { + get : function() { + return 0; + }, + set : function(val) {} + }, + + /** * Part of the {@link Cesium3DTileContent} interface. Composite3DTileContent * always returns 0. Instead call pointsLength for a tile in the composite. diff --git a/Source/Scene/Empty3DTileContent.js b/Source/Scene/Empty3DTileContent.js index 503577a7811c..a2ad93a767b6 100644 --- a/Source/Scene/Empty3DTileContent.js +++ b/Source/Scene/Empty3DTileContent.js @@ -51,6 +51,16 @@ define([ } }, + /** + * Part of the {@link Cesium3DTileContent} interface. + */ + commandsLength : { + get : function() { + return 0; + }, + set : function(val) {} + }, + /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/Instanced3DModel3DTileContent.js b/Source/Scene/Instanced3DModel3DTileContent.js index 9e9c543b1373..65c96bd67be6 100644 --- a/Source/Scene/Instanced3DModel3DTileContent.js +++ b/Source/Scene/Instanced3DModel3DTileContent.js @@ -95,6 +95,7 @@ define([ this._contentReadyToProcessPromise = when.defer(); this._readyPromise = when.defer(); this._features = undefined; + this._commandsLength = 0; } defineProperties(Instanced3DModel3DTileContent.prototype, { @@ -111,6 +112,18 @@ define([ } }, + /** + * Part of the {@link Cesium3DTileContent} interface. + */ + commandsLength : { + get : function() { + return this._commandsLength; + }, + set : function(val) { + this._commandsLength = val; + } + }, + /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 07034d7618d7..2bf715316a37 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -156,6 +156,16 @@ define([ } }, + /** + * Part of the {@link Cesium3DTileContent} interface. + */ + commandsLength : { + get : function() { + return 1; + }, + set : function(val) {} + }, + /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/Tileset3DTileContent.js b/Source/Scene/Tileset3DTileContent.js index 4110b9cf525a..f3901b5798f4 100644 --- a/Source/Scene/Tileset3DTileContent.js +++ b/Source/Scene/Tileset3DTileContent.js @@ -49,6 +49,16 @@ define([ } }, + /** + * Part of the {@link Cesium3DTileContent} interface. + */ + commandsLength : { + get : function() { + return 0; + }, + set : function(val) {} + }, + /** * Part of the {@link Cesium3DTileContent} interface. */ From 3c28604af8a5ce443effabca5b769f08dcd6fa41 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 20 Apr 2017 15:21:45 -0400 Subject: [PATCH 04/19] cleanup tweaks --- Source/Scene/Cesium3DTileset.js | 4 ++-- Source/Scene/Model.js | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index cfa575f34599..0a39396be1ca 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -2045,8 +2045,8 @@ define([ // Number of commands added by each update above tileset._statistics.numberOfCommands = (commandList.length - numberOfInitialCommands); - if (tileset.debugShowGeometricError || tileset.debugShowNumberOfCommands || tileset.debugShowTextureMemoryUsage - || tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles) { + if (tileset.debugShowGeometricError || tileset.debugShowNumberOfCommands || tileset.debugShowTextureMemoryUsage || + tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles) { if (!defined(tileset._tileInfoLabels)) { tileset._tileInfoLabels = new LabelCollection(); } diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 8f6360e91f1b..bb434a85a17e 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -3356,11 +3356,6 @@ define([ function triangleCountFromPrimitiveIndices(primitive, indicesCount) { switch (primitive.mode) { - case PrimitiveType.POINTS: - case PrimitiveType.LINES: - case PrimitiveType.LINE_LOOP: - case PrimitiveType.LINE_STRIP: - return 0; case PrimitiveType.TRIANGLES: return (indicesCount / 3); case PrimitiveType.TRIANGLE_STRIP: From a247ea7f39a429e6dfc2d44df784fe18cd784d8f Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Wed, 26 Apr 2017 12:37:43 -0400 Subject: [PATCH 05/19] adding tests --- Source/Scene/Cesium3DTileset.js | 17 +-- Specs/Scene/Cesium3DTilesetSpec.js | 175 ++++++++++++++++++++++++++--- 2 files changed, 168 insertions(+), 24 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 0a39396be1ca..7d9d2a291c5a 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1936,14 +1936,6 @@ define([ labelString += "\nCommands: " + tile.content.commandsLength.toString(); attribCounter++; } - if (tileset.debugShowTextureMemoryUsage) { - labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); - attribCounter++; - } - if (tileset.debugShowVertexMemoryUsage) { - labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); - attribCounter++; - } if (tileset.debugShowNumberOfPoints) { labelString += "\nPoints: " + tile.content.pointsLength.toString(); attribCounter++; @@ -1952,6 +1944,15 @@ define([ labelString += "\nTriangles: " + tile.content.trianglesLength.toString(); attribCounter++; } + if (tileset.debugShowTextureMemoryUsage) { + labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); + attribCounter++; + } + if (tileset.debugShowVertexMemoryUsage) { + labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); + attribCounter++; + } + tileset._tileInfoLabels.add({ text: labelString.substring(1), position: position, diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index a3513929db34..c8e1ddda61e5 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1337,18 +1337,20 @@ defineSuite([ }); }); - it('debugShowGeometricError with regions', function() { + it('show tile info labels with regions', function() { // tilesetUrl has bounding regions return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { tileset.debugShowGeometricError = true; scene.renderForSpecs(); expect(tileset._tileInfoLabels).toBeDefined(); expect(tileset._tileInfoLabels.length).toEqual(5); - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: 70'); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: 0'); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: 0'); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: 0'); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: 0'); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: ' + root.children[1].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: ' + root.children[2].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: ' + root.children[3].geometricError.toString()); tileset.debugShowGeometricError = false; scene.renderForSpecs(); @@ -1356,15 +1358,17 @@ defineSuite([ }); }); - it('debugShowGeometricError with boxes', function() { + it('show tile info labels with boxes', function() { // tilesetWithTransformsUrl has bounding boxes return Cesium3DTilesTester.loadTileset(scene, tilesetWithTransformsUrl).then(function(tileset) { tileset.debugShowGeometricError = true; scene.renderForSpecs(); expect(tileset._tileInfoLabels).toBeDefined(); expect(tileset._tileInfoLabels.length).toEqual(2); - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: 70'); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: 0'); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError.toString()); tileset.debugShowGeometricError = false; scene.renderForSpecs(); @@ -1372,21 +1376,160 @@ defineSuite([ }); }); - it('debugShowGeometricError with bounding spheres', function() { + it('show tile info labels with bounding spheres', function() { // tilesetWithViewerRequestVolumeUrl has bounding sphere return Cesium3DTilesTester.loadTileset(scene, tilesetWithViewerRequestVolumeUrl).then(function(tileset) { tileset.debugShowGeometricError = true; scene.renderForSpecs(); expect(tileset._tileInfoLabels).toBeDefined(); expect(tileset._tileInfoLabels.length).toEqual(6); - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: 70'); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: 0'); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: 0'); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: 0'); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: 0'); - expect(tileset._tileInfoLabels._labels[5].text).toEqual('Geometric error: 0'); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: ' + root.children[1].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: ' + root.children[2].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: ' + root.children[3].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[5].text).toEqual('Geometric error: ' + root.children[4].geometricError.toString()); + + tileset.debugShowGeometricError = false; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).not.toBeDefined(); + }); + }); + + it('show tile info labels with number of commands', function() { + // tilesetUrl has bounding regions + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { + tileset.debugShowNumberOfCommands = true; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(5); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Commands: ' + root.content.commandsLength.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Commands: ' + root.children[0].content.commandsLength.toString()); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Commands: ' + root.children[1].content.commandsLength.toString()); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Commands: ' + root.children[2].content.commandsLength.toString()); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Commands: ' + root.children[3].content.commandsLength.toString()); + + tileset.debugShowNumberOfCommands = false; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).not.toBeDefined(); + }); + }); + + it('show tile info labels with number of triangles', function() { + // tilesetUrl has bounding regions + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { + tileset.debugShowNumberOfTriangles = true; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(5); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Triangles: ' + root.content.trianglesLength.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Triangles: ' + root.children[0].content.trianglesLength.toString()); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Triangles: ' + root.children[1].content.trianglesLength.toString()); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Triangles: ' + root.children[2].content.trianglesLength.toString()); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Triangles: ' + root.children[3].content.trianglesLength.toString()); + + tileset.debugShowNumberOfTriangles = false; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).not.toBeDefined(); + }); + }); + + it('show tile info labels with number of points', function() { + // tilesetUrl has bounding regions + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { + tileset.debugShowNumberOfPoints = true; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(5); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Points: ' + root.content.pointsLength.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Points: ' + root.children[0].content.pointsLength.toString()); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Points: ' + root.children[1].content.pointsLength.toString()); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Points: ' + root.children[2].content.pointsLength.toString()); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Points: ' + root.children[3].content.pointsLength.toString()); + + tileset.debugShowNumberOfPoints = false; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).not.toBeDefined(); + }); + }); + + it('show tile info labels with texture memory usage', function() { + // tilesetUrl has bounding regions + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { + tileset.debugShowTextureMemoryUsage = true; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(5); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Texture Memory: ' + root.content.textureMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Texture Memory: ' + root.children[0].content.textureMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Texture Memory: ' + root.children[1].content.textureMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Texture Memory: ' + root.children[2].content.textureMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Texture Memory: ' + root.children[3].content.textureMemorySizeInBytes.toString()); + + tileset.debugShowTextureMemoryUsage = false; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).not.toBeDefined(); + }); + }); + + it('show tile info labels with vertex memory usage', function() { + // tilesetUrl has bounding regions + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { + tileset.debugShowVertexMemoryUsage = true; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(5); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Vertex Memory: ' + root.content.vertexMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Vertex Memory: ' + root.children[0].content.vertexMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Vertex Memory: ' + root.children[1].content.vertexMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Vertex Memory: ' + root.children[2].content.vertexMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Vertex Memory: ' + root.children[3].content.vertexMemorySizeInBytes.toString()); + + tileset.debugShowVertexMemoryUsage = false; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).not.toBeDefined(); + }); + }); + + it('show tile info labels with all stats', function() { + // tilesetUrl has bounding regions + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { + tileset.debugShowGeometricError = true; + tileset.debugShowNumberOfCommands = true; + tileset.debugShowNumberOfPoints = true; + tileset.debugShowNumberOfTriangles = true; + tileset.debugShowTextureMemoryUsage = true; + tileset.debugShowVertexMemoryUsage = true; + viewRootOnly(); + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).toBeDefined(); + + var content = tileset._root.content; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + tileset._root.geometricError.toString() + '\n' + + 'Commands: ' + content.commandsLength.toString() + '\n' + + 'Points: ' + content.pointsLength.toString() + '\n' + + 'Triangles: ' + content.trianglesLength.toString() + '\n' + + 'Texture Memory: ' + content.textureMemorySizeInBytes.toString() + '\n' + + 'Vertex Memory: ' + content.vertexMemorySizeInBytes.toString()); tileset.debugShowGeometricError = false; + tileset.debugShowNumberOfCommands = false; + tileset.debugShowNumberOfPoints = false + tileset.debugShowNumberOfTriangles = false; + tileset.debugShowTextureMemoryUsage = false + tileset.debugShowVertexMemoryUsage = false; scene.renderForSpecs(); expect(tileset._tileInfoLabels).not.toBeDefined(); }); From 19e41792081ed4711c5aa6e82a8cb3f5ca48758d Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 27 Apr 2017 11:14:09 -0400 Subject: [PATCH 06/19] moving debug label drawing from tilset to view model --- .../Cesium3DTilesInspector.js | 10 +- .../Cesium3DTilesInspectorViewModel.js | 143 ++++++++++++++---- 2 files changed, 116 insertions(+), 37 deletions(-) diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index 64efe177e879..8292c21d44c5 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -197,11 +197,11 @@ define([ stylePanelContents.appendChild(errorBox); tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); - tileInfoPanelContents.appendChild(makeCheckbox('textureMemory', 'Texture Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('vertexMemory', 'Vertex Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfCommands', 'Number of Commands')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfPoints', 'Number Of Points')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfTriangles', 'Number Of Triangles')); + tileInfoPanelContents.appendChild(makeCheckbox('showTextureMemory', 'Texture Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('showVertexMemory', 'Vertex Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfCommands', 'Number of Commands')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfPoints', 'Number Of Points')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfTriangles', 'Number Of Triangles')); var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents); var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 356278bc0b45..36c5a6daf6f1 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -13,6 +13,7 @@ define([ '../../Core/destroyObject', '../../ThirdParty/knockout', '../../Scene/PerformanceDisplay', + '../../Scene/LabelCollection', '../../Core/ScreenSpaceEventHandler', '../../Core/ScreenSpaceEventType' ], function( @@ -29,6 +30,7 @@ define([ destroyObject, knockout, PerformanceDisplay, + LabelCollection, ScreenSpaceEventHandler, ScreenSpaceEventType) { 'use strict'; @@ -148,6 +150,7 @@ define([ this._statsText = ''; this._pickStatsText = ''; this._editorError = ''; + this._tileInfoLabels = undefined; /** * Gets or sets the flag to enable performance display. This property is observable. @@ -497,13 +500,13 @@ define([ */ this.onlyPickedTileInfo = false; - var textureMemory = knockout.observable(); - knockout.defineProperty(this, 'textureMemory', { + var showTextureMemory = knockout.observable(); + knockout.defineProperty(this, 'showTextureMemory', { get : function() { - return textureMemory(); + return showTextureMemory(); }, set : function(val) { - textureMemory(val); + showTextureMemory(val); if (that._tileset) { that._tileset.debugShowTextureMemoryUsage = val; } @@ -516,15 +519,15 @@ define([ * @type {Boolean} * @default false */ - this.textureMemory = false; + this.showTextureMemory = false; - var numberOfTriangles = knockout.observable(); - knockout.defineProperty(this, 'numberOfTriangles', { + var showNumberOfTriangles = knockout.observable(); + knockout.defineProperty(this, 'showNumberOfTriangles', { get : function() { - return numberOfTriangles(); + return showNumberOfTriangles(); }, set : function(val) { - numberOfTriangles(val); + showNumberOfTriangles(val); if (that._tileset) { that._tileset.debugShowNumberOfTriangles = val; } @@ -537,15 +540,15 @@ define([ * @type {Boolean} * @default false */ - this.numberOfTriangles = false; + this.showNumberOfTriangles = false; - var numberOfPoints = knockout.observable(); - knockout.defineProperty(this, 'numberOfPoints', { + var showNumberOfPoints = knockout.observable(); + knockout.defineProperty(this, 'showNumberOfPoints', { get : function() { - return numberOfPoints(); + return showNumberOfPoints(); }, set : function(val) { - numberOfPoints(val); + showNumberOfPoints(val); if (that._tileset) { that._tileset.debugShowNumberOfPoints = val; } @@ -558,15 +561,15 @@ define([ * @type {Boolean} * @default false */ - this.numberOfPoints = false; + this.showNumberOfPoints = false; - var vertexMemory = knockout.observable(); - knockout.defineProperty(this, 'vertexMemory', { + var showVertexMemory = knockout.observable(); + knockout.defineProperty(this, 'showVertexMemory', { get : function() { - return vertexMemory(); + return showVertexMemory(); }, set : function(val) { - vertexMemory(val); + showVertexMemory(val); if (that._tileset) { that._tileset.debugShowVertexMemoryUsage = val; } @@ -579,15 +582,15 @@ define([ * @type {Boolean} * @default false */ - this.vertexMemory = false; + this.showVertexMemory = false; - var numberOfCommands = knockout.observable(); - knockout.defineProperty(this, 'numberOfCommands', { + var showNumberOfCommands = knockout.observable(); + knockout.defineProperty(this, 'showNumberOfCommands', { get : function() { - return numberOfCommands(); + return showNumberOfCommands(); }, set : function(val) { - numberOfCommands(val); + showNumberOfCommands(val); if (that._tileset) { that._tileset.debugShowNumberOfCommands = val; } @@ -600,7 +603,7 @@ define([ * @type {Boolean} * @default false */ - this.numberOfCommands = false; + this.showNumberOfCommands = false; var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { @@ -710,7 +713,7 @@ define([ this._definedProperties = ['propertiesText', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'showGeometricError', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', - 'onlyPickedTileInfo', 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands']; + 'onlyPickedTileInfo', 'showTextureMemory', 'showVertexMemory', 'showNumberOfPoints', 'showNumberOfTriangles', 'showNumberOfCommands']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); @@ -792,14 +795,14 @@ define([ 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', - 'showGeometricError', 'freezeFrame', 'onlyPickedTileInfo', - 'textureMemory', - 'vertexMemory', - 'numberOfPoints', - 'numberOfTriangles', - 'numberOfCommands']; + 'showGeometricError', + 'showTextureMemory', + 'showVertexMemory', + 'showNumberOfPoints', + 'showNumberOfTriangles', + 'showNumberOfCommands']; var length = settings.length; for (var i = 0; i < length; ++i) { var setting = settings[i]; @@ -919,6 +922,72 @@ define([ } }; + /** + * Updates the debug labels + */ + var scratchCartesian = new Cartesian3(); + Cesium3DTilesInspectorViewModel.prototype.updateTileInfoLabels = function() { + var selectedTiles = this._tileset._selectedTiles; + var length = selectedTiles.length; + this._tileInfoLabels.removeAll(); + for (var i = 0; i < length; ++i) { + var tile = selectedTiles[i]; + var boundingVolume = tile._boundingVolume.boundingVolume; + var halfAxes = boundingVolume.halfAxes; + var radius = boundingVolume.radius; + + var position = Cartesian3.clone(boundingVolume.center, scratchCartesian); + if (defined(halfAxes)) { + position.x += 0.75 * (halfAxes[0] + halfAxes[3] + halfAxes[6]); + position.y += 0.75 * (halfAxes[1] + halfAxes[4] + halfAxes[7]); + position.z += 0.75 * (halfAxes[2] + halfAxes[5] + halfAxes[8]); + } else if (defined(radius)) { + var normal = Cartesian3.normalize(boundingVolume.center, scratchCartesian); + normal = Cartesian3.multiplyByScalar(normal, 0.75 * radius, scratchCartesian); + position = Cartesian3.add(normal, boundingVolume.center, scratchCartesian); + } + + //debugger; + + var labelString = ""; + var attribCounter = 0; + + if (this.showGeometricError) { + labelString += "\nGeometric error: " + tile.geometricError.toString(); + attribCounter++; + } + if (this.showNumberOfCommands) { + labelString += "\nCommands: " + tile.content.commandsLength.toString(); + attribCounter++; + } + if (this.showNumberOfPoints) { + labelString += "\nPoints: " + tile.content.pointsLength.toString(); + attribCounter++; + } + if (this.showNumberOfTriangles) { + labelString += "\nTriangles: " + tile.content.trianglesLength.toString(); + attribCounter++; + } + if (this.showTextureMemory) { + labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); + attribCounter++; + } + if (this.showVertexMemory) { + labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); + attribCounter++; + } + + this._tileInfoLabels.add({ + text: labelString.substring(1), + position: position, + font : (18-attribCounter).toString() + 'px sans-serif', + showBackground: true, + disableDepthTestDistance : Number.POSITIVE_INFINITY + }); + } + this._tileInfoLabels.update(this._scene.frameState); + } + /** * Compiles the style in the style editor */ @@ -1013,6 +1082,16 @@ define([ tileset._styleEngine.makeDirty(); this._shouldStyle = false; } + + if (this.showGeometricError || this.showNumberOfCommands || this.showNumberOfPoints || this.showNumberOfTriangles || + this.showTextureMemory || this.showVertexMemory) { + if (!defined(this._tileInfoLabels)) { + this._tileInfoLabels = new LabelCollection(); + } + this.updateTileInfoLabels(); + } else { + this._tileInfoLabels = this._tileInfoLabels && this._tileInfoLabels.destroy(); + } } if (this.showStats) { this._statsText = getStats(tileset, false); From f627ddd8510b75dd1be4075c594136b436ba9037 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 27 Apr 2017 13:38:19 -0400 Subject: [PATCH 07/19] removing the original debug labels --- Source/Scene/Cesium3DTileset.js | 72 --------------------------------- 1 file changed, 72 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 7d9d2a291c5a..442dd6c2bdbb 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1902,68 +1902,6 @@ define([ updatePointAndFeatureCounts(tileset, content, true, true); } - var scratchCartesian2 = new Cartesian3(); - - function updateTileInfoLabels(tileset, frameState) { - var selectedTiles = tileset._selectedTiles; - var length = selectedTiles.length; - tileset._tileInfoLabels.removeAll(); - for (var i = 0; i < length; ++i) { - var tile = selectedTiles[i]; - var boundingVolume = tile._boundingVolume.boundingVolume; - var halfAxes = boundingVolume.halfAxes; - var radius = boundingVolume.radius; - - var position = Cartesian3.clone(boundingVolume.center, scratchCartesian2); - if (defined(halfAxes)) { - position.x += 0.75 * (halfAxes[0] + halfAxes[3] + halfAxes[6]); - position.y += 0.75 * (halfAxes[1] + halfAxes[4] + halfAxes[7]); - position.z += 0.75 * (halfAxes[2] + halfAxes[5] + halfAxes[8]); - } else if (defined(radius)) { - var normal = Cartesian3.normalize(boundingVolume.center, scratchCartesian2); - normal = Cartesian3.multiplyByScalar(normal, 0.75 * radius, scratchCartesian2); - position = Cartesian3.add(normal, boundingVolume.center, scratchCartesian2); - } - - var labelString = ""; - var attribCounter = 0; - - if (tileset.debugShowGeometricError) { - labelString += "\nGeometric error: " + tile.geometricError.toString(); - attribCounter++; - } - if (tileset.debugShowNumberOfCommands) { - labelString += "\nCommands: " + tile.content.commandsLength.toString(); - attribCounter++; - } - if (tileset.debugShowNumberOfPoints) { - labelString += "\nPoints: " + tile.content.pointsLength.toString(); - attribCounter++; - } - if (tileset.debugShowNumberOfTriangles) { - labelString += "\nTriangles: " + tile.content.trianglesLength.toString(); - attribCounter++; - } - if (tileset.debugShowTextureMemoryUsage) { - labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); - attribCounter++; - } - if (tileset.debugShowVertexMemoryUsage) { - labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); - attribCounter++; - } - - tileset._tileInfoLabels.add({ - text: labelString.substring(1), - position: position, - font : (18-attribCounter).toString() + 'px sans-serif', - showBackground: true, - disableDepthTestDistance : Number.POSITIVE_INFINITY - }); - } - tileset._tileInfoLabels.update(frameState); - } - var stencilClearCommand = new ClearCommand({ stencil : 0, pass : Pass.CESIUM_3D_TILE @@ -2045,16 +1983,6 @@ define([ // Number of commands added by each update above tileset._statistics.numberOfCommands = (commandList.length - numberOfInitialCommands); - - if (tileset.debugShowGeometricError || tileset.debugShowNumberOfCommands || tileset.debugShowTextureMemoryUsage || - tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles) { - if (!defined(tileset._tileInfoLabels)) { - tileset._tileInfoLabels = new LabelCollection(); - } - updateTileInfoLabels(tileset, frameState); - } else { - tileset._tileInfoLabels = tileset._tileInfoLabels && tileset._tileInfoLabels.destroy(); - } } function unloadTiles(tileset, frameState) { From d67edf91519cb026a19e289cfe6e9faca43d2337 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 27 Apr 2017 15:02:20 -0400 Subject: [PATCH 08/19] Revert "moving debug label drawing from tilset to view model" This reverts commit 19e41792081ed4711c5aa6e82a8cb3f5ca48758d. --- .../Cesium3DTilesInspector.js | 10 +- .../Cesium3DTilesInspectorViewModel.js | 143 ++++-------------- 2 files changed, 37 insertions(+), 116 deletions(-) diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index 8292c21d44c5..64efe177e879 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -197,11 +197,11 @@ define([ stylePanelContents.appendChild(errorBox); tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); - tileInfoPanelContents.appendChild(makeCheckbox('showTextureMemory', 'Texture Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('showVertexMemory', 'Vertex Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfCommands', 'Number of Commands')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfPoints', 'Number Of Points')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfTriangles', 'Number Of Triangles')); + tileInfoPanelContents.appendChild(makeCheckbox('textureMemory', 'Texture Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('vertexMemory', 'Vertex Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfCommands', 'Number of Commands')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfPoints', 'Number Of Points')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfTriangles', 'Number Of Triangles')); var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents); var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 36c5a6daf6f1..356278bc0b45 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -13,7 +13,6 @@ define([ '../../Core/destroyObject', '../../ThirdParty/knockout', '../../Scene/PerformanceDisplay', - '../../Scene/LabelCollection', '../../Core/ScreenSpaceEventHandler', '../../Core/ScreenSpaceEventType' ], function( @@ -30,7 +29,6 @@ define([ destroyObject, knockout, PerformanceDisplay, - LabelCollection, ScreenSpaceEventHandler, ScreenSpaceEventType) { 'use strict'; @@ -150,7 +148,6 @@ define([ this._statsText = ''; this._pickStatsText = ''; this._editorError = ''; - this._tileInfoLabels = undefined; /** * Gets or sets the flag to enable performance display. This property is observable. @@ -500,13 +497,13 @@ define([ */ this.onlyPickedTileInfo = false; - var showTextureMemory = knockout.observable(); - knockout.defineProperty(this, 'showTextureMemory', { + var textureMemory = knockout.observable(); + knockout.defineProperty(this, 'textureMemory', { get : function() { - return showTextureMemory(); + return textureMemory(); }, set : function(val) { - showTextureMemory(val); + textureMemory(val); if (that._tileset) { that._tileset.debugShowTextureMemoryUsage = val; } @@ -519,15 +516,15 @@ define([ * @type {Boolean} * @default false */ - this.showTextureMemory = false; + this.textureMemory = false; - var showNumberOfTriangles = knockout.observable(); - knockout.defineProperty(this, 'showNumberOfTriangles', { + var numberOfTriangles = knockout.observable(); + knockout.defineProperty(this, 'numberOfTriangles', { get : function() { - return showNumberOfTriangles(); + return numberOfTriangles(); }, set : function(val) { - showNumberOfTriangles(val); + numberOfTriangles(val); if (that._tileset) { that._tileset.debugShowNumberOfTriangles = val; } @@ -540,15 +537,15 @@ define([ * @type {Boolean} * @default false */ - this.showNumberOfTriangles = false; + this.numberOfTriangles = false; - var showNumberOfPoints = knockout.observable(); - knockout.defineProperty(this, 'showNumberOfPoints', { + var numberOfPoints = knockout.observable(); + knockout.defineProperty(this, 'numberOfPoints', { get : function() { - return showNumberOfPoints(); + return numberOfPoints(); }, set : function(val) { - showNumberOfPoints(val); + numberOfPoints(val); if (that._tileset) { that._tileset.debugShowNumberOfPoints = val; } @@ -561,15 +558,15 @@ define([ * @type {Boolean} * @default false */ - this.showNumberOfPoints = false; + this.numberOfPoints = false; - var showVertexMemory = knockout.observable(); - knockout.defineProperty(this, 'showVertexMemory', { + var vertexMemory = knockout.observable(); + knockout.defineProperty(this, 'vertexMemory', { get : function() { - return showVertexMemory(); + return vertexMemory(); }, set : function(val) { - showVertexMemory(val); + vertexMemory(val); if (that._tileset) { that._tileset.debugShowVertexMemoryUsage = val; } @@ -582,15 +579,15 @@ define([ * @type {Boolean} * @default false */ - this.showVertexMemory = false; + this.vertexMemory = false; - var showNumberOfCommands = knockout.observable(); - knockout.defineProperty(this, 'showNumberOfCommands', { + var numberOfCommands = knockout.observable(); + knockout.defineProperty(this, 'numberOfCommands', { get : function() { - return showNumberOfCommands(); + return numberOfCommands(); }, set : function(val) { - showNumberOfCommands(val); + numberOfCommands(val); if (that._tileset) { that._tileset.debugShowNumberOfCommands = val; } @@ -603,7 +600,7 @@ define([ * @type {Boolean} * @default false */ - this.showNumberOfCommands = false; + this.numberOfCommands = false; var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { @@ -713,7 +710,7 @@ define([ this._definedProperties = ['propertiesText', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'showGeometricError', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', - 'onlyPickedTileInfo', 'showTextureMemory', 'showVertexMemory', 'showNumberOfPoints', 'showNumberOfTriangles', 'showNumberOfCommands']; + 'onlyPickedTileInfo', 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); @@ -795,14 +792,14 @@ define([ 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', + 'showGeometricError', 'freezeFrame', 'onlyPickedTileInfo', - 'showGeometricError', - 'showTextureMemory', - 'showVertexMemory', - 'showNumberOfPoints', - 'showNumberOfTriangles', - 'showNumberOfCommands']; + 'textureMemory', + 'vertexMemory', + 'numberOfPoints', + 'numberOfTriangles', + 'numberOfCommands']; var length = settings.length; for (var i = 0; i < length; ++i) { var setting = settings[i]; @@ -922,72 +919,6 @@ define([ } }; - /** - * Updates the debug labels - */ - var scratchCartesian = new Cartesian3(); - Cesium3DTilesInspectorViewModel.prototype.updateTileInfoLabels = function() { - var selectedTiles = this._tileset._selectedTiles; - var length = selectedTiles.length; - this._tileInfoLabels.removeAll(); - for (var i = 0; i < length; ++i) { - var tile = selectedTiles[i]; - var boundingVolume = tile._boundingVolume.boundingVolume; - var halfAxes = boundingVolume.halfAxes; - var radius = boundingVolume.radius; - - var position = Cartesian3.clone(boundingVolume.center, scratchCartesian); - if (defined(halfAxes)) { - position.x += 0.75 * (halfAxes[0] + halfAxes[3] + halfAxes[6]); - position.y += 0.75 * (halfAxes[1] + halfAxes[4] + halfAxes[7]); - position.z += 0.75 * (halfAxes[2] + halfAxes[5] + halfAxes[8]); - } else if (defined(radius)) { - var normal = Cartesian3.normalize(boundingVolume.center, scratchCartesian); - normal = Cartesian3.multiplyByScalar(normal, 0.75 * radius, scratchCartesian); - position = Cartesian3.add(normal, boundingVolume.center, scratchCartesian); - } - - //debugger; - - var labelString = ""; - var attribCounter = 0; - - if (this.showGeometricError) { - labelString += "\nGeometric error: " + tile.geometricError.toString(); - attribCounter++; - } - if (this.showNumberOfCommands) { - labelString += "\nCommands: " + tile.content.commandsLength.toString(); - attribCounter++; - } - if (this.showNumberOfPoints) { - labelString += "\nPoints: " + tile.content.pointsLength.toString(); - attribCounter++; - } - if (this.showNumberOfTriangles) { - labelString += "\nTriangles: " + tile.content.trianglesLength.toString(); - attribCounter++; - } - if (this.showTextureMemory) { - labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); - attribCounter++; - } - if (this.showVertexMemory) { - labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); - attribCounter++; - } - - this._tileInfoLabels.add({ - text: labelString.substring(1), - position: position, - font : (18-attribCounter).toString() + 'px sans-serif', - showBackground: true, - disableDepthTestDistance : Number.POSITIVE_INFINITY - }); - } - this._tileInfoLabels.update(this._scene.frameState); - } - /** * Compiles the style in the style editor */ @@ -1082,16 +1013,6 @@ define([ tileset._styleEngine.makeDirty(); this._shouldStyle = false; } - - if (this.showGeometricError || this.showNumberOfCommands || this.showNumberOfPoints || this.showNumberOfTriangles || - this.showTextureMemory || this.showVertexMemory) { - if (!defined(this._tileInfoLabels)) { - this._tileInfoLabels = new LabelCollection(); - } - this.updateTileInfoLabels(); - } else { - this._tileInfoLabels = this._tileInfoLabels && this._tileInfoLabels.destroy(); - } } if (this.showStats) { this._statsText = getStats(tileset, false); From 84922032cbeb277cdf985b543ba168bfea11d9b0 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 27 Apr 2017 15:03:06 -0400 Subject: [PATCH 09/19] Revert "removing the original debug labels" This reverts commit f627ddd8510b75dd1be4075c594136b436ba9037. --- Source/Scene/Cesium3DTileset.js | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 442dd6c2bdbb..7d9d2a291c5a 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1902,6 +1902,68 @@ define([ updatePointAndFeatureCounts(tileset, content, true, true); } + var scratchCartesian2 = new Cartesian3(); + + function updateTileInfoLabels(tileset, frameState) { + var selectedTiles = tileset._selectedTiles; + var length = selectedTiles.length; + tileset._tileInfoLabels.removeAll(); + for (var i = 0; i < length; ++i) { + var tile = selectedTiles[i]; + var boundingVolume = tile._boundingVolume.boundingVolume; + var halfAxes = boundingVolume.halfAxes; + var radius = boundingVolume.radius; + + var position = Cartesian3.clone(boundingVolume.center, scratchCartesian2); + if (defined(halfAxes)) { + position.x += 0.75 * (halfAxes[0] + halfAxes[3] + halfAxes[6]); + position.y += 0.75 * (halfAxes[1] + halfAxes[4] + halfAxes[7]); + position.z += 0.75 * (halfAxes[2] + halfAxes[5] + halfAxes[8]); + } else if (defined(radius)) { + var normal = Cartesian3.normalize(boundingVolume.center, scratchCartesian2); + normal = Cartesian3.multiplyByScalar(normal, 0.75 * radius, scratchCartesian2); + position = Cartesian3.add(normal, boundingVolume.center, scratchCartesian2); + } + + var labelString = ""; + var attribCounter = 0; + + if (tileset.debugShowGeometricError) { + labelString += "\nGeometric error: " + tile.geometricError.toString(); + attribCounter++; + } + if (tileset.debugShowNumberOfCommands) { + labelString += "\nCommands: " + tile.content.commandsLength.toString(); + attribCounter++; + } + if (tileset.debugShowNumberOfPoints) { + labelString += "\nPoints: " + tile.content.pointsLength.toString(); + attribCounter++; + } + if (tileset.debugShowNumberOfTriangles) { + labelString += "\nTriangles: " + tile.content.trianglesLength.toString(); + attribCounter++; + } + if (tileset.debugShowTextureMemoryUsage) { + labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); + attribCounter++; + } + if (tileset.debugShowVertexMemoryUsage) { + labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); + attribCounter++; + } + + tileset._tileInfoLabels.add({ + text: labelString.substring(1), + position: position, + font : (18-attribCounter).toString() + 'px sans-serif', + showBackground: true, + disableDepthTestDistance : Number.POSITIVE_INFINITY + }); + } + tileset._tileInfoLabels.update(frameState); + } + var stencilClearCommand = new ClearCommand({ stencil : 0, pass : Pass.CESIUM_3D_TILE @@ -1983,6 +2045,16 @@ define([ // Number of commands added by each update above tileset._statistics.numberOfCommands = (commandList.length - numberOfInitialCommands); + + if (tileset.debugShowGeometricError || tileset.debugShowNumberOfCommands || tileset.debugShowTextureMemoryUsage || + tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles) { + if (!defined(tileset._tileInfoLabels)) { + tileset._tileInfoLabels = new LabelCollection(); + } + updateTileInfoLabels(tileset, frameState); + } else { + tileset._tileInfoLabels = tileset._tileInfoLabels && tileset._tileInfoLabels.destroy(); + } } function unloadTiles(tileset, frameState) { From ca38f1a1f24657831791c8906056a15d58ffe525 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Thu, 27 Apr 2017 16:03:11 -0400 Subject: [PATCH 10/19] fix jshint --- Specs/Scene/Cesium3DTilesetSpec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 0986a33e7118..5bf07a84c5f3 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1504,9 +1504,9 @@ defineSuite([ tileset.debugShowGeometricError = false; tileset.debugShowNumberOfCommands = false; - tileset.debugShowNumberOfPoints = false + tileset.debugShowNumberOfPoints = false; tileset.debugShowNumberOfTriangles = false; - tileset.debugShowTextureMemoryUsage = false + tileset.debugShowTextureMemoryUsage = false; tileset.debugShowVertexMemoryUsage = false; scene.renderForSpecs(); expect(tileset._tileInfoLabels).not.toBeDefined(); From 134288f6238a1e6132cb38345ea17d345edbdf84 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Fri, 28 Apr 2017 10:13:24 -0400 Subject: [PATCH 11/19] cleanup --- Source/Scene/Batched3DModel3DTileContent.js | 14 --- Source/Scene/Cesium3DTile.js | 4 +- Source/Scene/Cesium3DTileContent.js | 14 --- Source/Scene/Cesium3DTileset.js | 44 +++---- Source/Scene/Composite3DTileContent.js | 12 -- Source/Scene/Empty3DTileContent.js | 10 -- Source/Scene/Instanced3DModel3DTileContent.js | 13 --- Source/Scene/PointCloud3DTileContent.js | 10 -- Source/Scene/Tileset3DTileContent.js | 10 -- .../Cesium3DTilesInspector.js | 6 +- .../Cesium3DTilesInspectorViewModel.js | 109 +++++++----------- Specs/Scene/Cesium3DTilesetSpec.js | 89 +++++++------- 12 files changed, 118 insertions(+), 217 deletions(-) diff --git a/Source/Scene/Batched3DModel3DTileContent.js b/Source/Scene/Batched3DModel3DTileContent.js index d5ce558a6f06..1eb2269c1499 100644 --- a/Source/Scene/Batched3DModel3DTileContent.js +++ b/Source/Scene/Batched3DModel3DTileContent.js @@ -61,8 +61,6 @@ define([ this.batchTable = undefined; this.featurePropertiesDirty = false; - this._commandsLength = 0; - this._features = undefined; initialize(this, arrayBuffer, byteOffset); @@ -99,18 +97,6 @@ define([ } }, - /** - * Part of the {@link Cesium3DTileContent} interface. - */ - commandsLength : { - get : function() { - return this._commandsLength; - }, - set : function(val) { - this._commandsLength = val; - } - }, - /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/Cesium3DTile.js b/Source/Scene/Cesium3DTile.js index 3d9f10520d2e..5b988f00d80b 100644 --- a/Source/Scene/Cesium3DTile.js +++ b/Source/Scene/Cesium3DTile.js @@ -142,6 +142,8 @@ define([ } this._viewerRequestVolume = viewerRequestVolume; + this._commandsLength = 0; + /** * The error, in meters, introduced if this tile is rendered and its children are not. * This is used to compute Screen-Space Error (SSE), i.e., the error measured in pixels. @@ -855,7 +857,7 @@ define([ applyDebugSettings(this, tileset, frameState); this._content.update(tileset, frameState); this._transformDirty = false; - this._content.commandsLength = frameState.commandList.length - initCommandLength; + this._commandsLength = frameState.commandList.length - initCommandLength; }; var scratchCommandList = []; diff --git a/Source/Scene/Cesium3DTileContent.js b/Source/Scene/Cesium3DTileContent.js index bbfb477f2d4a..c7c548c24e7d 100644 --- a/Source/Scene/Cesium3DTileContent.js +++ b/Source/Scene/Cesium3DTileContent.js @@ -96,20 +96,6 @@ define([ } }, - /** - * Gets the number of commands used by the tile. - * - * @memberof Cesium3DTileContent.prototype - * - * @type {Number} - * @readonly - */ - commandsLength : { - get : function() { - DeveloperError.throwInstantiationError(); - } - }, - /** * Gets the tile's vertex memory in bytes. * diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 9c0d379250ce..74dac38f0753 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -417,7 +417,7 @@ define([ /** * This property is for debugging only; it is not optimized for production use. *

- * When true, draws labels to indicate the number of triangles in each tile. + * When true, draws labels to indicate the number of points in each tile. *

* * @type {Boolean} @@ -425,7 +425,6 @@ define([ */ this.debugShowNumberOfPoints = defaultValue(options.debugShowNumberOfPoints, false); - /** * This property is for debugging only; it is not optimized for production use. *

@@ -1915,39 +1914,39 @@ define([ position = Cartesian3.add(normal, boundingVolume.center, scratchCartesian2); } - var labelString = ""; - var attribCounter = 0; + var labelString = ''; + var attributes = 0; if (tileset.debugShowGeometricError) { - labelString += "\nGeometric error: " + tile.geometricError.toString(); - attribCounter++; + labelString += "\nGeometric error: " + tile.geometricError; + attributes++; } if (tileset.debugShowNumberOfCommands) { - labelString += "\nCommands: " + tile.content.commandsLength.toString(); - attribCounter++; + labelString += "\nCommands: " + tile._commandsLength; + attributes++; } if (tileset.debugShowNumberOfPoints) { - labelString += "\nPoints: " + tile.content.pointsLength.toString(); - attribCounter++; + labelString += "\nPoints: " + tile.content.pointsLength; + attributes++; } if (tileset.debugShowNumberOfTriangles) { - labelString += "\nTriangles: " + tile.content.trianglesLength.toString(); - attribCounter++; + labelString += "\nTriangles: " + tile.content.trianglesLength; + attributes++; } if (tileset.debugShowTextureMemoryUsage) { - labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes.toString(); - attribCounter++; + labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes; + attributes++; } if (tileset.debugShowVertexMemoryUsage) { - labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes.toString(); - attribCounter++; + labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes; + attributes++; } tileset._tileInfoLabels.add({ - text: labelString.substring(1), - position: position, - font : (18-attribCounter).toString() + 'px sans-serif', - showBackground: true, + text : labelString.substring(1), + position : position, + font : (18-attributes) + 'px sans-serif', + showBackground : true, disableDepthTestDistance : Number.POSITIVE_INFINITY }); } @@ -2204,6 +2203,11 @@ define([ * @see Cesium3DTileset#isDestroyed */ Cesium3DTileset.prototype.destroy = function() { + // Destroy debug labels + if (defined(this._tileInfoLabels)) { + this._tileInfoLabels.destroy(); + } + // Traverse the tree and destroy all tiles if (defined(this._root)) { var stack = scratchStack; diff --git a/Source/Scene/Composite3DTileContent.js b/Source/Scene/Composite3DTileContent.js index 65a530a24c7e..fa3fdc0c1ba4 100644 --- a/Source/Scene/Composite3DTileContent.js +++ b/Source/Scene/Composite3DTileContent.js @@ -86,18 +86,6 @@ define([ } }, - /** - * Part of the {@link Cesium3DTileContent} interface. Composite3DTileContent - * always returns 0. Instead call pointsLength for a tile in the composite. - */ - commandsLength : { - get : function() { - return 0; - }, - set : function(val) {} - }, - - /** * Part of the {@link Cesium3DTileContent} interface. Composite3DTileContent * always returns 0. Instead call pointsLength for a tile in the composite. diff --git a/Source/Scene/Empty3DTileContent.js b/Source/Scene/Empty3DTileContent.js index fbdb0555f040..6f24e3ea4568 100644 --- a/Source/Scene/Empty3DTileContent.js +++ b/Source/Scene/Empty3DTileContent.js @@ -35,16 +35,6 @@ define([ } }, - /** - * Part of the {@link Cesium3DTileContent} interface. - */ - commandsLength : { - get : function() { - return 0; - }, - set : function(val) {} - }, - /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/Instanced3DModel3DTileContent.js b/Source/Scene/Instanced3DModel3DTileContent.js index 8a5118ce8c27..159cde458419 100644 --- a/Source/Scene/Instanced3DModel3DTileContent.js +++ b/Source/Scene/Instanced3DModel3DTileContent.js @@ -82,7 +82,6 @@ define([ this.featurePropertiesDirty = false; this._features = undefined; - this._commandsLength = 0; initialize(this, arrayBuffer, byteOffset); } @@ -97,18 +96,6 @@ define([ } }, - /** - * Part of the {@link Cesium3DTileContent} interface. - */ - commandsLength : { - get : function() { - return this._commandsLength; - }, - set : function(val) { - this._commandsLength = val; - } - }, - /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 322e9f24e70b..8494a9e03037 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -144,16 +144,6 @@ define([ } }, - /** - * Part of the {@link Cesium3DTileContent} interface. - */ - commandsLength : { - get : function() { - return 1; - }, - set : function(val) {} - }, - /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Scene/Tileset3DTileContent.js b/Source/Scene/Tileset3DTileContent.js index 86682b766db9..2b0bb78d644a 100644 --- a/Source/Scene/Tileset3DTileContent.js +++ b/Source/Scene/Tileset3DTileContent.js @@ -53,16 +53,6 @@ define([ } }, - /** - * Part of the {@link Cesium3DTileContent} interface. - */ - commandsLength : { - get : function() { - return 0; - }, - set : function(val) {} - }, - /** * Part of the {@link Cesium3DTileContent} interface. */ diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index b5a34689e23c..72c1577dba84 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -199,7 +199,7 @@ define([ tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); tileInfoPanelContents.appendChild(makeCheckbox('textureMemory', 'Texture Memory Usage')); tileInfoPanelContents.appendChild(makeCheckbox('vertexMemory', 'Vertex Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfCommands', 'Number of Commands')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfCommands', 'Number Of Commands')); tileInfoPanelContents.appendChild(makeCheckbox('numberOfPoints', 'Number Of Points')); tileInfoPanelContents.appendChild(makeCheckbox('numberOfTriangles', 'Number Of Triangles')); @@ -207,16 +207,16 @@ define([ var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); var updatePanel = makeSection('Update', 'updateVisible', 'toggleUpdate', updatePanelContents); var loggingPanel = makeSection('Logging', 'loggingVisible', 'toggleLogging', loggingPanelContents); - var stylePanel = makeSection('Style', 'styleVisible', 'toggleStyle', stylePanelContents); var tileInfoPanel = makeSection('Tile Info', 'tileInfoVisible', 'toggleTileInfo', tileInfoPanelContents); + var stylePanel = makeSection('Style', 'styleVisible', 'toggleStyle', stylePanelContents); // first add and bind all the toggleable panels element.appendChild(tilesetPanel); element.appendChild(displayPanel); element.appendChild(updatePanel); element.appendChild(loggingPanel); - element.appendChild(stylePanel); element.appendChild(tileInfoPanel); + element.appendChild(stylePanel); knockout.applyBindings(viewModel, element); } diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 421aa1796239..59233ab8b8f7 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -230,7 +230,6 @@ define([ */ this.tileInfoVisible = false; - /** * Gets or sets the JSON for the tileset style. This property is observable. * @@ -327,7 +326,6 @@ define([ } }); - /** * Gets or sets the flag to enable picking. This property is observable. * @@ -439,26 +437,6 @@ define([ */ this.showRequestVolumes = false; - var showGeometricError = knockout.observable(); - knockout.defineProperty(this, 'showGeometricError', { - get : function() { - return showGeometricError(); - }, - set : function(value) { - showGeometricError(value); - if (that._tileset) { - that._tileset.debugShowGeometricError = value; - } - } - }); - /** - * Gets or sets the flag to show tile geometric error. This property is observable. - * - * @type {Boolean} - * @default false - */ - this.showGeometricError = false; - var freezeFrame = knockout.observable(); knockout.defineProperty(this, 'freezeFrame', { get : function() { @@ -480,36 +458,35 @@ define([ */ this.freezeFrame = false; - var onlyPickedTileInfo = knockout.observable(); - knockout.defineProperty(this, 'onlyPickedTileInfo', { + var showGeometricError = knockout.observable(); + knockout.defineProperty(this, 'showGeometricError', { get : function() { - return onlyPickedTileInfo(); + return showGeometricError(); }, - set : function(val) { - onlyPickedTileInfo(val); + set : function(value) { + showGeometricError(value); if (that._tileset) { - that._tileset.debugShowOnlyPickedTile = val; + that._tileset.debugShowGeometricError = value; } } }); /** - * Displays tile info for only picked tile. This property is observable. - * @memberof Cesium3DTilesInspectorViewModel.prototype + * Gets or sets the flag to show tile geometric error. This property is observable. * * @type {Boolean} * @default false */ - this.onlyPickedTileInfo = false; + this.showGeometricError = false; var textureMemory = knockout.observable(); knockout.defineProperty(this, 'textureMemory', { get : function() { return textureMemory(); }, - set : function(val) { - textureMemory(val); + set : function(value) { + textureMemory(value); if (that._tileset) { - that._tileset.debugShowTextureMemoryUsage = val; + that._tileset.debugShowTextureMemoryUsage = value; } } }); @@ -522,89 +499,89 @@ define([ */ this.textureMemory = false; - var numberOfTriangles = knockout.observable(); - knockout.defineProperty(this, 'numberOfTriangles', { + var vertexMemory = knockout.observable(); + knockout.defineProperty(this, 'vertexMemory', { get : function() { - return numberOfTriangles(); + return vertexMemory(); }, - set : function(val) { - numberOfTriangles(val); + set : function(value) { + vertexMemory(value); if (that._tileset) { - that._tileset.debugShowNumberOfTriangles = val; + that._tileset.debugShowVertexMemoryUsage = value; } } }); /** - * Displays the number of triangles per tile. This property is observable. + * Displays the vertex memory used per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.numberOfTriangles = false; + this.vertexMemory = false; - var numberOfPoints = knockout.observable(); - knockout.defineProperty(this, 'numberOfPoints', { + var numberOfCommands = knockout.observable(); + knockout.defineProperty(this, 'numberOfCommands', { get : function() { - return numberOfPoints(); + return numberOfCommands(); }, - set : function(val) { - numberOfPoints(val); + set : function(value) { + numberOfCommands(value); if (that._tileset) { - that._tileset.debugShowNumberOfPoints = val; + that._tileset.debugShowNumberOfCommands = value; } } }); /** - * Displays the number of points per tile. This property is observable. + * Displays the number of commands used per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.numberOfPoints = false; + this.numberOfCommands = false; - var vertexMemory = knockout.observable(); - knockout.defineProperty(this, 'vertexMemory', { + var numberOfPoints = knockout.observable(); + knockout.defineProperty(this, 'numberOfPoints', { get : function() { - return vertexMemory(); + return numberOfPoints(); }, - set : function(val) { - vertexMemory(val); + set : function(value) { + numberOfPoints(value); if (that._tileset) { - that._tileset.debugShowVertexMemoryUsage = val; + that._tileset.debugShowNumberOfPoints = value; } } }); /** - * Displays the vertex memory used per tile. This property is observable. + * Displays the number of points per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.vertexMemory = false; + this.numberOfPoints = false; - var numberOfCommands = knockout.observable(); - knockout.defineProperty(this, 'numberOfCommands', { + var numberOfTriangles = knockout.observable(); + knockout.defineProperty(this, 'numberOfTriangles', { get : function() { - return numberOfCommands(); + return numberOfTriangles(); }, - set : function(val) { - numberOfCommands(val); + set : function(value) { + numberOfTriangles(value); if (that._tileset) { - that._tileset.debugShowNumberOfCommands = val; + that._tileset.debugShowNumberOfTriangles = value; } } }); /** - * Displays the number of commands used per tile. This property is observable. + * Displays the number of triangles per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.numberOfCommands = false; + this.numberOfTriangles = false; var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 5bf07a84c5f3..745bb42ff15b 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1324,11 +1324,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError.toString()); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: ' + root.children[1].geometricError.toString()); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: ' + root.children[2].geometricError.toString()); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: ' + root.children[3].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: ' + root.children[1].geometricError); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: ' + root.children[2].geometricError); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: ' + root.children[3].geometricError); tileset.debugShowGeometricError = false; scene.renderForSpecs(); @@ -1345,8 +1345,8 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(2); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError); tileset.debugShowGeometricError = false; scene.renderForSpecs(); @@ -1363,12 +1363,12 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(6); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError.toString()); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: ' + root.children[1].geometricError.toString()); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: ' + root.children[2].geometricError.toString()); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: ' + root.children[3].geometricError.toString()); - expect(tileset._tileInfoLabels._labels[5].text).toEqual('Geometric error: ' + root.children[4].geometricError.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + root.geometricError); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Geometric error: ' + root.children[0].geometricError); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Geometric error: ' + root.children[1].geometricError); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Geometric error: ' + root.children[2].geometricError); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Geometric error: ' + root.children[3].geometricError); + expect(tileset._tileInfoLabels._labels[5].text).toEqual('Geometric error: ' + root.children[4].geometricError); tileset.debugShowGeometricError = false; scene.renderForSpecs(); @@ -1385,11 +1385,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Commands: ' + root.content.commandsLength.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Commands: ' + root.children[0].content.commandsLength.toString()); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Commands: ' + root.children[1].content.commandsLength.toString()); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Commands: ' + root.children[2].content.commandsLength.toString()); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Commands: ' + root.children[3].content.commandsLength.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Commands: ' + root._commandsLength); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Commands: ' + root.children[0]._commandsLength); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Commands: ' + root.children[1]._commandsLength); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Commands: ' + root.children[2]._commandsLength); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Commands: ' + root.children[3]._commandsLength); tileset.debugShowNumberOfCommands = false; scene.renderForSpecs(); @@ -1406,11 +1406,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Triangles: ' + root.content.trianglesLength.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Triangles: ' + root.children[0].content.trianglesLength.toString()); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Triangles: ' + root.children[1].content.trianglesLength.toString()); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Triangles: ' + root.children[2].content.trianglesLength.toString()); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Triangles: ' + root.children[3].content.trianglesLength.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Triangles: ' + root.content.trianglesLength); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Triangles: ' + root.children[0].content.trianglesLength); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Triangles: ' + root.children[1].content.trianglesLength); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Triangles: ' + root.children[2].content.trianglesLength); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Triangles: ' + root.children[3].content.trianglesLength); tileset.debugShowNumberOfTriangles = false; scene.renderForSpecs(); @@ -1427,11 +1427,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Points: ' + root.content.pointsLength.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Points: ' + root.children[0].content.pointsLength.toString()); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Points: ' + root.children[1].content.pointsLength.toString()); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Points: ' + root.children[2].content.pointsLength.toString()); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Points: ' + root.children[3].content.pointsLength.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Points: ' + root.content.pointsLength); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Points: ' + root.children[0].content.pointsLength); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Points: ' + root.children[1].content.pointsLength); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Points: ' + root.children[2].content.pointsLength); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Points: ' + root.children[3].content.pointsLength); tileset.debugShowNumberOfPoints = false; scene.renderForSpecs(); @@ -1448,11 +1448,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Texture Memory: ' + root.content.textureMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Texture Memory: ' + root.children[0].content.textureMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Texture Memory: ' + root.children[1].content.textureMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Texture Memory: ' + root.children[2].content.textureMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Texture Memory: ' + root.children[3].content.textureMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Texture Memory: ' + root.content.textureMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Texture Memory: ' + root.children[0].content.textureMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Texture Memory: ' + root.children[1].content.textureMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Texture Memory: ' + root.children[2].content.textureMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Texture Memory: ' + root.children[3].content.textureMemorySizeInBytes); tileset.debugShowTextureMemoryUsage = false; scene.renderForSpecs(); @@ -1469,11 +1469,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Vertex Memory: ' + root.content.vertexMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Vertex Memory: ' + root.children[0].content.vertexMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Vertex Memory: ' + root.children[1].content.vertexMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Vertex Memory: ' + root.children[2].content.vertexMemorySizeInBytes.toString()); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Vertex Memory: ' + root.children[3].content.vertexMemorySizeInBytes.toString()); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Vertex Memory: ' + root.content.vertexMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Vertex Memory: ' + root.children[0].content.vertexMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Vertex Memory: ' + root.children[1].content.vertexMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Vertex Memory: ' + root.children[2].content.vertexMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Vertex Memory: ' + root.children[3].content.vertexMemorySizeInBytes); tileset.debugShowVertexMemoryUsage = false; scene.renderForSpecs(); @@ -1495,12 +1495,13 @@ defineSuite([ expect(tileset._tileInfoLabels).toBeDefined(); var content = tileset._root.content; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Geometric error: ' + tileset._root.geometricError.toString() + '\n' + - 'Commands: ' + content.commandsLength.toString() + '\n' + - 'Points: ' + content.pointsLength.toString() + '\n' + - 'Triangles: ' + content.trianglesLength.toString() + '\n' + - 'Texture Memory: ' + content.textureMemorySizeInBytes.toString() + '\n' + - 'Vertex Memory: ' + content.vertexMemorySizeInBytes.toString()); + var expected = 'Geometric error: ' + tileset._root.geometricError + '\n' + + 'Commands: ' + tileset._root._commandsLength + '\n' + + 'Points: ' + content.pointsLength + '\n' + + 'Triangles: ' + content.trianglesLength + '\n' + + 'Texture Memory: ' + content.textureMemorySizeInBytes + '\n' + + 'Vertex Memory: ' + content.vertexMemorySizeInBytes; + expect(tileset._tileInfoLabels._labels[0].text).toEqual(expected); tileset.debugShowGeometricError = false; tileset.debugShowNumberOfCommands = false; From 471984160dbbaee915d1ae94b00db3d896c79e37 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Fri, 28 Apr 2017 10:38:09 -0400 Subject: [PATCH 12/19] adding feature count to debug labels --- Source/Scene/Cesium3DTileset.js | 20 ++++++++++++++-- .../Cesium3DTilesInspector.js | 5 ++-- .../Cesium3DTilesInspectorViewModel.js | 23 +++++++++++++++++- Specs/Scene/Cesium3DTilesetSpec.js | 24 +++++++++++++++++++ 4 files changed, 67 insertions(+), 5 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 74dac38f0753..99acd50d8871 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -436,6 +436,17 @@ define([ */ this.debugShowNumberOfTriangles = defaultValue(options.debugShowNumberOfTriangles, false); + /** + * This property is for debugging only; it is not optimized for production use. + *

+ * When true, draws labels to indicate the number of features in each tile. + *

+ * + * @type {Boolean} + * @default false + */ + this.debugShowNumberOfFeatures = defaultValue(options.debugShowNumberOfFeatures, false); + /** * This property is for debugging only; it is not optimized for production use. *

@@ -1933,6 +1944,10 @@ define([ labelString += "\nTriangles: " + tile.content.trianglesLength; attributes++; } + if (tileset.debugShowNumberOfFeatures) { + labelString += "\nFeatures: " + tile.content.featuresLength; + attributes++; + } if (tileset.debugShowTextureMemoryUsage) { labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes; attributes++; @@ -1945,7 +1960,7 @@ define([ tileset._tileInfoLabels.add({ text : labelString.substring(1), position : position, - font : (18-attributes) + 'px sans-serif', + font : (19-attributes) + 'px sans-serif', showBackground : true, disableDepthTestDistance : Number.POSITIVE_INFINITY }); @@ -2036,7 +2051,8 @@ define([ tileset._statistics.numberOfCommands = (commandList.length - numberOfInitialCommands); if (tileset.debugShowGeometricError || tileset.debugShowNumberOfCommands || tileset.debugShowTextureMemoryUsage || - tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles) { + tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles || + tileset.debugShowNumberOfFeatures) { if (!defined(tileset._tileInfoLabels)) { tileset._tileInfoLabels = new LabelCollection(); } diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index 72c1577dba84..c477d2e119bb 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -197,11 +197,12 @@ define([ stylePanelContents.appendChild(errorBox); tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); - tileInfoPanelContents.appendChild(makeCheckbox('textureMemory', 'Texture Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('vertexMemory', 'Vertex Memory Usage')); tileInfoPanelContents.appendChild(makeCheckbox('numberOfCommands', 'Number Of Commands')); tileInfoPanelContents.appendChild(makeCheckbox('numberOfPoints', 'Number Of Points')); tileInfoPanelContents.appendChild(makeCheckbox('numberOfTriangles', 'Number Of Triangles')); + tileInfoPanelContents.appendChild(makeCheckbox('numberOfFeatures', 'Number Of Features')); + tileInfoPanelContents.appendChild(makeCheckbox('textureMemory', 'Texture Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('vertexMemory', 'Vertex Memory Usage')); var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents); var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 59233ab8b8f7..6b149bfe0897 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -583,6 +583,27 @@ define([ */ this.numberOfTriangles = false; + var numberOfFeatures = knockout.observable(); + knockout.defineProperty(this, 'numberOfFeatures', { + get : function() { + return numberOfFeatures(); + }, + set : function(value) { + numberOfFeatures(value); + if (that._tileset) { + that._tileset.debugShowNumberOfFeatures = value; + } + } + }); + /** + * Displays the number of features per tile. This property is observable. + * @memberof Cesium3DTilesInspectorViewModel.prototype + * + * @type {Boolean} + * @default false + */ + this.numberOfFeatures = false; + var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { get : function() { @@ -689,7 +710,7 @@ define([ this._definedProperties = ['properties', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'showGeometricError', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', - 'onlyPickedTileInfo', 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands']; + 'onlyPickedTileInfo', 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands', 'numberOfFeatures']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 745bb42ff15b..857a2040f0d2 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1439,6 +1439,27 @@ defineSuite([ }); }); + it('show tile info labels with number of features', function() { + // tilesetUrl has bounding regions + return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { + tileset.debugShowNumberOfFeatures = true; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).toBeDefined(); + expect(tileset._tileInfoLabels.length).toEqual(5); + + var root = tileset._root; + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Features: ' + root.content.featuresLength); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Features: ' + root.children[0].content.featuresLength); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Features: ' + root.children[1].content.featuresLength); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Features: ' + root.children[2].content.featuresLength); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Features: ' + root.children[3].content.featuresLength); + + tileset.debugShowNumberOfFeatures = false; + scene.renderForSpecs(); + expect(tileset._tileInfoLabels).not.toBeDefined(); + }); + }); + it('show tile info labels with texture memory usage', function() { // tilesetUrl has bounding regions return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { @@ -1488,6 +1509,7 @@ defineSuite([ tileset.debugShowNumberOfCommands = true; tileset.debugShowNumberOfPoints = true; tileset.debugShowNumberOfTriangles = true; + tileset.debugShowNumberOfFeatures = true; tileset.debugShowTextureMemoryUsage = true; tileset.debugShowVertexMemoryUsage = true; viewRootOnly(); @@ -1499,6 +1521,7 @@ defineSuite([ 'Commands: ' + tileset._root._commandsLength + '\n' + 'Points: ' + content.pointsLength + '\n' + 'Triangles: ' + content.trianglesLength + '\n' + + 'Features: ' + content.featuresLength + '\n' + 'Texture Memory: ' + content.textureMemorySizeInBytes + '\n' + 'Vertex Memory: ' + content.vertexMemorySizeInBytes; expect(tileset._tileInfoLabels._labels[0].text).toEqual(expected); @@ -1507,6 +1530,7 @@ defineSuite([ tileset.debugShowNumberOfCommands = false; tileset.debugShowNumberOfPoints = false; tileset.debugShowNumberOfTriangles = false; + tileset.debugShowNumberOfFeatures = false; tileset.debugShowTextureMemoryUsage = false; tileset.debugShowVertexMemoryUsage = false; scene.renderForSpecs(); From 5f901dd038e955b869796b25e30e3982361402a9 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Fri, 28 Apr 2017 10:59:14 -0400 Subject: [PATCH 13/19] tweak --- .../Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 6b149bfe0897..f14ba7f0b27a 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -710,7 +710,7 @@ define([ this._definedProperties = ['properties', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'showGeometricError', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', - 'onlyPickedTileInfo', 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands', 'numberOfFeatures']; + 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands', 'numberOfFeatures']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); From effbe7b4f2dea3b8e602c8d5113f517502323500 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Fri, 28 Apr 2017 15:09:54 -0400 Subject: [PATCH 14/19] cleanup --- Source/Scene/Cesium3DTileset.js | 16 +-- Source/Scene/Instanced3DModel3DTileContent.js | 1 - .../Cesium3DTilesInspector.js | 14 +-- .../Cesium3DTilesInspectorViewModel.js | 104 +++++++++--------- 4 files changed, 67 insertions(+), 68 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 99acd50d8871..ff7a788af865 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1929,31 +1929,31 @@ define([ var attributes = 0; if (tileset.debugShowGeometricError) { - labelString += "\nGeometric error: " + tile.geometricError; + labelString += '\nGeometric error: ' + tile.geometricError; attributes++; } if (tileset.debugShowNumberOfCommands) { - labelString += "\nCommands: " + tile._commandsLength; + labelString += '\nCommands: ' + tile._commandsLength; attributes++; } if (tileset.debugShowNumberOfPoints) { - labelString += "\nPoints: " + tile.content.pointsLength; + labelString += '\nPoints: ' + tile.content.pointsLength; attributes++; } if (tileset.debugShowNumberOfTriangles) { - labelString += "\nTriangles: " + tile.content.trianglesLength; + labelString += '\nTriangles: ' + tile.content.trianglesLength; attributes++; } if (tileset.debugShowNumberOfFeatures) { - labelString += "\nFeatures: " + tile.content.featuresLength; + labelString += '\nFeatures: ' + tile.content.featuresLength; attributes++; } if (tileset.debugShowTextureMemoryUsage) { - labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes; + labelString += '\nTexture Memory: ' + tile.content.textureMemorySizeInBytes; attributes++; } if (tileset.debugShowVertexMemoryUsage) { - labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes; + labelString += '\nVertex Memory: ' + tile.content.vertexMemorySizeInBytes; attributes++; } @@ -2221,7 +2221,7 @@ define([ Cesium3DTileset.prototype.destroy = function() { // Destroy debug labels if (defined(this._tileInfoLabels)) { - this._tileInfoLabels.destroy(); + this._tileInfoLabels = this._tileInfoLabels && this._tileInfoLabels.destroy(); } // Traverse the tree and destroy all tiles diff --git a/Source/Scene/Instanced3DModel3DTileContent.js b/Source/Scene/Instanced3DModel3DTileContent.js index 159cde458419..0d9460cd806f 100644 --- a/Source/Scene/Instanced3DModel3DTileContent.js +++ b/Source/Scene/Instanced3DModel3DTileContent.js @@ -83,7 +83,6 @@ define([ this._features = undefined; initialize(this, arrayBuffer, byteOffset); - } defineProperties(Instanced3DModel3DTileContent.prototype, { diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index c477d2e119bb..f182f6a127a7 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -131,8 +131,8 @@ define([ var displayPanelContents = document.createElement('div'); var updatePanelContents = document.createElement('div'); var loggingPanelContents = document.createElement('div'); - var stylePanelContents = document.createElement('div'); var tileInfoPanelContents = document.createElement('div'); + var stylePanelContents = document.createElement('div'); var properties = document.createElement('div'); properties.className = 'field-group'; @@ -197,12 +197,12 @@ define([ stylePanelContents.appendChild(errorBox); tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfCommands', 'Number Of Commands')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfPoints', 'Number Of Points')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfTriangles', 'Number Of Triangles')); - tileInfoPanelContents.appendChild(makeCheckbox('numberOfFeatures', 'Number Of Features')); - tileInfoPanelContents.appendChild(makeCheckbox('textureMemory', 'Texture Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('vertexMemory', 'Vertex Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfCommands', 'Number of Commands')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfPoints', 'Number Of Points')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfTriangles', 'Number Of Triangles')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfFeatures', 'Number Of Features')); + tileInfoPanelContents.appendChild(makeCheckbox('showTextureMemory', 'Texture Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('showVertexMemory', 'Vertex Memory Usage')); var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents); var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index f14ba7f0b27a..04d092a429b9 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -478,131 +478,131 @@ define([ */ this.showGeometricError = false; - var textureMemory = knockout.observable(); - knockout.defineProperty(this, 'textureMemory', { + var showNumberOfCommands = knockout.observable(); + knockout.defineProperty(this, 'showNumberOfCommands', { get : function() { - return textureMemory(); + return showNumberOfCommands(); }, set : function(value) { - textureMemory(value); + showNumberOfCommands(value); if (that._tileset) { - that._tileset.debugShowTextureMemoryUsage = value; + that._tileset.debugShowNumberOfCommands = value; } } }); /** - * Displays the texture memory used per tile. This property is observable. + * Displays the number of commands used per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.textureMemory = false; + this.showNumberOfCommands = false; - var vertexMemory = knockout.observable(); - knockout.defineProperty(this, 'vertexMemory', { + var showNumberOfPoints = knockout.observable(); + knockout.defineProperty(this, 'showNumberOfPoints', { get : function() { - return vertexMemory(); + return showNumberOfPoints(); }, set : function(value) { - vertexMemory(value); + showNumberOfPoints(value); if (that._tileset) { - that._tileset.debugShowVertexMemoryUsage = value; + that._tileset.debugShowNumberOfPoints = value; } } }); /** - * Displays the vertex memory used per tile. This property is observable. + * Displays the number of points per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.vertexMemory = false; + this.showNumberOfPoints = false; - var numberOfCommands = knockout.observable(); - knockout.defineProperty(this, 'numberOfCommands', { + var showNumberOfTriangles = knockout.observable(); + knockout.defineProperty(this, 'showNumberOfTriangles', { get : function() { - return numberOfCommands(); + return showNumberOfTriangles(); }, set : function(value) { - numberOfCommands(value); + showNumberOfTriangles(value); if (that._tileset) { - that._tileset.debugShowNumberOfCommands = value; + that._tileset.debugShowNumberOfTriangles = value; } } }); /** - * Displays the number of commands used per tile. This property is observable. + * Displays the number of triangles per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.numberOfCommands = false; + this.showNumberOfTriangles = false; - var numberOfPoints = knockout.observable(); - knockout.defineProperty(this, 'numberOfPoints', { + var showNumberOfFeatures = knockout.observable(); + knockout.defineProperty(this, 'showNumberOfFeatures', { get : function() { - return numberOfPoints(); + return showNumberOfFeatures(); }, set : function(value) { - numberOfPoints(value); + showNumberOfFeatures(value); if (that._tileset) { - that._tileset.debugShowNumberOfPoints = value; + that._tileset.debugShowNumberOfFeatures = value; } } }); /** - * Displays the number of points per tile. This property is observable. + * Displays the number of features per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.numberOfPoints = false; + this.showNumberOfFeatures = false; - var numberOfTriangles = knockout.observable(); - knockout.defineProperty(this, 'numberOfTriangles', { + var showTextureMemory = knockout.observable(); + knockout.defineProperty(this, 'showTextureMemory', { get : function() { - return numberOfTriangles(); + return showTextureMemory(); }, set : function(value) { - numberOfTriangles(value); + showTextureMemory(value); if (that._tileset) { - that._tileset.debugShowNumberOfTriangles = value; + that._tileset.debugShowTextureMemoryUsage = value; } } }); /** - * Displays the number of triangles per tile. This property is observable. + * Displays the texture memory used per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.numberOfTriangles = false; + this.showTextureMemory = false; - var numberOfFeatures = knockout.observable(); - knockout.defineProperty(this, 'numberOfFeatures', { + var showVertexMemory = knockout.observable(); + knockout.defineProperty(this, 'showVertexMemory', { get : function() { - return numberOfFeatures(); + return showVertexMemory(); }, set : function(value) { - numberOfFeatures(value); + showVertexMemory(value); if (that._tileset) { - that._tileset.debugShowNumberOfFeatures = value; + that._tileset.debugShowVertexMemoryUsage = value; } } }); /** - * Displays the number of features per tile. This property is observable. + * Displays the vertex memory used per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.numberOfFeatures = false; + this.showVertexMemory = false; var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { @@ -708,9 +708,9 @@ define([ this._style = undefined; this._shouldStyle = false; this._definedProperties = ['properties', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', - 'showContentBoundingVolumes', 'showRequestVolumes', 'showGeometricError', 'freezeFrame', 'maximumScreenSpaceError', - 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', - 'textureMemory', 'vertexMemory', 'numberOfPoints', 'numberOfTriangles', 'numberOfCommands', 'numberOfFeatures']; + 'showContentBoundingVolumes', 'showRequestVolumes', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', + 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', 'showGeometricError', + 'showTextureMemory', 'showVertexMemory', 'showNumberOfCommands', 'showNumberOfPoints', 'showNumberOfTriangles', 'showNumberOfFeatures']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); @@ -816,14 +816,14 @@ define([ 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', - 'showGeometricError', 'freezeFrame', - 'onlyPickedTileInfo', - 'textureMemory', - 'vertexMemory', - 'numberOfPoints', - 'numberOfTriangles', - 'numberOfCommands']; + 'showGeometricError', + 'showNumberOfCommands', + 'showNumberOfPoints', + 'showNumberOfTriangles', + 'showNumberOfFeatures', + 'showTextureMemory', + 'showVertexMemory']; var length = settings.length; for (var i = 0; i < length; ++i) { var setting = settings[i]; From 8b0e5998ba6af8b6bfd488820bd4cfbd955b21a9 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Fri, 28 Apr 2017 15:40:13 -0400 Subject: [PATCH 15/19] switching memory usage stats to mb --- Source/Scene/Cesium3DTileset.js | 4 ++-- .../Cesium3DTilesInspector.js | 4 ++-- Specs/Scene/Cesium3DTilesetSpec.js | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index ff7a788af865..df774e03f443 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1949,11 +1949,11 @@ define([ attributes++; } if (tileset.debugShowTextureMemoryUsage) { - labelString += '\nTexture Memory: ' + tile.content.textureMemorySizeInBytes; + labelString += '\nTexture Memory: ' + (tile.content.textureMemorySizeInBytes / 1048576.0).toFixed(3); attributes++; } if (tileset.debugShowVertexMemoryUsage) { - labelString += '\nVertex Memory: ' + tile.content.vertexMemorySizeInBytes; + labelString += '\nVertex Memory: ' + (tile.content.vertexMemorySizeInBytes / 1048576.0).toFixed(3); attributes++; } diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index f182f6a127a7..158a3acaee66 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -201,8 +201,8 @@ define([ tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfPoints', 'Number Of Points')); tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfTriangles', 'Number Of Triangles')); tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfFeatures', 'Number Of Features')); - tileInfoPanelContents.appendChild(makeCheckbox('showTextureMemory', 'Texture Memory Usage')); - tileInfoPanelContents.appendChild(makeCheckbox('showVertexMemory', 'Vertex Memory Usage')); + tileInfoPanelContents.appendChild(makeCheckbox('showTextureMemory', 'Texture Memory Usage (MB)')); + tileInfoPanelContents.appendChild(makeCheckbox('showVertexMemory', 'Vertex Memory Usage (MB)')); var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents); var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 857a2040f0d2..695adc76445f 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1469,11 +1469,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Texture Memory: ' + root.content.textureMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Texture Memory: ' + root.children[0].content.textureMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Texture Memory: ' + root.children[1].content.textureMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Texture Memory: ' + root.children[2].content.textureMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Texture Memory: ' + root.children[3].content.textureMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Texture Memory: ' + (root.content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Texture Memory: ' + (root.children[0].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Texture Memory: ' + (root.children[1].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Texture Memory: ' + (root.children[2].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Texture Memory: ' + (root.children[3].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); tileset.debugShowTextureMemoryUsage = false; scene.renderForSpecs(); @@ -1490,11 +1490,11 @@ defineSuite([ expect(tileset._tileInfoLabels.length).toEqual(5); var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Vertex Memory: ' + root.content.vertexMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Vertex Memory: ' + root.children[0].content.vertexMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Vertex Memory: ' + root.children[1].content.vertexMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Vertex Memory: ' + root.children[2].content.vertexMemorySizeInBytes); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Vertex Memory: ' + root.children[3].content.vertexMemorySizeInBytes); + expect(tileset._tileInfoLabels._labels[0].text).toEqual('Vertex Memory: ' + (root.content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[1].text).toEqual('Vertex Memory: ' + (root.children[0].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[2].text).toEqual('Vertex Memory: ' + (root.children[1].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[3].text).toEqual('Vertex Memory: ' + (root.children[2].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[4].text).toEqual('Vertex Memory: ' + (root.children[3].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); tileset.debugShowVertexMemoryUsage = false; scene.renderForSpecs(); @@ -1522,8 +1522,8 @@ defineSuite([ 'Points: ' + content.pointsLength + '\n' + 'Triangles: ' + content.trianglesLength + '\n' + 'Features: ' + content.featuresLength + '\n' + - 'Texture Memory: ' + content.textureMemorySizeInBytes + '\n' + - 'Vertex Memory: ' + content.vertexMemorySizeInBytes; + 'Texture Memory: ' + (content.textureMemorySizeInBytes / 1048576.0).toFixed(3) + '\n' + + 'Vertex Memory: ' + (content.vertexMemorySizeInBytes / 1048576.0).toFixed(3); expect(tileset._tileInfoLabels._labels[0].text).toEqual(expected); tileset.debugShowGeometricError = false; From 9bf5138e92ad1f57b29c6b5f4d23b7d69e6f21d1 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Mon, 1 May 2017 16:55:24 -0400 Subject: [PATCH 16/19] clean up edits --- Source/Scene/Cesium3DTileset.js | 12 ++++++++---- .../Cesium3DTilesInspector/Cesium3DTilesInspector.js | 2 +- .../Cesium3DTilesInspectorViewModel.js | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index df774e03f443..60c45b0e4278 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -121,7 +121,13 @@ define([ * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile. * @param {Boolean} [options.debugShowContentBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile's content. * @param {Boolean} [options.debugShowViewerRequestVolume=false] For debugging only. When true, renders the viewer request volume for each tile. - * @param {Boolean} [options.debugShowGeometricError=false] For debugging only. When true, draws labels to indicate the geometric error of each tile + * @param {Boolean} [options.debugShowGeometricError=false] For debugging only. When true, draws labels to indicate the geometric error of each tile. + * @param {Boolean} [options.debugShowNumberOfCommands=false] For debugging only. When true, draws labels to indicate the number of commands used by each tile. + * @param {Boolean} [options.debugShowNumberOfPoints=false] For debugging only. When true, draws labels to indicate the number of points in each tile. + * @param {Boolean} [options.debugShowNumberOfTriangles=false] For debugging only. When true, draws labels to indicate the number of triangles in each tile. + * @param {Boolean} [options.debugShowNumberOfFeatures=false] For debugging only. When true, draws labels to indicate the number of features in each tile. + * @param {Boolean} [options.debugShowTextureMemoryUsage=false] For debugging only. When true, draws labels to indicate the texture memory in megabytes used by each tile. + * @param {Boolean} [options.debugShowVertexMemoryUsage=false] For debugging only. When true, draws labels to indicate the vertex memory in megabytes used by each tile. * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the tileset casts or receives shadows from each light source. * @param {Boolean} [options.skipLODs=true] Determines if level-of-detail skipping optimization should be used. * @param {Number} [options.skipSSEFactor=10] Multiplier defining the minimum screen space error to skip when loading tiles. Used in conjuction with skipLevels to determine which tiles to load. @@ -2220,9 +2226,7 @@ define([ */ Cesium3DTileset.prototype.destroy = function() { // Destroy debug labels - if (defined(this._tileInfoLabels)) { - this._tileInfoLabels = this._tileInfoLabels && this._tileInfoLabels.destroy(); - } + this._tileInfoLabels = this._tileInfoLabels && this._tileInfoLabels.destroy(); // Traverse the tree and destroy all tiles if (defined(this._root)) { diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index 158a3acaee66..8bff9687de34 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -197,7 +197,7 @@ define([ stylePanelContents.appendChild(errorBox); tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfCommands', 'Number of Commands')); + tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfCommands', 'Number Of Commands')); tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfPoints', 'Number Of Points')); tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfTriangles', 'Number Of Triangles')); tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfFeatures', 'Number Of Features')); diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 04d092a429b9..6f552869907f 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -710,7 +710,7 @@ define([ this._definedProperties = ['properties', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', 'showGeometricError', - 'showTextureMemory', 'showVertexMemory', 'showNumberOfCommands', 'showNumberOfPoints', 'showNumberOfTriangles', 'showNumberOfFeatures']; + 'showNumberOfCommands', 'showNumberOfPoints', 'showNumberOfTriangles', 'showNumberOfFeatures', 'showTextureMemory', 'showVertexMemory']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); From 58ce52a426266518845d895318037be6063e5148 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Tue, 2 May 2017 13:15:25 -0400 Subject: [PATCH 17/19] consolidate debug flags --- Source/Scene/Cesium3DTileset.js | 85 ++--------- .../Cesium3DTilesInspector.js | 8 +- .../Cesium3DTilesInspectorViewModel.js | 122 +++------------- Specs/Scene/Cesium3DTilesetSpec.js | 138 +++--------------- 4 files changed, 55 insertions(+), 298 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 60c45b0e4278..4c20a30668a7 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -122,12 +122,8 @@ define([ * @param {Boolean} [options.debugShowContentBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile's content. * @param {Boolean} [options.debugShowViewerRequestVolume=false] For debugging only. When true, renders the viewer request volume for each tile. * @param {Boolean} [options.debugShowGeometricError=false] For debugging only. When true, draws labels to indicate the geometric error of each tile. - * @param {Boolean} [options.debugShowNumberOfCommands=false] For debugging only. When true, draws labels to indicate the number of commands used by each tile. - * @param {Boolean} [options.debugShowNumberOfPoints=false] For debugging only. When true, draws labels to indicate the number of points in each tile. - * @param {Boolean} [options.debugShowNumberOfTriangles=false] For debugging only. When true, draws labels to indicate the number of triangles in each tile. - * @param {Boolean} [options.debugShowNumberOfFeatures=false] For debugging only. When true, draws labels to indicate the number of features in each tile. - * @param {Boolean} [options.debugShowTextureMemoryUsage=false] For debugging only. When true, draws labels to indicate the texture memory in megabytes used by each tile. - * @param {Boolean} [options.debugShowVertexMemoryUsage=false] For debugging only. When true, draws labels to indicate the vertex memory in megabytes used by each tile. + * @param {Boolean} [options.debugShowRenderingStatistics=false] For debugging only. When true, draws labels to indicate the number of commands, points, triangles and features for each tile. + * @param {Boolean} [options.debugShowMemoryUsage=false] For debugging only. When true, draws labels to indicate the texture and vertex memory in megabytes used by each tile. * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the tileset casts or receives shadows from each light source. * @param {Boolean} [options.skipLODs=true] Determines if level-of-detail skipping optimization should be used. * @param {Number} [options.skipSSEFactor=10] Multiplier defining the minimum screen space error to skip when loading tiles. Used in conjuction with skipLevels to determine which tiles to load. @@ -412,68 +408,24 @@ define([ /** * This property is for debugging only; it is not optimized for production use. *

- * When true, draws labels to indicate the number of commands used. + * When true, draws labels to indicate the number of commands, points, triangles and features for this tile. *

* * @type {Boolean} * @default false */ - this.debugShowNumberOfCommands = defaultValue(options.debugShowNumberOfCommands, false); + this.debugShowRenderingStatistics = defaultValue(options.debugShowRenderingStatistics, false); /** * This property is for debugging only; it is not optimized for production use. *

- * When true, draws labels to indicate the number of points in each tile. + * When true, draws labels to indicate the vertex and texture memory usage. *

* * @type {Boolean} * @default false */ - this.debugShowNumberOfPoints = defaultValue(options.debugShowNumberOfPoints, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, draws labels to indicate the number of triangles in each tile. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowNumberOfTriangles = defaultValue(options.debugShowNumberOfTriangles, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, draws labels to indicate the number of features in each tile. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowNumberOfFeatures = defaultValue(options.debugShowNumberOfFeatures, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, draws labels to indicate the texture memory usage. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowTextureMemoryUsage = defaultValue(options.debugShowTextureMemoryUsage, false); - - /** - * This property is for debugging only; it is not optimized for production use. - *

- * When true, draws labels to indicate the vertex memory usage. - *

- * - * @type {Boolean} - * @default false - */ - this.debugShowVertexMemoryUsage = defaultValue(options.debugShowVertexMemoryUsage, false); + this.debugShowMemoryUsage = defaultValue(options.debugShowMemoryUsage, false); /** * The event fired to indicate progress of loading new tiles. This event is fired when a new tile @@ -1938,29 +1890,18 @@ define([ labelString += '\nGeometric error: ' + tile.geometricError; attributes++; } - if (tileset.debugShowNumberOfCommands) { + if (tileset.debugShowRenderingStatistics) { labelString += '\nCommands: ' + tile._commandsLength; - attributes++; - } - if (tileset.debugShowNumberOfPoints) { labelString += '\nPoints: ' + tile.content.pointsLength; - attributes++; - } - if (tileset.debugShowNumberOfTriangles) { labelString += '\nTriangles: ' + tile.content.trianglesLength; - attributes++; - } - if (tileset.debugShowNumberOfFeatures) { labelString += '\nFeatures: ' + tile.content.featuresLength; - attributes++; + attributes += 4; } - if (tileset.debugShowTextureMemoryUsage) { + + if (tileset.debugShowMemoryUsage) { labelString += '\nTexture Memory: ' + (tile.content.textureMemorySizeInBytes / 1048576.0).toFixed(3); - attributes++; - } - if (tileset.debugShowVertexMemoryUsage) { labelString += '\nVertex Memory: ' + (tile.content.vertexMemorySizeInBytes / 1048576.0).toFixed(3); - attributes++; + attributes += 2; } tileset._tileInfoLabels.add({ @@ -2056,9 +1997,7 @@ define([ // Number of commands added by each update above tileset._statistics.numberOfCommands = (commandList.length - numberOfInitialCommands); - if (tileset.debugShowGeometricError || tileset.debugShowNumberOfCommands || tileset.debugShowTextureMemoryUsage || - tileset.debugShowVertexMemoryUsage || tileset.debugShowNumberOfPoints || tileset.debugShowNumberOfTriangles || - tileset.debugShowNumberOfFeatures) { + if (tileset.debugShowGeometricError || tileset.debugShowRenderingStatistics || tileset.debugShowMemoryUsage) { if (!defined(tileset._tileInfoLabels)) { tileset._tileInfoLabels = new LabelCollection(); } diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js index 8bff9687de34..3f894fad9335 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js @@ -197,12 +197,8 @@ define([ stylePanelContents.appendChild(errorBox); tileInfoPanelContents.appendChild(makeCheckbox('showGeometricError', 'Geometric Error')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfCommands', 'Number Of Commands')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfPoints', 'Number Of Points')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfTriangles', 'Number Of Triangles')); - tileInfoPanelContents.appendChild(makeCheckbox('showNumberOfFeatures', 'Number Of Features')); - tileInfoPanelContents.appendChild(makeCheckbox('showTextureMemory', 'Texture Memory Usage (MB)')); - tileInfoPanelContents.appendChild(makeCheckbox('showVertexMemory', 'Vertex Memory Usage (MB)')); + tileInfoPanelContents.appendChild(makeCheckbox('showRenderingStatistics', 'Rendering Statistics')); + tileInfoPanelContents.appendChild(makeCheckbox('showMemoryUsage', 'Memory Usage (MB)')); var tilesetPanel = makeSection('Tileset', 'tilesetVisible', 'toggleTileset', tilesetPanelContents); var displayPanel = makeSection('Display', 'displayVisible', 'toggleDisplay', displayPanelContents); diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 6f552869907f..31cf4b99c144 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -478,131 +478,47 @@ define([ */ this.showGeometricError = false; - var showNumberOfCommands = knockout.observable(); - knockout.defineProperty(this, 'showNumberOfCommands', { + var showRenderingStatistics = knockout.observable(); + knockout.defineProperty(this, 'showRenderingStatistics', { get : function() { - return showNumberOfCommands(); + return showRenderingStatistics(); }, set : function(value) { - showNumberOfCommands(value); + showRenderingStatistics(value); if (that._tileset) { - that._tileset.debugShowNumberOfCommands = value; + that._tileset.debugShowRenderingStatistics = value; } } }); /** - * Displays the number of commands used per tile. This property is observable. + * Displays the number of commands, points, triangles and features used per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.showNumberOfCommands = false; + this.showRenderingStatistics = false; - var showNumberOfPoints = knockout.observable(); - knockout.defineProperty(this, 'showNumberOfPoints', { + var showMemoryUsage = knockout.observable(); + knockout.defineProperty(this, 'showMemoryUsage', { get : function() { - return showNumberOfPoints(); + return showMemoryUsage(); }, set : function(value) { - showNumberOfPoints(value); + showMemoryUsage(value); if (that._tileset) { - that._tileset.debugShowNumberOfPoints = value; + that._tileset.debugShowMemoryUsage = value; } } }); /** - * Displays the number of points per tile. This property is observable. + * Displays the memory used per tile. This property is observable. * @memberof Cesium3DTilesInspectorViewModel.prototype * * @type {Boolean} * @default false */ - this.showNumberOfPoints = false; - - var showNumberOfTriangles = knockout.observable(); - knockout.defineProperty(this, 'showNumberOfTriangles', { - get : function() { - return showNumberOfTriangles(); - }, - set : function(value) { - showNumberOfTriangles(value); - if (that._tileset) { - that._tileset.debugShowNumberOfTriangles = value; - } - } - }); - /** - * Displays the number of triangles per tile. This property is observable. - * @memberof Cesium3DTilesInspectorViewModel.prototype - * - * @type {Boolean} - * @default false - */ - this.showNumberOfTriangles = false; - - var showNumberOfFeatures = knockout.observable(); - knockout.defineProperty(this, 'showNumberOfFeatures', { - get : function() { - return showNumberOfFeatures(); - }, - set : function(value) { - showNumberOfFeatures(value); - if (that._tileset) { - that._tileset.debugShowNumberOfFeatures = value; - } - } - }); - /** - * Displays the number of features per tile. This property is observable. - * @memberof Cesium3DTilesInspectorViewModel.prototype - * - * @type {Boolean} - * @default false - */ - this.showNumberOfFeatures = false; - - var showTextureMemory = knockout.observable(); - knockout.defineProperty(this, 'showTextureMemory', { - get : function() { - return showTextureMemory(); - }, - set : function(value) { - showTextureMemory(value); - if (that._tileset) { - that._tileset.debugShowTextureMemoryUsage = value; - } - } - }); - /** - * Displays the texture memory used per tile. This property is observable. - * @memberof Cesium3DTilesInspectorViewModel.prototype - * - * @type {Boolean} - * @default false - */ - this.showTextureMemory = false; - - var showVertexMemory = knockout.observable(); - knockout.defineProperty(this, 'showVertexMemory', { - get : function() { - return showVertexMemory(); - }, - set : function(value) { - showVertexMemory(value); - if (that._tileset) { - that._tileset.debugShowVertexMemoryUsage = value; - } - } - }); - /** - * Displays the vertex memory used per tile. This property is observable. - * @memberof Cesium3DTilesInspectorViewModel.prototype - * - * @type {Boolean} - * @default false - */ - this.showVertexMemory = false; + this.showMemoryUsage = false; var maximumScreenSpaceError = knockout.observable(); knockout.defineProperty(this, 'maximumScreenSpaceError', { @@ -710,7 +626,7 @@ define([ this._definedProperties = ['properties', 'dynamicScreenSpaceError', 'colorBlendMode', 'picking', 'colorize', 'wireframe', 'showBoundingVolumes', 'showContentBoundingVolumes', 'showRequestVolumes', 'freezeFrame', 'maximumScreenSpaceError', 'dynamicScreenSpaceErrorDensity', 'dynamicScreenSpaceErrorDensitySliderValue', 'dynamicScreenSpaceErrorFactor', 'pickActive', 'showGeometricError', - 'showNumberOfCommands', 'showNumberOfPoints', 'showNumberOfTriangles', 'showNumberOfFeatures', 'showTextureMemory', 'showVertexMemory']; + 'showRenderingStatistics', 'showMemoryUsage']; this._removePostRenderEvent = scene.postRender.addEventListener(function() { that._update(); }); @@ -818,12 +734,8 @@ define([ 'showRequestVolumes', 'freezeFrame', 'showGeometricError', - 'showNumberOfCommands', - 'showNumberOfPoints', - 'showNumberOfTriangles', - 'showNumberOfFeatures', - 'showTextureMemory', - 'showVertexMemory']; + 'showRenderingStatistics', + 'showMemoryUsage']; var length = settings.length; for (var i = 0; i < length; ++i) { var setting = settings[i]; diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 695adc76445f..4685f1dd602a 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1376,127 +1376,45 @@ defineSuite([ }); }); - it('show tile info labels with number of commands', function() { + it('show tile info labels with rendering statistics', function() { // tilesetUrl has bounding regions return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset.debugShowNumberOfCommands = true; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).toBeDefined(); - expect(tileset._tileInfoLabels.length).toEqual(5); - - var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Commands: ' + root._commandsLength); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Commands: ' + root.children[0]._commandsLength); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Commands: ' + root.children[1]._commandsLength); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Commands: ' + root.children[2]._commandsLength); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Commands: ' + root.children[3]._commandsLength); - - tileset.debugShowNumberOfCommands = false; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).not.toBeDefined(); - }); - }); - - it('show tile info labels with number of triangles', function() { - // tilesetUrl has bounding regions - return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset.debugShowNumberOfTriangles = true; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).toBeDefined(); - expect(tileset._tileInfoLabels.length).toEqual(5); - - var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Triangles: ' + root.content.trianglesLength); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Triangles: ' + root.children[0].content.trianglesLength); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Triangles: ' + root.children[1].content.trianglesLength); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Triangles: ' + root.children[2].content.trianglesLength); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Triangles: ' + root.children[3].content.trianglesLength); - - tileset.debugShowNumberOfTriangles = false; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).not.toBeDefined(); - }); - }); - - it('show tile info labels with number of points', function() { - // tilesetUrl has bounding regions - return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset.debugShowNumberOfPoints = true; + tileset.debugShowRenderingStatistics = true; + viewRootOnly(); scene.renderForSpecs(); expect(tileset._tileInfoLabels).toBeDefined(); - expect(tileset._tileInfoLabels.length).toEqual(5); + expect(tileset._tileInfoLabels.length).toEqual(1); - var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Points: ' + root.content.pointsLength); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Points: ' + root.children[0].content.pointsLength); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Points: ' + root.children[1].content.pointsLength); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Points: ' + root.children[2].content.pointsLength); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Points: ' + root.children[3].content.pointsLength); - - tileset.debugShowNumberOfPoints = false; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).not.toBeDefined(); - }); - }); - - it('show tile info labels with number of features', function() { - // tilesetUrl has bounding regions - return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset.debugShowNumberOfFeatures = true; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).toBeDefined(); - expect(tileset._tileInfoLabels.length).toEqual(5); + var content = tileset._root.content; + var expected = 'Commands: ' + tileset._root._commandsLength + '\n' + + 'Points: ' + content.pointsLength + '\n' + + 'Triangles: ' + content.trianglesLength + '\n' + + 'Features: ' + content.featuresLength; - var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Features: ' + root.content.featuresLength); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Features: ' + root.children[0].content.featuresLength); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Features: ' + root.children[1].content.featuresLength); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Features: ' + root.children[2].content.featuresLength); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Features: ' + root.children[3].content.featuresLength); + expect(tileset._tileInfoLabels._labels[0].text).toEqual(expected); - tileset.debugShowNumberOfFeatures = false; + tileset.debugShowRenderingStatistics = false; scene.renderForSpecs(); expect(tileset._tileInfoLabels).not.toBeDefined(); }); }); - it('show tile info labels with texture memory usage', function() { + it('show tile info labels with memory usage', function() { // tilesetUrl has bounding regions return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset.debugShowTextureMemoryUsage = true; + tileset.debugShowMemoryUsage = true; + viewRootOnly(); scene.renderForSpecs(); expect(tileset._tileInfoLabels).toBeDefined(); - expect(tileset._tileInfoLabels.length).toEqual(5); + expect(tileset._tileInfoLabels.length).toEqual(1); - var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Texture Memory: ' + (root.content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Texture Memory: ' + (root.children[0].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Texture Memory: ' + (root.children[1].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Texture Memory: ' + (root.children[2].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Texture Memory: ' + (root.children[3].content.textureMemorySizeInBytes / 1048576.0).toFixed(3)); - - tileset.debugShowTextureMemoryUsage = false; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).not.toBeDefined(); - }); - }); - - it('show tile info labels with vertex memory usage', function() { - // tilesetUrl has bounding regions - return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { - tileset.debugShowVertexMemoryUsage = true; - scene.renderForSpecs(); - expect(tileset._tileInfoLabels).toBeDefined(); - expect(tileset._tileInfoLabels.length).toEqual(5); + var content = tileset._root.content; + var expected = 'Texture Memory: ' + (content.textureMemorySizeInBytes / 1048576.0).toFixed(3) + '\n' + + 'Vertex Memory: ' + (content.vertexMemorySizeInBytes / 1048576.0).toFixed(3); - var root = tileset._root; - expect(tileset._tileInfoLabels._labels[0].text).toEqual('Vertex Memory: ' + (root.content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[1].text).toEqual('Vertex Memory: ' + (root.children[0].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[2].text).toEqual('Vertex Memory: ' + (root.children[1].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[3].text).toEqual('Vertex Memory: ' + (root.children[2].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); - expect(tileset._tileInfoLabels._labels[4].text).toEqual('Vertex Memory: ' + (root.children[3].content.vertexMemorySizeInBytes / 1048576.0).toFixed(3)); + expect(tileset._tileInfoLabels._labels[0].text).toEqual(expected); - tileset.debugShowVertexMemoryUsage = false; + tileset.debugShowMemoryUsage = false; scene.renderForSpecs(); expect(tileset._tileInfoLabels).not.toBeDefined(); }); @@ -1506,12 +1424,8 @@ defineSuite([ // tilesetUrl has bounding regions return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) { tileset.debugShowGeometricError = true; - tileset.debugShowNumberOfCommands = true; - tileset.debugShowNumberOfPoints = true; - tileset.debugShowNumberOfTriangles = true; - tileset.debugShowNumberOfFeatures = true; - tileset.debugShowTextureMemoryUsage = true; - tileset.debugShowVertexMemoryUsage = true; + tileset.debugShowRenderingStatistics = true; + tileset.debugShowMemoryUsage = true; viewRootOnly(); scene.renderForSpecs(); expect(tileset._tileInfoLabels).toBeDefined(); @@ -1527,12 +1441,8 @@ defineSuite([ expect(tileset._tileInfoLabels._labels[0].text).toEqual(expected); tileset.debugShowGeometricError = false; - tileset.debugShowNumberOfCommands = false; - tileset.debugShowNumberOfPoints = false; - tileset.debugShowNumberOfTriangles = false; - tileset.debugShowNumberOfFeatures = false; - tileset.debugShowTextureMemoryUsage = false; - tileset.debugShowVertexMemoryUsage = false; + tileset.debugShowRenderingStatistics = false; + tileset.debugShowMemoryUsage = false; scene.renderForSpecs(); expect(tileset._tileInfoLabels).not.toBeDefined(); }); From 34299685c5d6fa9008ab46159124a06d645a56a6 Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Tue, 2 May 2017 13:26:35 -0400 Subject: [PATCH 18/19] hide point or triangle count when 0 --- Source/Scene/Cesium3DTileset.js | 16 ++++++++++++++-- Specs/Scene/Cesium3DTilesetSpec.js | 2 -- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 4c20a30668a7..71ae2a7837d9 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1892,8 +1892,20 @@ define([ } if (tileset.debugShowRenderingStatistics) { labelString += '\nCommands: ' + tile._commandsLength; - labelString += '\nPoints: ' + tile.content.pointsLength; - labelString += '\nTriangles: ' + tile.content.trianglesLength; + attributes++; + + // Don't display number of points or triangles if 0. + var numberOfPoints = tile.content.pointsLength; + if (numberOfPoints > 0) { + labelString += '\nPoints: ' + tile.content.pointsLength; + attributes++; + } + var numberOfTriangles = tile.content.trianglesLength; + if (numberOfTriangles > 0) { + labelString += '\nTriangles: ' + tile.content.trianglesLength; + attributes++; + } + labelString += '\nFeatures: ' + tile.content.featuresLength; attributes += 4; } diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js index 4685f1dd602a..1ecb907556d3 100644 --- a/Specs/Scene/Cesium3DTilesetSpec.js +++ b/Specs/Scene/Cesium3DTilesetSpec.js @@ -1387,7 +1387,6 @@ defineSuite([ var content = tileset._root.content; var expected = 'Commands: ' + tileset._root._commandsLength + '\n' + - 'Points: ' + content.pointsLength + '\n' + 'Triangles: ' + content.trianglesLength + '\n' + 'Features: ' + content.featuresLength; @@ -1433,7 +1432,6 @@ defineSuite([ var content = tileset._root.content; var expected = 'Geometric error: ' + tileset._root.geometricError + '\n' + 'Commands: ' + tileset._root._commandsLength + '\n' + - 'Points: ' + content.pointsLength + '\n' + 'Triangles: ' + content.trianglesLength + '\n' + 'Features: ' + content.featuresLength + '\n' + 'Texture Memory: ' + (content.textureMemorySizeInBytes / 1048576.0).toFixed(3) + '\n' + From bed4f78b3adebb28e4a3123856ccbeb11198f21e Mon Sep 17 00:00:00 2001 From: Rachel Hwang Date: Wed, 3 May 2017 11:38:20 -0400 Subject: [PATCH 19/19] tweak --- Source/Scene/Cesium3DTileset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 71ae2a7837d9..c25dd03f56d9 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -1907,7 +1907,7 @@ define([ } labelString += '\nFeatures: ' + tile.content.featuresLength; - attributes += 4; + attributes ++; } if (tileset.debugShowMemoryUsage) {