-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per tile stats #5188
Per tile stats #5188
Changes from 14 commits
169760b
94de1f9
5363042
3c28604
a247ea7
19e4179
f627ddd
d67edf9
8492203
1af8c5a
ca38f1a
134288f
4719841
5f901dd
effbe7b
8b0e599
9bf5138
58ce52a
3429968
bed4f78
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -401,7 +401,73 @@ 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. | ||
* <p> | ||
* When true, draws labels to indicate the number of commands used. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "commands used" -> "commands executed for this tile" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "each tile" |
||
* </p> | ||
* | ||
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.debugShowNumberOfCommands = defaultValue(options.debugShowNumberOfCommands, false); | ||
|
||
/** | ||
* This property is for debugging only; it is not optimized for production use. | ||
* <p> | ||
* When true, draws labels to indicate the number of points in each tile. | ||
* </p> | ||
* | ||
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.debugShowNumberOfPoints = defaultValue(options.debugShowNumberOfPoints, false); | ||
|
||
/** | ||
* This property is for debugging only; it is not optimized for production use. | ||
* <p> | ||
* When true, draws labels to indicate the number of triangles in each tile. | ||
* </p> | ||
* | ||
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.debugShowNumberOfTriangles = defaultValue(options.debugShowNumberOfTriangles, false); | ||
|
||
/** | ||
* This property is for debugging only; it is not optimized for production use. | ||
* <p> | ||
* When true, draws labels to indicate the number of features in each tile. | ||
* </p> | ||
* | ||
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.debugShowNumberOfFeatures = defaultValue(options.debugShowNumberOfFeatures, false); | ||
|
||
/** | ||
* This property is for debugging only; it is not optimized for production use. | ||
* <p> | ||
* When true, draws labels to indicate the texture memory usage. | ||
* </p> | ||
* | ||
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.debugShowTextureMemoryUsage = defaultValue(options.debugShowTextureMemoryUsage, false); | ||
|
||
/** | ||
* This property is for debugging only; it is not optimized for production use. | ||
* <p> | ||
* When true, draws labels to indicate the vertex memory usage. | ||
* </p> | ||
* | ||
* @type {Boolean} | ||
* @default false | ||
*/ | ||
this.debugShowVertexMemoryUsage = defaultValue(options.debugShowVertexMemoryUsage, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add these |
||
|
||
/** | ||
* The event fired to indicate progress of loading new tiles. This event is fired when a new tile | ||
|
@@ -1838,10 +1904,10 @@ define([ | |
|
||
var scratchCartesian2 = new Cartesian3(); | ||
|
||
function updateGeometricErrorLabels(tileset, frameState) { | ||
function updateTileInfoLabels(tileset, frameState) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same for the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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; | ||
|
@@ -1858,12 +1924,48 @@ 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 attributes = 0; | ||
|
||
if (tileset.debugShowGeometricError) { | ||
labelString += "\nGeometric error: " + tile.geometricError; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use single-quotes for these. |
||
attributes++; | ||
} | ||
if (tileset.debugShowNumberOfCommands) { | ||
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++; | ||
} | ||
if (tileset.debugShowTextureMemoryUsage) { | ||
labelString += "\nTexture Memory: " + tile.content.textureMemorySizeInBytes; | ||
attributes++; | ||
} | ||
if (tileset.debugShowVertexMemoryUsage) { | ||
labelString += "\nVertex Memory: " + tile.content.vertexMemorySizeInBytes; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Late suggestion, but can this and texture memory usage show it in megabytes like in the stats panel in the inspector? |
||
attributes++; | ||
} | ||
|
||
tileset._tileInfoLabels.add({ | ||
text : labelString.substring(1), | ||
position : position, | ||
font : (19-attributes) + 'px sans-serif', | ||
showBackground : true, | ||
disableDepthTestDistance : Number.POSITIVE_INFINITY | ||
}); | ||
} | ||
tileset._geometricErrorLabels.update(frameState); | ||
tileset._tileInfoLabels.update(frameState); | ||
} | ||
|
||
var stencilClearCommand = new ClearCommand({ | ||
|
@@ -1948,13 +2050,15 @@ 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 || | ||
tileset.debugShowNumberOfFeatures) { | ||
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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also destroy the labels in |
||
} | ||
} | ||
|
||
|
@@ -2115,6 +2219,11 @@ define([ | |
* @see Cesium3DTileset#isDestroyed | ||
*/ | ||
Cesium3DTileset.prototype.destroy = function() { | ||
// Destroy debug labels | ||
if (defined(this._tileInfoLabels)) { | ||
this._tileInfoLabels.destroy(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The destroy convention usually looks like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the |
||
|
||
// Traverse the tree and destroy all tiles | ||
if (defined(this._root)) { | ||
var stack = scratchStack; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,8 @@ define([ | |
this.featurePropertiesDirty = false; | ||
|
||
this._features = undefined; | ||
|
||
initialize(this, arrayBuffer, byteOffset); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove empty line. |
||
} | ||
|
||
defineProperties(Instanced3DModel3DTileContent.prototype, { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also place this before stylePanel for consistency. |
||
|
||
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,17 +196,27 @@ define([ | |
errorBox.setAttribute('data-bind', 'text: editorError'); | ||
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')); | ||
|
||
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 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(tileInfoPanel); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Visually, I think the tile info panel belongs after the logging panel. |
||
element.appendChild(stylePanel); | ||
|
||
knockout.applyBindings(viewModel, element); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have a readonly property getter.
Up to you, but this and the other "length" properties for rendering debugging output could be prefixed like
_debugCommandsLength