diff --git a/CHANGES.md b/CHANGES.md
index 5ff751636cbd..1312cf89a6a7 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -10,6 +10,7 @@ Change Log
* `Cesium3DTileContent`
* `Cesium3DTileFeature`
* `Cesium3DTilesInspector`, `Cesium3DTilesInspectorViewModel`, and `viewerCesium3DTilesInspectorMixin`
+ * `Cesium3DTileColorBlendMode`
### 1.34 - 2017-06-01
diff --git a/Source/Scene/Batched3DModel3DTileContent.js b/Source/Scene/Batched3DModel3DTileContent.js
index 856ba0100851..569d66da6cc0 100644
--- a/Source/Scene/Batched3DModel3DTileContent.js
+++ b/Source/Scene/Batched3DModel3DTileContent.js
@@ -99,25 +99,25 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
- return this._model.vertexMemorySizeInBytes;
+ return this._model.geometryByteLength;
}
},
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
- return this._model.textureMemorySizeInBytes;
+ return this._model.texturesByteLength;
}
},
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- batchTableMemorySizeInBytes : {
+ batchTableByteLength : {
get : function() {
return this._batchTable.memorySizeInBytes;
}
@@ -344,7 +344,7 @@ define([
// The pick shader still needs to be patched.
content._model = new Model({
gltf : gltfView,
- cull : false, // The model is already culled by the 3D tiles
+ cull : false, // The model is already culled by 3D Tiles
releaseGltfJson : true, // Models are unique and will not benefit from caching so save memory
basePath : basePath,
requestType : RequestType.TILES3D,
diff --git a/Source/Scene/Cesium3DTile.js b/Source/Scene/Cesium3DTile.js
index e5ae25dc9295..94f4ee4299b1 100644
--- a/Source/Scene/Cesium3DTile.js
+++ b/Source/Scene/Cesium3DTile.js
@@ -89,8 +89,7 @@ define([
/**
* A tile in a 3D Tiles tileset. When a tile is first created, its content is not loaded;
- * the content is loaded on-demand when needed based on the view using
- * {@link Cesium3DTile#requestContent}.
+ * the content is loaded on-demand when needed based on the view.
*
* Do not construct this directly, instead access tiles through {@link Cesium3DTileset#tileVisible}.
*
@@ -98,7 +97,7 @@ define([
* @alias Cesium3DTile
* @constructor
*/
- function Cesium3DTile(tileset, baseUrl, header, parent) {
+ function Cesium3DTile(tileset, basePath, header, parent) {
this._tileset = tileset;
this._header = header;
var contentHeader = header.content;
@@ -115,6 +114,7 @@ define([
/**
* The final computed transform of this tile
* @type {Matrix4}
+ * @readonly
*/
this.computedTransform = computedTransform;
@@ -142,7 +142,7 @@ define([
/**
* 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.
+ * This is used to compute screen space error, i.e., the error measured in pixels.
*
* @type {Number}
* @readonly
@@ -164,6 +164,7 @@ define([
*
* @type {Cesium3DTileRefine}
* @readonly
+ * @private
*/
this.refine = refine;
@@ -197,7 +198,7 @@ define([
if (defined(contentHeader)) {
hasEmptyContent = false;
contentState = Cesium3DTileContentState.UNLOADED;
- contentUrl = joinUrls(baseUrl, contentHeader.url);
+ contentUrl = joinUrls(basePath, contentHeader.url);
requestServer = RequestScheduler.getRequestServer(contentUrl);
} else {
content = new Empty3DTileContent(tileset, this);
@@ -274,6 +275,7 @@ define([
* The time in seconds after the tile's content is ready when the content expires and new content is requested.
*
* @type {Number}
+ * @readonly
*/
this.expireDuration = expireDuration;
@@ -281,6 +283,7 @@ define([
* The date when the content expires and new content is requested.
*
* @type {JulianDate}
+ * @readonly
*/
this.expireDate = expireDate;
@@ -380,6 +383,7 @@ define([
*
* @type {TileBoundingVolume}
* @readonly
+ * @private
*/
contentBoundingVolume : {
get : function() {
@@ -420,6 +424,8 @@ define([
*
* @type {Boolean}
* @readonly
+ *
+ * @private
*/
contentAvailable : {
get : function() {
@@ -435,6 +441,8 @@ define([
*
* @type {Boolean}
* @readonly
+ *
+ * @private
*/
contentReady : {
get : function() {
@@ -450,6 +458,8 @@ define([
*
* @type {Boolean}
* @readonly
+ *
+ * @private
*/
contentUnloaded : {
get : function() {
@@ -465,6 +475,8 @@ define([
*
* @type {Boolean}
* @readonly
+ *
+ * @private
*/
contentExpired : {
get : function() {
diff --git a/Source/Scene/Cesium3DTileBatchTable.js b/Source/Scene/Cesium3DTileBatchTable.js
index f461090d288c..bc5b8f987820 100644
--- a/Source/Scene/Cesium3DTileBatchTable.js
+++ b/Source/Scene/Cesium3DTileBatchTable.js
@@ -1264,7 +1264,7 @@ define([
var commandEnd = commandList.length;
var tile = this._content._tile;
var tileset = tile._tileset;
- var bivariateVisibilityTest = tileset.skipLODs && tileset._hasMixedContent && frameState.context.stencilBuffer;
+ var bivariateVisibilityTest = tileset.skipLevelOfDetail && tileset._hasMixedContent && frameState.context.stencilBuffer;
var styleCommandsNeeded = getStyleCommandsNeeded(this);
for (var i = commandStart; i < commandEnd; ++i) {
@@ -1460,7 +1460,7 @@ define([
}
batchTable._pickTexture = createTexture(batchTable, context, bytes);
- content._tileset._statistics.batchTableMemorySizeInBytes += batchTable._pickTexture.sizeInBytes;
+ content._tileset._statistics.batchTableByteLength += batchTable._pickTexture.sizeInBytes;
}
}
@@ -1491,7 +1491,7 @@ define([
// Create batch texture on-demand
if (!defined(this._batchTexture)) {
this._batchTexture = createTexture(this, context, this._batchValues);
- tileset._statistics.batchTableMemorySizeInBytes += this._batchTexture.sizeInBytes;
+ tileset._statistics.batchTableByteLength += this._batchTexture.sizeInBytes;
}
updateBatchTexture(this); // Apply per-feature show/color updates
diff --git a/Source/Scene/Cesium3DTileColorBlendMode.js b/Source/Scene/Cesium3DTileColorBlendMode.js
index a3fd3a306d3a..1c1d7c4fbb17 100644
--- a/Source/Scene/Cesium3DTileColorBlendMode.js
+++ b/Source/Scene/Cesium3DTileColorBlendMode.js
@@ -8,16 +8,11 @@ define([
/**
* Defines how per-feature colors set from the Cesium API or declarative styling blend with the source colors from
* the original feature, e.g. glTF material or per-point color in the tile.
- *
- * HIGHLIGHT multiplies the source color by the feature color
- * REPLACE replaces the source color with the feature color
- * MIX blends the source color and feature color together
- *
- * When REPLACE or MIX are used and the source color is a glTF material, the technique must assign the
- * _3DTILESDIFFUSE semantic to the diffuse color parameter. Otherwise only HIGHLIGHT is supported.
- *
- * For example:
- *
+ *
+ * When REPLACE
or MIX
are used and the source color is a glTF material, the technique must assign the
+ * _3DTILESDIFFUSE
semantic to the diffuse color parameter. Otherwise only HIGHLIGHT
is supported.
+ *
+ *
* "techniques": {
* "technique0": {
* "parameters": {
@@ -28,12 +23,33 @@ define([
* }
* }
* }
+ *
*
* @exports Cesium3DTileColorBlendMode
*/
var Cesium3DTileColorBlendMode = {
+ /**
+ * Multiplies the source color by the feature color.
+ *
+ * @type {Number}
+ * @constant
+ */
HIGHLIGHT : 0,
+
+ /**
+ * Replaces the source color with the feature color.
+ *
+ * @type {Number}
+ * @constant
+ */
REPLACE : 1,
+
+ /**
+ * Blends the source color and feature color together.
+ *
+ * @type {Number}
+ * @constant
+ */
MIX : 2
};
diff --git a/Source/Scene/Cesium3DTileContent.js b/Source/Scene/Cesium3DTileContent.js
index c7160e9b0715..03356c72087a 100644
--- a/Source/Scene/Cesium3DTileContent.js
+++ b/Source/Scene/Cesium3DTileContent.js
@@ -16,13 +16,6 @@ define([
*
* @alias Cesium3DTileContent
* @constructor
- *
- * @see Batched3DModel3DTileContent
- * @see Instanced3DModel3DTileContent
- * @see PointCloud3DTileContent
- * @see Composite3DTileContent
- * @see Tileset3DTileContent
- * @see Empty3DTileContent
*/
function Cesium3DTileContent(tileset, tile, url, arrayBuffer, byteOffset) {
/**
@@ -57,6 +50,12 @@ define([
/**
* Gets the number of points in the tile.
+ *
+ * Only applicable for tiles with Point Cloud content. This is different than {@link Cesium3DTileContent#featuresLength} which
+ * equals the number of groups of points as distinguished by the BATCH_ID
feature table semantic.
+ *
+ *
+ * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/PointCloud/README.md#batched-points}
*
* @memberof Cesium3DTileContent.prototype
*
@@ -84,14 +83,14 @@ define([
},
/**
- * Gets the tile's vertex memory in bytes.
+ * Gets the tile's geometry memory in bytes.
*
* @memberof Cesium3DTileContent.prototype
*
* @type {Number}
* @readonly
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
DeveloperError.throwInstantiationError();
}
@@ -105,21 +104,21 @@ define([
* @type {Number}
* @readonly
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
DeveloperError.throwInstantiationError();
}
},
/**
- * Gets the tile's batch table memory in bytes.
+ * Gets the amount of memory used by the batch table textures, in bytes.
*
* @memberof Cesium3DTileContent.prototype
*
* @type {Number}
* @readonly
*/
- batchTableMemorySizeInBytes : {
+ batchTableByteLength : {
get : function() {
DeveloperError.throwInstantiationError();
}
@@ -129,6 +128,8 @@ define([
* Gets the array of {@link Cesium3DTileContent} objects that represent the
* content a composite's inner tiles, which can also be composites.
*
+ * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/TileFormats/Composite/README.md}
+ *
* @memberof Cesium3DTileContent.prototype
*
* @type {Array}
@@ -226,11 +227,16 @@ define([
* Returns the {@link Cesium3DTileFeature} object for the feature with the
* given batchId
. This object is used to get and modify the
* feature's properties.
+ *
+ * Features in a tile are ordered by batchId
, an index used to retrieve their metadata from the batch table.
+ *
+ *
+ * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/BatchTable}.
*
* @param {Number} batchId The batchId for the feature.
* @returns {Cesium3DTileFeature} The corresponding {@link Cesium3DTileFeature} object.
*
- * @exception {DeveloperError} batchId must be between zero and {@link Cesium3DTileContent#featuresLength - 1}.
+ * @exception {DeveloperError} batchId must be between zero and {@link Cesium3DTileContent#featuresLength} - 1.
*/
Cesium3DTileContent.prototype.getFeature = function(batchId) {
DeveloperError.throwInstantiationError();
diff --git a/Source/Scene/Cesium3DTileFeature.js b/Source/Scene/Cesium3DTileFeature.js
index 8320e47dcbd7..9a110ac5c635 100644
--- a/Source/Scene/Cesium3DTileFeature.js
+++ b/Source/Scene/Cesium3DTileFeature.js
@@ -8,14 +8,14 @@ define([
'use strict';
/**
- * Provides access to a feature's properties stored in the 3D tile's batch table, as well
+ * Provides access to a feature's properties stored in the tile's batch table, as well
* as the ability to show/hide a feature and change its highlight color via
* {@link Cesium3DTileFeature#show} and {@link Cesium3DTileFeature#color}, respectively.
*
* Modifications to a Cesium3DTileFeature
object have the lifetime of the tile's
* content. If the tile's content is unloaded, e.g., due to it going out of view and needing
- * to free space in the cache for visible tiles, listen to the DOC_TBA event to save any
- * modifications.
+ * to free space in the cache for visible tiles, listen to the {@link Cesium3DTileset#tileUnload} event to save any
+ * modifications. Also listen to the {@link Cesium3DTileset#tileVisible} event to reapply any modifications.
*
*
* Do not construct this directly. Access it through {@link Cesium3DTileContent#getFeature}
@@ -29,14 +29,12 @@ define([
* // On mouse over, display all the properties for a feature in the console log.
* handler.setInputAction(function(movement) {
* var feature = scene.pick(movement.endPosition);
- * if (Cesium.defined(feature) && (feature.primitive === tileset)) {
- * var properties = tileset.properties;
- * if (Cesium.defined(properties)) {
- * for (var name in properties) {
- * if (properties.hasOwnProperty(name)) {
- * console.log(name + ': ' + feature.getProperty(name));
- * }
- * }
+ * if (feature instanceof Cesium.Cesium3DTileFeature) {
+ * var propertyNames = feature.getPropertyNames();
+ * var length = propertyNames.length;
+ * for (var i = 0; i < length; ++i) {
+ * var propertyName = propertyNames[i];
+ * console.log(propertyName + ': ' + feature.getProperty(propertyName));
* }
* }
* }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
@@ -58,7 +56,8 @@ define([
defineProperties(Cesium3DTileFeature.prototype, {
/**
- * Gets and sets if the feature will be shown.
+ * Gets and sets if the feature will be shown. This is set for all features
+ * when a style's show is evaluated.
*
* @memberof Cesium3DTileFeature.prototype
*
@@ -77,11 +76,8 @@ define([
/**
* Gets and sets the highlight color multiplied with the feature's color. When
- * this is white, the feature's color is not changed.
- *
- * Only red
, green
, and blue
components
- * are used; alpha
is ignored.
- *
+ * this is white, the feature's color is not changed. This is set for all features
+ * when a style's color is evaluated.
*
* @memberof Cesium3DTileFeature.prototype
*
@@ -102,13 +98,14 @@ define([
},
/**
- * Gets the feature content.
+ * Gets the content of the tile containing the feature.
*
* @memberof Cesium3DTileFeature.prototype
*
* @type {Cesium3DTileContent}
*
* @readonly
+ * @private
*/
content : {
get : function() {
@@ -119,12 +116,9 @@ define([
/**
* Returns whether the feature contains this property. This includes properties from this feature's
- * class and inherited classes, in addition to the standard batch table properties.
- *
- * {@link Cesium3DTileFeature#show} and {@link Cesium3DTileFeature#color} are not equivalent to
- * 'show'
and 'color'
properties; the former are runtime-specific properties
- * that are not part of the feature's properties in the stored 3D Tileset.
- *
+ * class and inherited classes when using a batch table hierarchy.
+ *
+ * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/BatchTable#batch-table-hierarchy}
*
* @param {String} name The case-sensitive name of the property.
* @returns {Boolean} Whether the feature contains this property.
@@ -135,12 +129,9 @@ define([
/**
* Returns an array of property names for the feature. This includes properties from this feature's
- * class and inherited classes, in addition to the standard batch table properties.
- *
- * {@link Cesium3DTileFeature#show} and {@link Cesium3DTileFeature#color} are not equivalent to
- * 'show'
and 'color'
properties; the former are runtime-specific properties
- * that are not part of the feature's properties in the stored 3D Tileset.
- *
+ * class and inherited classes when using a batch table hierarchy.
+ *
+ * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/BatchTable#batch-table-hierarchy}
*
* @returns {String[]} The names of the feature's properties.
*/
@@ -149,28 +140,25 @@ define([
};
/**
- * Returns the value of the feature's property with the given name.
+ * Returns the value of the feature's property with the given name. This includes properties from this feature's
+ * class and inherited classes when using a batch table hierarchy.
*
- * {@link Cesium3DTileFeature#show} and {@link Cesium3DTileFeature#color} are not equivalent to
- * 'show'
and 'color'
properties; the former are runtime-specific properties
- * that are not part of the feature's properties in the stored 3D Tileset.
+ * The value is copied before being returned.
*
*
+ * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/TileFormats/BatchTable#batch-table-hierarchy}
+ *
* @param {String} name The case-sensitive name of the property.
* @returns {*} The value of the property or undefined
if the property does not exist.
*
* @example
* // Display all the properties for a feature in the console log.
- * var properties = tileset.properties;
- * if (Cesium.defined(properties)) {
- * for (var name in properties) {
- * if (properties.hasOwnProperty(name)) {
- * console.log(name + ': ' + feature.getProperty(name));
- * }
- * }
+ * var propertyNames = feature.getPropertyNames();
+ * var length = propertyNames.length;
+ * for (var i = 0; i < length; ++i) {
+ * var propertyName = propertyNames[i];
+ * console.log(propertyName + ': ' + feature.getProperty(propertyName));
* }
- *
- * @see {Cesium3DTileset#properties}
*/
Cesium3DTileFeature.prototype.getProperty = function(name) {
return this._content.batchTable.getProperty(this._batchId, name);
@@ -181,15 +169,12 @@ define([
*
* If a property with the given name doesn't exist, it is created.
*
- *
- * {@link Cesium3DTileFeature#show} and {@link Cesium3DTileFeature#color} are not equivalent to
- * 'show'
and 'color'
properties; the former are runtime-specific properties
- * that are not part of the feature's properties in the stored 3D Tileset.
- *
*
* @param {String} name The case-sensitive name of the property.
* @param {*} value The value of the property that will be copied.
*
+ * @exception {DeveloperError} Inherited batch table hierarchy property is read only.
+ *
* @example
* var height = feature.getProperty('Height'); // e.g., the height of a building
*
@@ -201,8 +186,6 @@ define([
* feature.setProperty(name, true);
* console.log('first click');
* }
- *
- * @see {Cesium3DTileset#properties}
*/
Cesium3DTileFeature.prototype.setProperty = function(name, value) {
this._content.batchTable.setProperty(this._batchId, name, value);
diff --git a/Source/Scene/Cesium3DTileRefine.js b/Source/Scene/Cesium3DTileRefine.js
index e9c541b92bae..cf15a5db0d41 100644
--- a/Source/Scene/Cesium3DTileRefine.js
+++ b/Source/Scene/Cesium3DTileRefine.js
@@ -6,13 +6,28 @@ define([
'use strict';
/**
- * Additive refinement renders the entire cut of the tree. Replacement refine renders just the front.
+ * The refinement approach for a tile.
+ *
+ * @exports Cesium3DTileRefine
*
* @private
*/
var Cesium3DTileRefine = {
- ADD : 0, // Render this tile and, if it doesn't meet the SSE, refine to its children
- REPLACE : 1 // Render this tile or, if it doesn't meet the SSE, refine to its children
+ /**
+ * Render this tile and, if it doesn't meet the screen space error, also refine to its children.
+ *
+ * @type {Number}
+ * @constant
+ */
+ ADD : 0,
+
+ /**
+ * Render this tile or, if it doesn't meet the screen space error, refine to its descendants instead.
+ *
+ * @type {Number}
+ * @constant
+ */
+ REPLACE : 1
};
return freezeObject(Cesium3DTileRefine);
diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js
index 3b15eb6ab32b..a90f09be6e86 100644
--- a/Source/Scene/Cesium3DTileStyle.js
+++ b/Source/Scene/Cesium3DTileStyle.js
@@ -52,8 +52,6 @@ define([
* description : '"Building id ${id} has height ${Height}."'
* }
* });
- *
- * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
*/
function Cesium3DTileStyle(data) {
this._style = undefined;
diff --git a/Source/Scene/Cesium3DTileStyleEngine.js b/Source/Scene/Cesium3DTileStyleEngine.js
index cbc4c6fa7cb7..05dcd451b864 100644
--- a/Source/Scene/Cesium3DTileStyleEngine.js
+++ b/Source/Scene/Cesium3DTileStyleEngine.js
@@ -56,7 +56,7 @@ define([
}
var lastStyleTime = this._lastStyleTime;
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
// If a new style was assigned, loop through all the visible tiles; otherwise, loop through
// only the tiles that are newly visible, i.e., they are visible this frame, but were not
@@ -76,8 +76,8 @@ define([
var content = tile.content;
tile.lastStyleTime = lastStyleTime;
content.applyStyle(frameState, this._style);
- stats.numberOfFeaturesStyled += content.featuresLength;
- ++stats.numberOfTilesStyled;
+ statistics.numberOfFeaturesStyled += content.featuresLength;
+ ++statistics.numberOfTilesStyled;
}
}
}
diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js
index 8322f09c9c5b..9c18a17ee6b3 100644
--- a/Source/Scene/Cesium3DTileset.js
+++ b/Source/Scene/Cesium3DTileset.js
@@ -116,13 +116,20 @@ define([
* @param {String} options.url The url to a tileset.json file or to a directory containing a tileset.json file.
* @param {Boolean} [options.show=true] Determines if the tileset will be shown.
* @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] A 4x4 transformation matrix that transforms the tileset's root tile.
- * @param {Number} [options.maximumScreenSpaceError=16] The maximum screen-space error used to drive level-of-detail refinement.
+ * @param {ShadowMode} [options.shadows=ShadowMode.ENABLED] Determines whether the tileset casts or receives shadows from each light source.
+ * @param {Number} [options.maximumScreenSpaceError=16] The maximum screen space error used to drive level of detail refinement.
* @param {Number} [options.maximumMemoryUsage=512] The maximum amount of memory in MB that can be used by the tileset.
- * @param {Boolean} [options.cullWithChildrenBounds=true] Whether to cull tiles using the union of their children bounding volumes.
- * @param {Boolean} [options.dynamicScreenSpaceError=false] Reduce the screen space error for tiles that are further away from the camera.
+ * @param {Boolean} [options.cullWithChildrenBounds=true] Optimization option. Whether to cull tiles using the union of their children bounding volumes.
+ * @param {Boolean} [options.dynamicScreenSpaceError=false] Optimization option. Reduce the screen space error for tiles that are further away from the camera.
* @param {Number} [options.dynamicScreenSpaceErrorDensity=0.00278] Density used to adjust the dynamic screen space error, similar to fog density.
* @param {Number} [options.dynamicScreenSpaceErrorFactor=4.0] A factor used to increase the computed dynamic screen space error.
* @param {Number} [options.dynamicScreenSpaceErrorHeightFalloff=0.25] A ratio of the tileset's height at which the density starts to falloff.
+ * @param {Boolean} [options.skipLevelOfDetail=true] Optimization option. Determines if level of detail skipping should be applied during the traversal.
+ * @param {Number} [options.baseScreenSpaceError=1024] When skipLevelOfDetail
is true
, the screen space error that must be reached before skipping levels of detail.
+ * @param {Number} [options.skipScreenSpaceErrorFactor=16] When skipLevelOfDetail
is true
, a multiplier defining the minimum screen space error to skip. Used in conjunction with skipLevels
to determine which tiles to load.
+ * @param {Number} [options.skipLevels=1] When skipLevelOfDetail
is true
, a constant defining the minimum number of levels to skip when loading tiles. When it is 0, no levels are skipped. Used in conjunction with skipScreenSpaceErrorFactor
to determine which tiles to load.
+ * @param {Boolean} [options.immediatelyLoadDesiredLevelOfDetail=false] When skipLevelOfDetail
is true
, only tiles that meet the maximum screen space error will ever be downloaded. Skipping factors are ignored and just the desired tiles are loaded.
+ * @param {Boolean} [options.loadSiblings=false] When skipLevelOfDetail
is true
, determines whether siblings of visible tiles are always downloaded during traversal.
* @param {Boolean} [options.debugFreezeFrame=false] For debugging only. Determines if only the tiles from last frame should be used for rendering.
* @param {Boolean} [options.debugColorizeTiles=false] For debugging only. When true, assigns a random color to each tile.
* @param {Boolean} [options.debugWireframe=false] For debugging only. When true, render's each tile's content as a wireframe.
@@ -131,22 +138,38 @@ define([
* @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.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.baseScreenSpaceError=1024] The screen-space error that must be reached before skipping LODs
- * @param {Number} [options.skipScreenSpaceErrorFactor=10] Multiplier defining the minimum screen space error to skip when loading tiles. Used in conjuction with skipLevels to determine which tiles to load.
- * @param {Number} [options.skipLevels=1] Constant defining the minimum number of levels to skip when loading tiles. When it is 0, no levels are skipped. Used in conjuction with skipScreenSpaceErrorFactor to determine which tiles to load.
- * @param {Boolean} [options.immediatelyLoadDesiredLOD=false] When true, do not progressively refine. Immediately load the desired LOD.
- * @param {Boolean} [options.loadSiblings=false] Determines whether sibling tiles should be loaded when skipping levels-of-detail. When true, the siblings of any visible and downloaded tile are downloaded as well.
+ * @param {Boolean} [options.debugShowMemoryUsage=false] For debugging only. When true, draws labels to indicate the texture and geometry memory in megabytes used by each tile.
*
- * @exception {DeveloperError} The tileset must be 3D Tiles version 0.0. See https://github.com/AnalyticalGraphicsInc/3d-tiles#spec-status
+ * @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0. See {@link https://github.com/AnalyticalGraphicsInc/3d-tiles#spec-status}
*
* @example
* var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
* url : 'http://localhost:8002/tilesets/Seattle'
* }));
*
+ * @example
+ * // Common setting for the skipLevelOfDetail optimization
+ * var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
+ * url : 'http://localhost:8002/tilesets/Seattle',
+ * skipLevelOfDetail : true,
+ * baseScreenSpaceError : 1024,
+ * skipScreenSpaceErrorFactor : 16,
+ * skipLevels : 1,
+ * immediatelyLoadDesiredLevelOfDetail : false,
+ * loadSiblings : false,
+ * cullWithChildrenBounds : true
+ * }));
+ *
+ * @example
+ * // Common settings for the dynamicScreenSpaceError optimization
+ * var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
+ * url : 'http://localhost:8002/tilesets/Seattle',
+ * dynamicScreenSpaceError : true,
+ * dynamicScreenSpaceErrorDensity : 0.00278,
+ * dynamicScreenSpaceErrorFactor : 4.0,
+ * dynamicScreenSpaceErrorHeightFalloff : 0.25
+ * }));
+ *
* @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/blob/master/README.md|3D Tiles specification}
*/
function Cesium3DTileset(options) {
@@ -159,21 +182,21 @@ define([
//>>includeEnd('debug');
var tilesetUrl;
- var baseUrl;
+ var basePath;
if (getExtensionFromUri(url) === 'json') {
tilesetUrl = url;
- baseUrl = getBaseUri(url, true);
+ basePath = getBaseUri(url, true);
} else if (isDataUri(url)) {
tilesetUrl = url;
- baseUrl = '';
+ basePath = '';
} else {
- baseUrl = url;
- tilesetUrl = joinUrls(baseUrl, 'tileset.json');
+ basePath = url;
+ tilesetUrl = joinUrls(basePath, 'tileset.json');
}
this._url = url;
- this._baseUrl = baseUrl;
+ this._basePath = basePath;
this._tilesetUrl = tilesetUrl;
this._root = undefined;
this._asset = undefined; // Metadata for the entire tileset
@@ -208,7 +231,6 @@ define([
this._backfaceCommands = new ManagedArray();
this._maximumScreenSpaceError = defaultValue(options.maximumScreenSpaceError, 16);
- this._baseScreenSpaceError = defaultValue(options.baseScreenSpaceError, 1024);
this._maximumMemoryUsage = defaultValue(options.maximumMemoryUsage, 512);
this._styleEngine = new Cesium3DTileStyleEngine();
@@ -226,10 +248,10 @@ define([
this._readyPromise = when.defer();
/**
- * Whether the tileset should should refine based on a dynamic screen space error. Tiles that are further
+ * Optimization option. Whether the tileset should refine based on a dynamic screen space error. Tiles that are further
* away will be rendered with lower detail than closer tiles. This improves performance by rendering fewer
* tiles and making less requests, but may result in a slight drop in visual quality for tiles in the distance.
- * The algorithm is biased towards "street views" where the camera is close to the floor of the tileset and looking
+ * The algorithm is biased towards "street views" where the camera is close to the ground plane of the tileset and looking
* at the horizon. In addition results are more accurate for tightly fitting bounding volumes like box and region.
*
* @type {Boolean}
@@ -240,33 +262,35 @@ define([
this.dynamicScreenSpaceError = defaultValue(options.dynamicScreenSpaceError, false);
/**
- * A scalar that determines the density used to adjust the dynamic SSE, similar to {@link Fog}. Increasing this
+ * A scalar that determines the density used to adjust the dynamic screen space error, similar to {@link Fog}. Increasing this
* value has the effect of increasing the maximum screen space error for all tiles, but in a non-linear fashion.
* The error starts at 0.0 and increases exponentially until a midpoint is reached, and then approaches 1.0 asymptotically.
* This has the effect of keeping high detail in the closer tiles and lower detail in the further tiles, with all tiles
* beyond a certain distance all roughly having an error of 1.0.
- *
- * The dynamic error is in the range [0.0, 1.0) and is multiplied by dynamicScreenSpaceErrorFactor to produce the
+ *
+ * The dynamic error is in the range [0.0, 1.0) and is multiplied by dynamicScreenSpaceErrorFactor
to produce the
* final dynamic error. This dynamic error is then subtracted from the tile's actual screen space error.
- *
- * Increasing dynamicScreenSpaceErrorDensity has the effect of moving the error midpoint closer to the camera.
+ *
+ *
+ * Increasing dynamicScreenSpaceErrorDensity
has the effect of moving the error midpoint closer to the camera.
* It is analogous to moving fog closer to the camera.
+ *
*
* @type {Number}
* @default 0.00278
*
- * @see Fog.density
+ * @see Fog#density
*/
this.dynamicScreenSpaceErrorDensity = 0.00278;
/**
- * A factor used to increase the screen space error of tiles for dynamic SSE. As this value increases less tiles
+ * A factor used to increase the screen space error of tiles for dynamic screen space error. As this value increases less tiles
* are requested for rendering and tiles in the distance will have lower detail. If set to zero, the feature will be disabled.
*
* @type {Number}
* @default 4.0
*
- * @see Fog.screenSpaceErrorFactor
+ * @see Fog#screenSpaceErrorFactor
*/
this.dynamicScreenSpaceErrorFactor = 4.0;
@@ -274,8 +298,9 @@ define([
* A ratio of the tileset's height at which the density starts to falloff. If the camera is below this height the
* full computed density is applied, otherwise the density falls off. This has the effect of higher density at
* street level views.
- *
+ *
* Valid values are between 0.0 and 1.0.
+ *
*
* @type {Number}
* @default 0.25
@@ -286,6 +311,12 @@ define([
/**
* Determines whether the tileset casts or receives shadows from each light source.
+ *
+ * Enabling shadows has a performance impact. A tileset that casts shadows must be rendered twice, once from the camera and again from the light's point of view.
+ *
+ *
+ * Shadows are rendered only when {@link Viewer#shadows} is true
.
+ *
*
* @type {ShadowMode}
* @default ShadowMode.ENABLED
@@ -310,7 +341,7 @@ define([
this.colorBlendMode = Cesium3DTileColorBlendMode.HIGHLIGHT;
/**
- * Defines the value used to linearly interpolate between the source color and feature color when the colorBlendMode is MIX.
+ * Defines the value used to linearly interpolate between the source color and feature color when the {@link Cesium3DTileset#colorBlendMode} is MIX
.
* A value of 0.0 results in the source color while a value of 1.0 results in the feature color, with any value in-between
* resulting in a mix of the source color and feature color.
*
@@ -421,7 +452,7 @@ define([
/**
* This property is for debugging only; it is not optimized for production use.
*
- * When true, draws labels to indicate the vertex and texture memory usage of each tile.
+ * When true, draws labels to indicate the geometry and texture memory usage of each tile.
*
*
* @type {Boolean}
@@ -445,7 +476,7 @@ define([
* @default new Event()
*
* @example
- * city.loadProgress.addEventListener(function(numberOfPendingRequests, numberProcessing) {
+ * tileset.loadProgress.addEventListener(function(numberOfPendingRequests, numberProcessing) {
* if ((numberOfPendingRequests === 0) && (numberProcessing === 0)) {
* console.log('Stopped loading');
* return;
@@ -467,7 +498,7 @@ define([
* @default new Event()
*
* @example
- * city.allTilesLoaded.addEventListener(function() {
+ * tileset.allTilesLoaded.addEventListener(function() {
* console.log('All tiles are loaded');
* });
*
@@ -520,35 +551,60 @@ define([
* console.log('A Batched 3D Model tile is visible.');
* }
* });
+ *
+ * @example
+ * // Apply a red style and then manually set random colors for every other feature when the tile becomes visible.
+ * tileset.style = new Cesium.Cesium3DTileStyle({
+ * color : 'color("red")'
+ * });
+ * tileset.tileVisible.addEventListener(function(tile) {
+ * var content = tile.content;
+ * var featuresLength = content.featuresLength;
+ * for (var i = 0; i < featuresLength; i+=2) {
+ * content.getFeature(i).color = Cesium.Color.fromRandom();
+ * }
+ * });
*/
this.tileVisible = new Event();
/**
- * Determines if level-of-detail skipping optimization should be used.
+ * Optimization option. Determines if level of detail skipping should be applied during the traversal
*
* @type {Boolean}
* @default true
*/
- this.skipLODs = defaultValue(options.skipLODs, true);
+ this.skipLevelOfDetail = defaultValue(options.skipLevelOfDetail, true);
+
+ /**
+ * The screen space error that must be reached before skipping levels of detail.
+ *
+ * Only used when {@link Cesium3DTileset#skipLevelOfDetail} is true
.
+ *
+ *
+ * @type {Number}
+ * @default 1024
+ */
+ this.baseScreenSpaceError = defaultValue(options.baseScreenSpaceError, 1024);
/**
* Multiplier defining the minimum screen space error to skip.
* For example, if a tile has screen space error of 100, no tiles will be loaded unless they
- * are leaves or have a screen space error <= 100 / skipSSEFactor.
- *
- * Only used when tileset.skipLODs === true.
+ * are leaves or have a screen space error <= 100 / skipScreenSpaceErrorFactor
.
+ *
+ * Only used when {@link Cesium3DTileset#skipLevelOfDetail} is true
.
+ *
*
* @type {Number}
- * @default 10
+ * @default 16
*/
- this.skipScreenSpaceErrorFactor = defaultValue(options.skipScreenSpaceErrorFactor, 10);
+ this.skipScreenSpaceErrorFactor = defaultValue(options.skipScreenSpaceErrorFactor, 16);
/**
- * Constant defining the minimum number of levels skip. When it is 0, no levels are skipped.
- * For example, if a tile is level 1, no tiles will be loaded unless they
- * are at level greater than 2.
- *
- * Only used when tileset.skipLODs === true.
+ * Constant defining the minimum number of levels to skip when loading tiles. When it is 0, no levels are skipped.
+ * For example, if a tile is level 1, no tiles will be loaded unless they are at level greater than 2.
+ *
+ * Only used when {@link Cesium3DTileset#skipLevelOfDetail} is true
.
+ *
*
* @type {Number}
* @default 1
@@ -558,26 +614,133 @@ define([
/**
* When true, only tiles that meet the maximum screen space error will ever be downloaded.
* Skipping factors are ignored and just the desired tiles are loaded.
- *
- * Only used when tileset.skipLODs === true.
+ *
+ * Only used when {@link Cesium3DTileset#skipLevelOfDetail} is true
.
+ *
*
* @type {Boolean}
* @default false
*/
- this.immediatelyLoadDesiredLOD = defaultValue(options.immediatelyLoadDesiredLOD, false);
+ this.immediatelyLoadDesiredLevelOfDetail = defaultValue(options.immediatelyLoadDesiredLevelOfDetail, false);
/**
- * Determines whether sibling tiles should be loaded when skipping levels-of-detail.
- * When true, the siblings of any visible and downloaded tile are downloaded as well.
+ * Determines whether siblings of visible tiles are always downloaded during traversal.
* This may be useful for ensuring that tiles are already available when the viewer turns left/right.
- *
- * Only used when tileset.skipLODs === true.
+ *
+ * Only used when {@link Cesium3DTileset#skipLevelOfDetail} is true
.
+ *
*
* @type {Boolean}
* @default false
*/
this.loadSiblings = defaultValue(options.loadSiblings, false);
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * Determines if only the tiles from last frame should be used for rendering. This
+ * effectively "freezes" the tileset to the previous frame so it is possible to zoom
+ * out and see what was rendered.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugFreezeFrame = defaultValue(options.debugFreezeFrame, false);
+
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * When true, assigns a random color to each tile. This is useful for visualizing
+ * what features belong to what tiles, especially with additive refinement where features
+ * from parent tiles may be interleaved with features from child tiles.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugColorizeTiles = defaultValue(options.debugColorizeTiles, false);
+
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * When true, renders each tile's content as a wireframe.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugWireframe = defaultValue(options.debugWireframe, false);
+
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * When true, renders the bounding volume for each visible tile. The bounding volume is
+ * white if the tile has a content bounding volume; otherwise, it is red. Tiles that don't meet the
+ * screen space error and are still refining to their descendants are yellow.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugShowBoundingVolume = defaultValue(options.debugShowBoundingVolume, false);
+
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * When true, renders the bounding volume for each visible tile's content. The bounding volume is
+ * blue if the tile has a content bounding volume; otherwise it is red.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugShowContentBoundingVolume = defaultValue(options.debugShowContentBoundingVolume, false);
+
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * When true, renders the viewer request volume for each tile.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugShowViewerRequestVolume = defaultValue(options.debugShowViewerRequestVolume, false);
+
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * When true, draws labels to indicate the geometric error of each tile.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugShowGeometricError = defaultValue(options.debugShowGeometricError, false);
+
+ /**
+ * This property is for debugging only; it is not optimized for production use.
+ *
+ * When true, draws labels to indicate the number of commands, points, triangles and features of each tile.
+ *
+ *
+ * @type {Boolean}
+ * @default 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 geometry and texture memory usage of each tile.
+ *
+ *
+ * @type {Boolean}
+ * @default false
+ */
+ this.debugShowMemoryUsage = defaultValue(options.debugShowMemoryUsage, false);
+
var that = this;
// We don't know the distance of the tileset until tileset.json is loaded, so use the default distance for now
@@ -646,8 +809,8 @@ define([
* console.log('Maximum building height: ' + tileset.properties.height.maximum);
* console.log('Minimum building height: ' + tileset.properties.height.minimum);
*
- * @see {Cesium3DTileFeature#getProperty}
- * @see {Cesium3DTileFeature#setProperty}
+ * @see Cesium3DTileFeature#getProperty
+ * @see Cesium3DTileFeature#setProperty
*/
properties : {
get : function() {
@@ -690,7 +853,7 @@ define([
* @readonly
*
* @example
- * Cesium.when(tileset.readyPromise).then(function(tileset) {
+ * tileset.readyPromise.then(function(tileset) {
* // tile.properties is not defined until readyPromise resolves.
* var properties = tileset.properties;
* if (Cesium.defined(properties)) {
@@ -747,9 +910,9 @@ define([
* @type {String}
* @readonly
*/
- baseUrl : {
+ basePath : {
get : function() {
- return this._baseUrl;
+ return this._basePath;
}
},
@@ -764,7 +927,7 @@ define([
*
* The style is applied to a tile before the {@link Cesium3DTileset#tileVisible}
* event is raised, so code in tileVisible
can manually set a feature's
- * properties using {@link Cesium3DTileContent#getFeature}. When
+ * properties (e.g. color and show) after the style is applied. When
* a new style is assigned any manually set properties are overwritten.
*
*
@@ -801,8 +964,12 @@ define([
},
/**
- * The maximum screen-space error used to drive level-of-detail refinement. Higher
- * values will provide better performance but lower visual quality.
+ * The maximum screen space error used to drive level of detail refinement. This value helps determine when a tile
+ * refines to its descendants, and therefore plays a major role in balancing performance with visual quality.
+ *
+ * Depending on the tileset, maximumScreenSpaceError
may need to be tweaked to achieve the right balance.
+ * Higher values provide better performance but lower visual quality.
+ *
*
* @memberof Cesium3DTileset.prototype
*
@@ -825,17 +992,21 @@ define([
},
/**
- * The maximum amount of memory in MB that can be used by the tileset.
+ * The maximum amount of GPU memory (in MB) that may be used by the tileset. This value is estimated from
+ * geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also
+ * includes per-point metadata.
+ *
* Tiles not in view are unloaded to enforce this.
+ *
*
* If decreasing this value results in unloading tiles, the tiles are unloaded the next frame.
*
*
* If tiles sized more than maximumMemoryUsage
are needed
- * to meet the desired screen-space error, determined by {@link Cesium3DTileset#maximumScreenSpaceError},
+ * to meet the desired screen space error, determined by {@link Cesium3DTileset#maximumScreenSpaceError},
* for the current view, then the memory usage of the tiles loaded will exceed
* maximumMemoryUsage
. For example, if the maximum is 256 MB, but
- * 300 MB of tiles are needed to meet the screen-space error, then 300 MB of tiles may be loaded. When
+ * 300 MB of tiles are needed to meet the screen space error, then 300 MB of tiles may be loaded. When
* these tiles go out of view, they will be unloaded.
*
*
@@ -860,28 +1031,6 @@ define([
}
},
- /**
- * The tileset's bounding volume.
- *
- * @memberof Cesium3DTileset.prototype
- *
- * @type {TileBoundingVolume}
- * @readonly
- *
- * @exception {DeveloperError} The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.
- */
- boundingVolume : {
- get : function() {
- //>>includeStart('debug', pragmas.debug);
- if (!this.ready) {
- throw new DeveloperError('The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.');
- }
- //>>includeEnd('debug');
-
- return this._root._boundingVolume;
- }
- },
-
/**
* The tileset's bounding sphere.
*
@@ -891,6 +1040,16 @@ define([
* @readonly
*
* @exception {DeveloperError} The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.
+ *
+ * @example
+ * var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
+ * url : 'http://localhost:8002/tilesets/Seattle'
+ * }));
+ *
+ * tileset.readyPromise.then(function(tileset) {
+ * // Set the camera to view the newly added tileset
+ * viewer.camera.viewBoundingSphere(tileset.boundingSphere, new Cesium.HeadingPitchRange(0, -0.5, 0));
+ * });
*/
boundingSphere : {
get : function() {
@@ -905,7 +1064,7 @@ define([
},
/**
- * A 4x4 transformation matrix that transforms the tileset's root tile.
+ * A 4x4 transformation matrix that transforms the entire tileset.
*
* @memberof Cesium3DTileset.prototype
*
@@ -927,11 +1086,12 @@ define([
},
/**
- * Returns the time, in seconds, since the tileset was loaded and first updated.
+ * Returns the time, in milliseconds, since the tileset was loaded and first updated.
*
* @memberof Cesium3DTileset.prototype
*
* @type {Number}
+ * @readonly
*/
timeSinceLoad : {
get : function() {
@@ -940,19 +1100,21 @@ define([
},
/**
- * Returns the total amount of memory used in bytes by the tileset.
- * This is calculated as the sum of the vertex and index buffer, texture memory and batch table size
- * of the loaded tiles in the tileset.
+ * The total amount of GPU memory in bytes used by the tileset. This value is estimated from
+ * geometry, texture, and batch table textures of loaded tiles. For point clouds, this value also
+ * includes per-point metadata.
*
* @memberof Cesium3DTileset.prototype
*
* @type {Number}
+ * @readonly
+ *
* @see Cesium3DTileset#maximumMemoryUsage
*/
totalMemoryUsageInBytes : {
get : function() {
var statistics = this._statistics;
- return statistics.textureMemorySizeInBytes + statistics.vertexMemorySizeInBytes + statistics.batchTableMemorySizeInBytes;
+ return statistics.texturesByteLength + statistics.geometryByteLength + statistics.batchTableByteLength;
}
},
@@ -989,26 +1151,28 @@ define([
* @private
*/
Cesium3DTileset.prototype.loadTileset = function(tilesetUrl, tilesetJson, parentTile) {
+ var asset = tilesetJson.asset;
//>>includeStart('debug', pragmas.debug);
- if (!defined(tilesetJson.asset) || (tilesetJson.asset.version !== '0.0')) {
- throw new DeveloperError('The tileset must be 3D Tiles version 0.0. See https://github.com/AnalyticalGraphicsInc/3d-tiles#spec-status');
+ Check.typeOf.object('tilesetJson.asset', asset);
+ if (asset.version !== '0.0' && asset.version !== '1.0') {
+ throw new DeveloperError('The tileset must be 3D Tiles version 0.0 or 1.0. See https://github.com/AnalyticalGraphicsInc/3d-tiles#spec-status');
}
//>>includeEnd('debug');
var statistics = this._statistics;
- // Append the version to the baseUrl
+ // Append the version to the basePath
var hasVersionQuery = /[?&]v=/.test(tilesetUrl);
if (!hasVersionQuery) {
- var versionQuery = '?v=' + defaultValue(tilesetJson.asset.tilesetVersion, '0.0');
- this._baseUrl = joinUrls(this._baseUrl, versionQuery);
+ var versionQuery = '?v=' + defaultValue(asset.tilesetVersion, '0.0');
+ this._basePath = joinUrls(this._basePath, versionQuery);
tilesetUrl = joinUrls(tilesetUrl, versionQuery, false);
}
// A tileset.json referenced from a tile may exist in a different directory than the root tileset.
- // Get the baseUrl relative to the external tileset.
- var baseUrl = getBaseUri(tilesetUrl, true);
- var rootTile = new Cesium3DTile(this, baseUrl, tilesetJson.root, parentTile);
+ // Get the basePath relative to the external tileset.
+ var basePath = getBaseUri(tilesetUrl, true);
+ var rootTile = new Cesium3DTile(this, basePath, tilesetJson.root, parentTile);
// If there is a parentTile, add the root of the currently loading tileset
// to parentTile's children, and update its _depth.
@@ -1033,7 +1197,7 @@ define([
var length = children.length;
for (var i = 0; i < length; ++i) {
var childHeader = children[i];
- var childTile = new Cesium3DTile(this, baseUrl, childHeader, tile3D);
+ var childTile = new Cesium3DTile(this, basePath, childHeader, tile3D);
tile3D.children.push(childTile);
childTile._depth = tile3D._depth + 1;
++statistics.numberTotal;
@@ -1149,10 +1313,10 @@ define([
}
function selectionHeuristic(tileset, ancestor, tile) {
- var skipLevels = tileset.skipLODs ? tileset.skipLevels : 0;
- var skipScreenSpaceErrorFactor = tileset.skipLODs ? tileset.skipScreenSpaceErrorFactor : 0.1;
+ var skipLevels = tileset.skipLevelOfDetail ? tileset.skipLevels : 0;
+ var skipScreenSpaceErrorFactor = tileset.skipLevelOfDetail ? tileset.skipScreenSpaceErrorFactor : 1.0;
- return (ancestor !== tile && !tile.hasEmptyContent && !tileset.immediatelyLoadDesiredLOD) &&
+ return (ancestor !== tile && !tile.hasEmptyContent && !tileset.immediatelyLoadDesiredLevelOfDetail) &&
(tile._screenSpaceError < ancestor._screenSpaceError / skipScreenSpaceErrorFactor) &&
(tile._depth > ancestor._depth + skipLevels);
}
@@ -1328,8 +1492,8 @@ define([
}
if (tileset.debugShowMemoryUsage) {
- labelString += '\nTexture Memory: ' + formatMemoryString(tile.content.textureMemorySizeInBytes);
- labelString += '\nVertex Memory: ' + formatMemoryString(tile.content.vertexMemorySizeInBytes);
+ labelString += '\nTexture Memory: ' + formatMemoryString(tile.content.texturesByteLength);
+ labelString += '\nGeometry Memory: ' + formatMemoryString(tile.content.geometryByteLength);
attributes += 2;
}
@@ -1380,7 +1544,7 @@ define([
var tileVisible = tileset.tileVisible;
var i;
- var bivariateVisibilityTest = tileset.skipLODs && tileset._hasMixedContent && frameState.context.stencilBuffer && length > 0;
+ var bivariateVisibilityTest = tileset.skipLevelOfDetail && tileset._hasMixedContent && frameState.context.stencilBuffer && length > 0;
tileset._backfaceCommands.length = 0;
@@ -1582,7 +1746,7 @@ define([
this._loadTimestamp = JulianDate.clone(frameState.time);
}
- this._timeSinceLoad = Math.max(JulianDate.secondsDifference(frameState.time, this._loadTimestamp), 0.0);
+ this._timeSinceLoad = Math.max(JulianDate.secondsDifference(frameState.time, this._loadTimestamp) * 1000, 0.0);
// Do not do out-of-core operations (new content requests, cache removal,
// process new tiles) during the pick pass.
diff --git a/Source/Scene/Cesium3DTilesetStatistics.js b/Source/Scene/Cesium3DTilesetStatistics.js
index cff5d7332110..07383a35e976 100644
--- a/Source/Scene/Cesium3DTilesetStatistics.js
+++ b/Source/Scene/Cesium3DTilesetStatistics.js
@@ -9,31 +9,31 @@ define([
* @private
*/
function Cesium3DTilesetStatistics() {
- // Rendering stats
+ // Rendering statistics
this.selected = 0;
this.visited = 0;
- // Loading stats
+ // Loading statistics
this.numberOfCommands = 0;
this.numberOfAttemptedRequests = 0;
this.numberOfPendingRequests = 0;
this.numberProcessing = 0;
this.numberContentReady = 0; // Number of tiles with content loaded, does not include empty tiles
this.numberTotal = 0; // Number of tiles in tileset.json (and other tileset.json files as they are loaded)
- // Features stats
+ // Features statistics
this.numberOfFeaturesSelected = 0; // Number of features rendered
this.numberOfFeaturesLoaded = 0; // Number of features in memory
this.numberOfPointsSelected = 0;
this.numberOfPointsLoaded = 0;
this.numberOfTrianglesSelected = 0;
- // Styling stats
+ // Styling statistics
this.numberOfTilesStyled = 0;
this.numberOfFeaturesStyled = 0;
- // Optimization stats
+ // Optimization statistics
this.numberOfTilesCulledWithChildrenUnion = 0;
- // Memory stats
- this.vertexMemorySizeInBytes = 0;
- this.textureMemorySizeInBytes = 0;
- this.batchTableMemorySizeInBytes = 0;
+ // Memory statistics
+ this.geometryByteLength = 0;
+ this.texturesByteLength = 0;
+ this.batchTableByteLength = 0;
}
Cesium3DTilesetStatistics.prototype.clear = function() {
@@ -54,16 +54,16 @@ define([
var pointsLength = content.pointsLength;
var trianglesLength = content.trianglesLength;
var featuresLength = content.featuresLength;
- var vertexMemorySizeInBytes = content.vertexMemorySizeInBytes;
- var textureMemorySizeInBytes = content.textureMemorySizeInBytes;
- var batchTableMemorySizeInBytes = content.batchTableMemorySizeInBytes;
+ var geometryByteLength = content.geometryByteLength;
+ var texturesByteLength = content.texturesByteLength;
+ var batchTableByteLength = content.batchTableByteLength;
if (load) {
statistics.numberOfFeaturesLoaded += decrement ? -featuresLength : featuresLength;
statistics.numberOfPointsLoaded += decrement ? -pointsLength : pointsLength;
- statistics.vertexMemorySizeInBytes += decrement ? -vertexMemorySizeInBytes : vertexMemorySizeInBytes;
- statistics.textureMemorySizeInBytes += decrement ? -textureMemorySizeInBytes : textureMemorySizeInBytes;
- statistics.batchTableMemorySizeInBytes += decrement ? -batchTableMemorySizeInBytes : batchTableMemorySizeInBytes;
+ statistics.geometryByteLength += decrement ? -geometryByteLength : geometryByteLength;
+ statistics.texturesByteLength += decrement ? -texturesByteLength : texturesByteLength;
+ statistics.batchTableByteLength += decrement ? -batchTableByteLength : batchTableByteLength;
} else {
statistics.numberOfFeaturesSelected += decrement ? -featuresLength : featuresLength;
statistics.numberOfPointsSelected += decrement ? -pointsLength : pointsLength;
@@ -108,9 +108,9 @@ define([
result.numberOfTilesStyled = statistics.numberOfTilesStyled;
result.numberOfFeaturesStyled = statistics.numberOfFeaturesStyled;
result.numberOfTilesCulledWithChildrenUnion = statistics.numberOfTilesCulledWithChildrenUnion;
- result.vertexMemorySizeInBytes = statistics.vertexMemorySizeInBytes;
- result.textureMemorySizeInBytes = statistics.textureMemorySizeInBytes;
- result.batchTableMemorySizeInBytes = statistics.batchTableMemorySizeInBytes;
+ result.geometryByteLength = statistics.geometryByteLength;
+ result.texturesByteLength = statistics.texturesByteLength;
+ result.batchTableByteLength = statistics.batchTableByteLength;
};
return Cesium3DTilesetStatistics;
diff --git a/Source/Scene/Cesium3DTilesetTraversal.js b/Source/Scene/Cesium3DTilesetTraversal.js
index 2dae8dc1c7de..3e4a58f4873f 100644
--- a/Source/Scene/Cesium3DTilesetTraversal.js
+++ b/Source/Scene/Cesium3DTilesetTraversal.js
@@ -66,7 +66,7 @@ define([
loadTile(root, frameState);
- if (!tileset.skipLODs) {
+ if (!tileset.skipLevelOfDetail) {
// just execute base traversal and add tiles to _desiredTiles
tileset._baseTraversal.execute(tileset, root, maximumScreenSpaceError, frameState, outOfCore);
var leaves = tileset._baseTraversal.leaves;
@@ -75,14 +75,14 @@ define([
tileset._desiredTiles.push(leaves.get(i));
}
} else {
- if (tileset.immediatelyLoadDesiredLOD) {
+ if (tileset.immediatelyLoadDesiredLevelOfDetail) {
tileset._skipTraversal.execute(tileset, root, frameState, outOfCore);
} else {
// leaves of the base traversal is where we start the skip traversal
tileset._baseTraversal.leaves = tileset._skipTraversal.queue1;
- // load and select tiles without skipping up to tileset._baseScreenSpaceError
- tileset._baseTraversal.execute(tileset, root, tileset._baseScreenSpaceError, frameState, outOfCore);
+ // load and select tiles without skipping up to tileset.baseScreenSpaceError
+ tileset._baseTraversal.execute(tileset, root, tileset.baseScreenSpaceError, frameState, outOfCore);
// skip traversal starts from a prepopulated queue from the base traversal
tileset._skipTraversal.execute(tileset, undefined, frameState, outOfCore);
@@ -357,8 +357,8 @@ define([
};
BaseTraversal.prototype.leafHandler = function(tile) {
- // if skipLODs is off, leaves of the base traversal get pushed to tileset._desiredTiles. additive tiles have already been pushed
- if (this.tileset.skipLODs || !hasAdditiveContent(tile)) {
+ // if skipLevelOfDetail is off, leaves of the base traversal get pushed to tileset._desiredTiles. additive tiles have already been pushed
+ if (this.tileset.skipLevelOfDetail || !hasAdditiveContent(tile)) {
if (tile.refine === Cesium3DTileRefine.REPLACE && !childrenAreVisible(tile)) {
++this.tileset._statistics.numberOfTilesCulledWithChildrenUnion;
return;
diff --git a/Source/Scene/Composite3DTileContent.js b/Source/Scene/Composite3DTileContent.js
index 5685e3b9d4bf..b48ee36d9fed 100644
--- a/Source/Scene/Composite3DTileContent.js
+++ b/Source/Scene/Composite3DTileContent.js
@@ -102,9 +102,9 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface. Composite3DTileContent
- * always returns 0
. Instead call vertexMemorySizeInBytes
for a tile in the composite.
+ * always returns 0
. Instead call geometryByteLength
for a tile in the composite.
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
return 0;
}
@@ -112,9 +112,9 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface. Composite3DTileContent
- * always returns 0
. Instead call textureMemorySizeInBytes
for a tile in the composite.
+ * always returns 0
. Instead call texturesByteLength
for a tile in the composite.
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
return 0;
}
@@ -122,9 +122,9 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface. Composite3DTileContent
- * always returns 0
. Instead call batchTableMemorySizeInBytes
for a tile in the composite.
+ * always returns 0
. Instead call batchTableByteLength
for a tile in the composite.
*/
- batchTableMemorySizeInBytes : {
+ batchTableByteLength : {
get : function() {
return 0;
}
diff --git a/Source/Scene/ConditionsExpression.js b/Source/Scene/ConditionsExpression.js
index c1f646dc9493..16757cf6f391 100644
--- a/Source/Scene/ConditionsExpression.js
+++ b/Source/Scene/ConditionsExpression.js
@@ -37,8 +37,6 @@ define([
* ]
* });
* expression.evaluateColor(frameState, feature, result); // returns a Cesium.Color object
- *
- * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
*/
function ConditionsExpression(conditionsExpression, expressions) {
this._conditionsExpression = clone(conditionsExpression, true);
@@ -96,11 +94,12 @@ define([
* {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
* is of type Boolean
, Number
, or String
, the corresponding JavaScript
* primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
- * object will be returned. If the result is a Color
, a {@link Color} object will be returned.
+ * object will be returned. If the result is a Cartesian2
, Cartesian3
, or Cartesian4
,
+ * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned.
*
* @param {FrameState} frameState The frame state.
- * @param {Cesium3DTileFeature} feature The feature who's properties may be used as variables in the expression.
- * @returns {Boolean|Number|String|Color|RegExp} The result of evaluating the expression.
+ * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
+ * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4} The result of evaluating the expression.
*/
ConditionsExpression.prototype.evaluate = function(frameState, feature) {
var conditions = this._runtimeConditions;
@@ -117,9 +116,11 @@ define([
/**
* Evaluates the result of a Color expression, using the values defined by a feature.
- *
+ *
+ * This is equivalent to {@link StyleExpression#evaluate} but avoids allocating memory by accepting a result argument.
+ *
* @param {FrameState} frameState The frame state.
- * @param {Cesium3DTileFeature} feature The feature who's properties may be used as variables in the expression.
+ * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
* @param {Color} [result] The object in which to store the result
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
*/
diff --git a/Source/Scene/Empty3DTileContent.js b/Source/Scene/Empty3DTileContent.js
index 220b00070d52..82db01cc533b 100644
--- a/Source/Scene/Empty3DTileContent.js
+++ b/Source/Scene/Empty3DTileContent.js
@@ -58,7 +58,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
return 0;
}
@@ -67,7 +67,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
return 0;
}
@@ -76,7 +76,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- batchTableMemorySizeInBytes : {
+ batchTableByteLength : {
get : function() {
return 0;
}
diff --git a/Source/Scene/Expression.js b/Source/Scene/Expression.js
index 8b41c4347353..d4b46dd938ad 100644
--- a/Source/Scene/Expression.js
+++ b/Source/Scene/Expression.js
@@ -27,6 +27,150 @@ define([
ExpressionNodeType) {
'use strict';
+ /**
+ * Evaluates an expression defined using the
+ * {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}.
+ *
+ * Implements the {@link StyleExpression} interface.
+ *
+ *
+ * @alias Expression
+ * @constructor
+ *
+ * @param {String} [expression] The expression defined using the 3D Tiles Styling language.
+ * @param {Object} [expressions] Additional expressions defined in the style.
+ *
+ * @example
+ * var expression = new Cesium.Expression('(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)');
+ * expression.evaluate(frameState, feature); // returns true or false depending on the feature's properties
+ *
+ * @example
+ * var expression = new Cesium.Expression('(${Temperature} > 90) ? color("red") : color("white")');
+ * expression.evaluateColor(frameState, feature, result); // returns a Cesium.Color object
+ */
+ function Expression(expression, expressions) {
+ //>>includeStart('debug', pragmas.debug);
+ Check.typeOf.string('expression', expression);
+ //>>includeEnd('debug');
+
+ this._expression = expression;
+ expression = replaceExpressions(expression, expressions);
+ expression = replaceVariables(removeBackslashes(expression));
+
+ // customize jsep operators
+ jsep.addBinaryOp('=~', 0);
+ jsep.addBinaryOp('!~', 0);
+
+ var ast;
+ try {
+ ast = jsep(expression);
+ } catch (e) {
+ //>>includeStart('debug', pragmas.debug);
+ throw new DeveloperError(e);
+ //>>includeEnd('debug');
+ }
+
+ this._runtimeAst = createRuntimeAst(this, ast);
+ }
+
+ defineProperties(Expression.prototype, {
+ /**
+ * Gets the expression defined in the 3D Tiles Styling language.
+ *
+ * @memberof Expression.prototype
+ *
+ * @type {String}
+ * @readonly
+ *
+ * @default undefined
+ */
+ expression : {
+ get : function() {
+ return this._expression;
+ }
+ }
+ });
+
+ /**
+ * Evaluates the result of an expression, optionally using the provided feature's properties. If the result of
+ * the expression in the
+ * {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
+ * is of type Boolean
, Number
, or String
, the corresponding JavaScript
+ * primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
+ * object will be returned. If the result is a Cartesian2
, Cartesian3
, or Cartesian4
,
+ * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned.
+ *
+ * @param {FrameState} frameState The frame state.
+ * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
+ * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4} The result of evaluating the expression.
+ */
+ Expression.prototype.evaluate = function(frameState, feature) {
+ ScratchStorage.reset();
+ var result = this._runtimeAst.evaluate(frameState, feature);
+ if ((result instanceof Cartesian2) || (result instanceof Cartesian3) || (result instanceof Cartesian4)) {
+ return result.clone();
+ }
+ return result;
+ };
+
+ /**
+ * Evaluates the result of a Color expression, using the values defined by a feature.
+ *
+ * This is equivalent to {@link StyleExpression#evaluate} but avoids allocating memory by accepting a result argument.
+ *
+ * @param {FrameState} frameState The frame state.
+ * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
+ * @param {Color} [result] The object in which to store the result
+ * @returns {Color} The modified result parameter or a new Color instance if one was not provided.
+ */
+ Expression.prototype.evaluateColor = function(frameState, feature, result) {
+ ScratchStorage.reset();
+ var color = this._runtimeAst.evaluate(frameState, feature);
+ return Color.fromCartesian4(color, result);
+ };
+
+ /**
+ * Gets the shader function for this expression.
+ * Returns undefined if the shader function can't be generated from this expression.
+ *
+ * @param {String} functionName Name to give to the generated function.
+ * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes.
+ * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent.
+ * @param {String} returnType The return type of the generated function.
+ *
+ * @returns {String} The shader function.
+ *
+ * @private
+ */
+ Expression.prototype.getShaderFunction = function(functionName, attributePrefix, shaderState, returnType) {
+ var shaderExpression = this.getShaderExpression(attributePrefix, shaderState);
+ if (!defined(shaderExpression)) {
+ return undefined;
+ }
+
+ shaderExpression = returnType + ' ' + functionName + '() \n' +
+ '{ \n' +
+ ' return ' + shaderExpression + '; \n' +
+ '} \n';
+
+ return shaderExpression;
+ };
+
+ /**
+ * Gets the shader expression for this expression.
+ * Returns undefined if the shader expression can't be generated from this expression.
+ *
+ * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes.
+ * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent.
+ *
+ * @returns {String} The shader expression.
+ *
+ * @private
+ */
+ Expression.prototype.getShaderExpression = function(attributePrefix, shaderState) {
+ return this._runtimeAst.getShaderExpression(attributePrefix, shaderState);
+ };
+
var unaryOperators = ['!', '-', '+'];
var binaryOperators = ['+', '-', '*', '/', '%', '===', '!==', '>', '>=', '<', '<=', '&&', '||', '!~', '=~'];
@@ -282,150 +426,6 @@ define([
//>>includeEnd('debug');
}
- /**
- * Evaluates an expression defined using the
- * {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}.
- *
- * Implements the {@link StyleExpression} interface.
- *
- *
- * @alias Expression
- * @constructor
- *
- * @param {String} [expression] The expression defined using the 3D Tiles Styling language.
- * @param {Object} [expressions] Additional expressions defined in the style.
- *
- * @example
- * var expression = new Cesium.Expression('(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)');
- * expression.evaluate(frameState, feature); // returns true or false depending on the feature's properties
- *
- * @example
- * var expression = new Cesium.Expression('(${Temperature} > 90) ? color("red") : color("white")');
- * expression.evaluateColor(frameState, feature, result); // returns a Cesium.Color object
- *
- * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
- */
- function Expression(expression, expressions) {
- //>>includeStart('debug', pragmas.debug);
- Check.typeOf.string('expression', expression);
- //>>includeEnd('debug');
-
- this._expression = expression;
- expression = replaceExpressions(expression, expressions);
- expression = replaceVariables(removeBackslashes(expression));
-
- // customize jsep operators
- jsep.addBinaryOp('=~', 0);
- jsep.addBinaryOp('!~', 0);
-
- var ast;
- try {
- ast = jsep(expression);
- } catch (e) {
- //>>includeStart('debug', pragmas.debug);
- throw new DeveloperError(e);
- //>>includeEnd('debug');
- }
-
- this._runtimeAst = createRuntimeAst(this, ast);
- }
-
- defineProperties(Expression.prototype, {
- /**
- * Gets the expression defined in the 3D Tiles Styling language.
- *
- * @memberof Expression.prototype
- *
- * @type {String}
- * @readonly
- *
- * @default undefined
- */
- expression : {
- get : function() {
- return this._expression;
- }
- }
- });
-
- /**
- * Evaluates the result of an expression, optionally using the provided feature's properties. If the result of
- * the expression in the
- * {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
- * is of type Boolean
, Number
, or String
, the corresponding JavaScript
- * primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
- * object will be returned. If the result is a Cartesian2
, Cartesian3
, or Cartesian4
,
- * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned.
- *
- * @param {FrameState} frameState The frame state.
- * @param {Cesium3DTileFeature} feature The feature who's properties may be used as variables in the expression.
- * @returns {Boolean|Number|String|Cartesian2|Cartesian3|Cartesian4|RegExp} The result of evaluating the expression.
- */
- Expression.prototype.evaluate = function(frameState, feature) {
- ScratchStorage.reset();
- var result = this._runtimeAst.evaluate(frameState, feature);
- if ((result instanceof Cartesian2) || (result instanceof Cartesian3) || (result instanceof Cartesian4)) {
- return result.clone();
- }
- return result;
- };
-
- /**
- * Evaluates the result of a Color expression, using the values defined by a feature.
- *
- * @param {FrameState} frameState The frame state.
- * @param {Cesium3DTileFeature} feature The feature who's properties may be used as variables in the expression.
- * @param {Color} [result] The object in which to store the result
- * @returns {Color} The modified result parameter or a new Color instance if one was not provided.
- */
- Expression.prototype.evaluateColor = function(frameState, feature, result) {
- ScratchStorage.reset();
- var color = this._runtimeAst.evaluate(frameState, feature);
- return Color.fromCartesian4(color, result);
- };
-
- /**
- * Gets the shader function for this expression.
- * Returns undefined if the shader function can't be generated from this expression.
- *
- * @param {String} functionName Name to give to the generated function.
- * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes.
- * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent.
- * @param {String} returnType The return type of the generated function.
- *
- * @returns {String} The shader function.
- *
- * @private
- */
- Expression.prototype.getShaderFunction = function(functionName, attributePrefix, shaderState, returnType) {
- var shaderExpression = this.getShaderExpression(attributePrefix, shaderState);
- if (!defined(shaderExpression)) {
- return undefined;
- }
-
- shaderExpression = returnType + ' ' + functionName + '() \n' +
- '{ \n' +
- ' return ' + shaderExpression + '; \n' +
- '} \n';
-
- return shaderExpression;
- };
-
- /**
- * Gets the shader expression for this expression.
- * Returns undefined if the shader expression can't be generated from this expression.
- *
- * @param {String} attributePrefix Prefix that is added to any variable names to access vertex attributes.
- * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent.
- *
- * @returns {String} The shader expression.
- *
- * @private
- */
- Expression.prototype.getShaderExpression = function(attributePrefix, shaderState) {
- return this._runtimeAst.getShaderExpression(attributePrefix, shaderState);
- };
-
function Node(type, value, left, right, test) {
this._type = type;
this._value = value;
diff --git a/Source/Scene/Instanced3DModel3DTileContent.js b/Source/Scene/Instanced3DModel3DTileContent.js
index 82d379833128..f62ac0f3f0ea 100644
--- a/Source/Scene/Instanced3DModel3DTileContent.js
+++ b/Source/Scene/Instanced3DModel3DTileContent.js
@@ -120,11 +120,11 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
var model = this._modelInstanceCollection._model;
if (defined(model)) {
- return model.vertexMemorySizeInBytes;
+ return model.geometryByteLength;
}
return 0;
}
@@ -133,11 +133,11 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
var model = this._modelInstanceCollection._model;
if (defined(model)) {
- return model.textureMemorySizeInBytes;
+ return model.texturesByteLength;
}
return 0;
}
@@ -146,7 +146,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- batchTableMemorySizeInBytes : {
+ batchTableByteLength : {
get : function() {
return this._batchTable.memorySizeInBytes;
}
diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js
index 8ec74aca1050..269f87da19de 100644
--- a/Source/Scene/Model.js
+++ b/Source/Scene/Model.js
@@ -689,10 +689,10 @@ define([
this._cachedRendererResources = undefined;
this._loadRendererResourcesFromCache = false;
- this._cachedVertexMemorySizeInBytes = 0;
- this._cachedTextureMemorySizeInBytes = 0;
- this._vertexMemorySizeInBytes = 0;
- this._textureMemorySizeInBytes = 0;
+ this._cachedGeometryByteLength = 0;
+ this._cachedTexturesByteLength = 0;
+ this._geometryByteLength = 0;
+ this._texturesByteLength = 0;
this._trianglesLength = 0;
this._nodeCommands = [];
@@ -1010,13 +1010,13 @@ define([
},
/**
- * Gets the model's vertex memory in bytes. This includes all vertex and index buffers.
+ * Gets the model's geometry memory in bytes. This includes all vertex and index buffers.
*
* @private
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
- return this._vertexMemorySizeInBytes;
+ return this._geometryByteLength;
}
},
@@ -1025,20 +1025,20 @@ define([
*
* @private
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
- return this._textureMemorySizeInBytes;
+ return this._texturesByteLength;
}
},
/**
- * Gets the model's cached vertex memory in bytes. This includes all vertex and index buffers.
+ * Gets the model's cached geometry memory in bytes. This includes all vertex and index buffers.
*
* @private
*/
- cachedVertexMemorySizeInBytes : {
+ cachedGeometryByteLength : {
get : function() {
- return this._cachedVertexMemorySizeInBytes;
+ return this._cachedGeometryByteLength;
}
},
@@ -1047,9 +1047,9 @@ define([
*
* @private
*/
- cachedTextureMemorySizeInBytes : {
+ cachedTexturesByteLength : {
get : function() {
- return this._cachedTextureMemorySizeInBytes;
+ return this._cachedTexturesByteLength;
}
}
});
@@ -1816,7 +1816,7 @@ define([
});
vertexBuffer.vertexArrayDestroyable = false;
model._rendererResources.buffers[bufferViewId] = vertexBuffer;
- model._vertexMemorySizeInBytes += vertexBuffer.sizeInBytes;
+ model._geometryByteLength += vertexBuffer.sizeInBytes;
}
///////////////////////////////////////////////////////////////////////////
@@ -1854,7 +1854,7 @@ define([
});
indexBuffer.vertexArrayDestroyable = false;
model._rendererResources.buffers[bufferViewId] = indexBuffer;
- model._vertexMemorySizeInBytes += indexBuffer.sizeInBytes;
+ model._geometryByteLength += indexBuffer.sizeInBytes;
}
var scratchVertexBufferJob = new CreateVertexBufferJob();
@@ -2364,7 +2364,7 @@ define([
}
model._rendererResources.textures[gltfTexture.id] = tx;
- model._textureMemorySizeInBytes += tx.sizeInBytes;
+ model._texturesByteLength += tx.sizeInBytes;
}
var scratchCreateTextureJob = new CreateTextureJob();
@@ -3636,7 +3636,7 @@ define([
model._runtime.nodes = runtimeNodes;
}
- function getVertexMemorySizeInBytes(buffers) {
+ function getGeometryByteLength(buffers) {
var memory = 0;
for (var id in buffers) {
if (buffers.hasOwnProperty(id)) {
@@ -3646,7 +3646,7 @@ define([
return memory;
}
- function getTextureMemorySizeInBytes(textures) {
+ function getTexturesByteLength(textures) {
var memory = 0;
for (var id in textures) {
if (textures.hasOwnProperty(id)) {
@@ -3678,8 +3678,8 @@ define([
createVertexArrays(model, context);
}
- model._cachedVertexMemorySizeInBytes += getVertexMemorySizeInBytes(cachedResources.buffers);
- model._cachedTextureMemorySizeInBytes += getTextureMemorySizeInBytes(cachedResources.textures);
+ model._cachedGeometryByteLength += getGeometryByteLength(cachedResources.buffers);
+ model._cachedTexturesByteLength += getTexturesByteLength(cachedResources.textures);
} else {
createBuffers(model, frameState); // using glTF bufferViews
createPrograms(model, frameState);
diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js
index 5bb4fb4e89e2..57552ad866d9 100644
--- a/Source/Scene/PointCloud3DTileContent.js
+++ b/Source/Scene/PointCloud3DTileContent.js
@@ -120,7 +120,7 @@ define([
this._readyPromise = when.defer();
this._pointsLength = 0;
- this._vertexMemorySizeInBytes = 0;
+ this._geometryByteLength = 0;
this._features = undefined;
@@ -166,16 +166,16 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
- return this._vertexMemorySizeInBytes;
+ return this._geometryByteLength;
}
},
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
return 0;
}
@@ -184,7 +184,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- batchTableMemorySizeInBytes : {
+ batchTableByteLength : {
get : function() {
if (defined(this._batchTable)) {
return this._batchTable.memorySizeInBytes;
@@ -490,7 +490,7 @@ define([
usage : BufferUsage.STATIC_DRAW
});
- content._vertexMemorySizeInBytes += vertexBuffer.sizeInBytes;
+ content._geometryByteLength += vertexBuffer.sizeInBytes;
var vertexAttribute = {
index : attributeLocation,
@@ -540,7 +540,7 @@ define([
typedArray : positions,
usage : BufferUsage.STATIC_DRAW
});
- content._vertexMemorySizeInBytes += positionsVertexBuffer.sizeInBytes;
+ content._geometryByteLength += positionsVertexBuffer.sizeInBytes;
var colorsVertexBuffer;
if (hasColors) {
@@ -549,7 +549,7 @@ define([
typedArray : colors,
usage : BufferUsage.STATIC_DRAW
});
- content._vertexMemorySizeInBytes += colorsVertexBuffer.sizeInBytes;
+ content._geometryByteLength += colorsVertexBuffer.sizeInBytes;
}
var normalsVertexBuffer;
@@ -559,7 +559,7 @@ define([
typedArray : normals,
usage : BufferUsage.STATIC_DRAW
});
- content._vertexMemorySizeInBytes += normalsVertexBuffer.sizeInBytes;
+ content._geometryByteLength += normalsVertexBuffer.sizeInBytes;
}
var batchIdsVertexBuffer;
@@ -569,7 +569,7 @@ define([
typedArray : batchIds,
usage : BufferUsage.STATIC_DRAW
});
- content._vertexMemorySizeInBytes += batchIdsVertexBuffer.sizeInBytes;
+ content._geometryByteLength += batchIdsVertexBuffer.sizeInBytes;
}
var attributes = [];
@@ -704,7 +704,7 @@ define([
content._drawCommand = new DrawCommand({
boundingVolume : undefined, // Updated in update
- cull : false, // Already culled by 3D tiles
+ cull : false, // Already culled by 3D Tiles
modelMatrix : new Matrix4(),
primitiveType : PrimitiveType.POINTS,
vertexArray : vertexArray,
@@ -718,7 +718,7 @@ define([
content._pickCommand = new DrawCommand({
boundingVolume : undefined, // Updated in update
- cull : false, // Already culled by 3D tiles
+ cull : false, // Already culled by 3D Tiles
modelMatrix : new Matrix4(),
primitiveType : PrimitiveType.POINTS,
vertexArray : vertexArray,
diff --git a/Source/Scene/QuadtreeTileProvider.js b/Source/Scene/QuadtreeTileProvider.js
index f577b1596c6e..55fc8b4434c3 100644
--- a/Source/Scene/QuadtreeTileProvider.js
+++ b/Source/Scene/QuadtreeTileProvider.js
@@ -105,7 +105,7 @@ define([
* Gets the maximum geometric error allowed in a tile at a given level, in meters. This function should not be
* called before {@link QuadtreeTileProvider#ready} returns true.
*
- * @see {QuadtreeTileProvider.computeDefaultLevelZeroMaximumGeometricError}
+ * @see QuadtreeTileProvider#computeDefaultLevelZeroMaximumGeometricError
*
* @memberof QuadtreeTileProvider
* @function
@@ -205,7 +205,7 @@ define([
*
* @example
* provider = provider && provider();
- *
+ *
* @see QuadtreeTileProvider#isDestroyed
*/
QuadtreeTileProvider.prototype.destroy = DeveloperError.throwInstantiationError;
diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js
index 902aef7b4ac7..7c224a2be1a4 100644
--- a/Source/Scene/Scene.js
+++ b/Source/Scene/Scene.js
@@ -2791,6 +2791,18 @@ define([
* Returns an object with a `primitive` property that contains the first (top) primitive in the scene
* at a particular window coordinate or undefined if nothing is at the location. Other properties may
* potentially be set depending on the type of primitive.
+ *
+ * When a feature of a 3D Tiles tileset is picked, pick
returns a {@link Cesium3DTileFeature} object.
+ *
+ *
+ * @example
+ * // On mouse over, color the feature yellow.
+ * handler.setInputAction(function(movement) {
+ * var feature = scene.pick(movement.endPosition);
+ * if (feature instanceof Cesium.Cesium3DTileFeature) {
+ * feature.color = Cesium.Color.YELLOW;
+ * }
+ * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
*
* @param {Cartesian2} windowPosition Window coordinates to perform picking on.
* @returns {Object} Object containing the picked primitive.
diff --git a/Source/Scene/StyleExpression.js b/Source/Scene/StyleExpression.js
index b4f7f1ceb07d..63cbfc98e3b1 100644
--- a/Source/Scene/StyleExpression.js
+++ b/Source/Scene/StyleExpression.js
@@ -19,7 +19,6 @@ define([
*
* @see Expression
* @see ConditionsExpression
- * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
*/
function StyleExpression() {
}
@@ -30,21 +29,25 @@ define([
* {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/Styling|3D Tiles Styling language}
* is of type Boolean
, Number
, or String
, the corresponding JavaScript
* primitive type will be returned. If the result is a RegExp
, a Javascript RegExp
- * object will be returned. If the result is a Color
, a {@link Color} object will be returned.
+ * object will be returned. If the result is a Cartesian2
, Cartesian3
, or Cartesian4
,
+ * a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned.
*
* @param {FrameState} frameState The frame state.
- * @param {Cesium3DTileFeature} feature The feature who's properties may be used as variables in the expression.
- * @returns {Boolean|Number|String|Color|RegExp} The result of evaluating the expression.
+ * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
+ * @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4} The result of evaluating the expression.
*/
StyleExpression.prototype.evaluate = function(frameState, feature) {
DeveloperError.throwInstantiationError();
};
/**
- * Evaluates the result of a Color expression, using the values defined by a feature.
+ * Evaluates the result of a Color expression, optionally using the provided feature's properties.
+ *
+ * This is equivalent to {@link StyleExpression#evaluate} but avoids allocating memory by accepting a result argument.
+ *
*
* @param {FrameState} frameState The frame state.
- * @param {Cesium3DTileFeature} feature The feature who's properties may be used as variables in the expression.
+ * @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
* @param {Color} [result] The object in which to store the result
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
*/
diff --git a/Source/Scene/TileBoundingRegion.js b/Source/Scene/TileBoundingRegion.js
index 670385d04bd1..30758f76dfa1 100644
--- a/Source/Scene/TileBoundingRegion.js
+++ b/Source/Scene/TileBoundingRegion.js
@@ -244,7 +244,7 @@ define([
var vectorScratch = new Cartesian3();
/**
- * Gets the distance from the camera to the closest point on the tile. This is used for level-of-detail selection.
+ * Gets the distance from the camera to the closest point on the tile. This is used for level of detail selection.
*
* @param {FrameState} frameState The state information of the current rendering frame.
* @returns {Number} The distance from the camera to the closest point on the tile, in meters.
diff --git a/Source/Scene/Tileset3DTileContent.js b/Source/Scene/Tileset3DTileContent.js
index ba3b6d6cd916..59f9a44d4e49 100644
--- a/Source/Scene/Tileset3DTileContent.js
+++ b/Source/Scene/Tileset3DTileContent.js
@@ -72,7 +72,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- vertexMemorySizeInBytes : {
+ geometryByteLength : {
get : function() {
return 0;
}
@@ -81,7 +81,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- textureMemorySizeInBytes : {
+ texturesByteLength : {
get : function() {
return 0;
}
@@ -90,7 +90,7 @@ define([
/**
* Part of the {@link Cesium3DTileContent} interface.
*/
- batchTableMemorySizeInBytes : {
+ batchTableByteLength : {
get : function() {
return 0;
}
diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css
index 213295f1f983..196038b4a88e 100644
--- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css
+++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.css
@@ -1,11 +1,11 @@
-ul.cesium-cesiumInspector-stats {
+ul.cesium-cesiumInspector-statistics {
margin: 0;
padding-top: 3px;
padding-bottom: 3px;
}
-ul.cesium-cesiumInspector-stats + ul.cesium-cesiumInspector-stats {
+ul.cesium-cesiumInspector-statistics + ul.cesium-cesiumInspector-statistics {
border-top: 1px solid #aaa;
}
@@ -100,7 +100,7 @@ input[type=range]:focus {
pointer-events: all;
}
-.cesium-3DTilesInspector-stats {
+.cesium-3DTilesInspector-statistics {
font-size: 11px;
}
diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js
index 8f93ad4bc411..93b7e802e2e5 100644
--- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js
+++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js
@@ -94,7 +94,7 @@ define([
}
/**
- * Inspector widget to aid in debugging 3D tiles
+ * Inspector widget to aid in debugging 3D Tiles
*
* @alias Cesium3DTilesInspector
* @constructor
@@ -167,16 +167,16 @@ define([
loggingPanelContents.appendChild(makeCheckbox('performance', 'Performance'));
loggingPanelContents.appendChild(performanceContainer);
- loggingPanelContents.appendChild(makeCheckbox('showStats', 'Stats'));
- var stats = document.createElement('div');
- stats.className = 'cesium-3dTilesInspector-stats';
- stats.setAttribute('data-bind', 'html: statsText, visible: showStats');
- loggingPanelContents.appendChild(stats);
- loggingPanelContents.appendChild(makeCheckbox('showPickStats', 'Pick Stats'));
- var pickStats = document.createElement('div');
- pickStats.className = 'cesium-3dTilesInspector-stats';
- pickStats.setAttribute('data-bind', 'html: pickStatsText, visible: showPickStats');
- loggingPanelContents.appendChild(pickStats);
+ loggingPanelContents.appendChild(makeCheckbox('showStatistics', 'Statistics'));
+ var statistics = document.createElement('div');
+ statistics.className = 'cesium-3dTilesInspector-statistics';
+ statistics.setAttribute('data-bind', 'html: statisticsText, visible: showStatistics');
+ loggingPanelContents.appendChild(statistics);
+ loggingPanelContents.appendChild(makeCheckbox('showPickStatistics', 'Pick Statistics'));
+ var pickStatistics = document.createElement('div');
+ pickStatistics.className = 'cesium-3dTilesInspector-statistics';
+ pickStatistics.setAttribute('data-bind', 'html: pickStatisticsText, visible: showPickStatistics');
+ loggingPanelContents.appendChild(pickStatistics);
stylePanelContents.appendChild(document.createTextNode('Color Blend Mode: '));
var blendDropdown = document.createElement('select');
diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js
index e9d9c5b1f187..853668c5763d 100644
--- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js
+++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js
@@ -56,64 +56,64 @@ define([
}
}
- function getStats(tileset, isPick) {
+ function getStatistics(tileset, isPick) {
if (!defined(tileset)) {
return '';
}
- var stats = tileset.statistics;
+ var statistics = tileset.statistics;
// Since the pick pass uses a smaller frustum around the pixel of interest,
- // the stats will be different than the normal render pass.
- var s = '';
+ // the statistics will be different than the normal render pass.
+ var s = '';
s +=
- // --- Rendering stats
- '- Visited: ' + stats.visited.toLocaleString() + '
' +
+ // --- Rendering statistics
+ '- Visited: ' + statistics.visited.toLocaleString() + '
' +
// Number of commands returned is likely to be higher than the number of tiles selected
// because of tiles that create multiple commands.
'- Selected: ' + tileset._selectedTiles.length.toLocaleString() + '
' +
// Number of commands executed is likely to be higher because of commands overlapping
// multiple frustums.
- '- Commands: ' + stats.numberOfCommands.toLocaleString() + '
';
+ '- Commands: ' + statistics.numberOfCommands.toLocaleString() + '
';
s += '
';
if (!isPick) {
- s += '';
+ s += '';
s +=
- // --- Cache/loading stats
- '- Requests: ' + stats.numberOfPendingRequests.toLocaleString() + '
' +
- '- Attempted: ' + stats.numberOfAttemptedRequests.toLocaleString() + '
' +
- '- Processing: ' + stats.numberProcessing.toLocaleString() + '
' +
- '- Content Ready: ' + stats.numberContentReady.toLocaleString() + '
' +
+ // --- Cache/loading statistics
+ '- Requests: ' + statistics.numberOfPendingRequests.toLocaleString() + '
' +
+ '- Attempted: ' + statistics.numberOfAttemptedRequests.toLocaleString() + '
' +
+ '- Processing: ' + statistics.numberProcessing.toLocaleString() + '
' +
+ '- Content Ready: ' + statistics.numberContentReady.toLocaleString() + '
' +
// Total number of tiles includes tiles without content, so "Ready" may never reach
// "Total." Total also will increase when a tile with a tileset.json content is loaded.
- '- Total: ' + stats.numberTotal.toLocaleString() + '
';
+ '- Total: ' + statistics.numberTotal.toLocaleString() + '
';
s += '
';
- s += '';
+ s += '';
s +=
- // --- Features stats
- '- Features Selected: ' + stats.numberOfFeaturesSelected.toLocaleString() + '
' +
- '- Features Loaded: ' + stats.numberOfFeaturesLoaded.toLocaleString() + '
' +
- '- Points Selected: ' + stats.numberOfPointsSelected.toLocaleString() + '
' +
- '- Points Loaded: ' + stats.numberOfPointsLoaded.toLocaleString() + '
' +
- '- Triangles Selected: ' + stats.numberOfTrianglesSelected.toLocaleString() + '
';
+ // --- Features statistics
+ '- Features Selected: ' + statistics.numberOfFeaturesSelected.toLocaleString() + '
' +
+ '- Features Loaded: ' + statistics.numberOfFeaturesLoaded.toLocaleString() + '
' +
+ '- Points Selected: ' + statistics.numberOfPointsSelected.toLocaleString() + '
' +
+ '- Points Loaded: ' + statistics.numberOfPointsLoaded.toLocaleString() + '
' +
+ '- Triangles Selected: ' + statistics.numberOfTrianglesSelected.toLocaleString() + '
';
s += '
';
- s += '';
+ s += '';
s +=
- // --- Styling stats
- '- Tiles styled: ' + stats.numberOfTilesStyled.toLocaleString() + '
' +
- '- Features styled: ' + stats.numberOfFeaturesStyled.toLocaleString() + '
';
+ // --- Styling statistics
+ '- Tiles styled: ' + statistics.numberOfTilesStyled.toLocaleString() + '
' +
+ '- Features styled: ' + statistics.numberOfFeaturesStyled.toLocaleString() + '
';
s += '
';
- s += '';
+ s += '';
s +=
- // --- Optimization stats
- '- Children Union Culled: ' + stats.numberOfTilesCulledWithChildrenUnion.toLocaleString() + '
';
+ // --- Optimization statistics
+ '- Children Union Culled: ' + statistics.numberOfTilesCulledWithChildrenUnion.toLocaleString() + '
';
s += '
';
- s += '';
+ s += '';
s +=
- // --- Memory stats
- '- Vertex Memory (MB): ' + formatMemoryString(stats.vertexMemorySizeInBytes) + '
' +
- '- Texture Memory (MB): ' + formatMemoryString(stats.textureMemorySizeInBytes) + '
' +
- '- Batch Table Memory (MB): ' + formatMemoryString(stats.batchTableMemorySizeInBytes) + '
';
+ // --- Memory statistics
+ '- Geometry Memory (MB): ' + formatMemoryString(statistics.geometryByteLength) + '
' +
+ '- Texture Memory (MB): ' + formatMemoryString(statistics.texturesByteLength) + '
' +
+ '- Batch Table Memory (MB): ' + formatMemoryString(statistics.batchTableByteLength) + '
';
s += '
';
}
return s;
@@ -159,8 +159,8 @@ define([
container : performanceContainer
});
- this._statsText = '';
- this._pickStatsText = '';
+ this._statisticsText = '';
+ this._pickStatisticsText = '';
this._editorError = '';
/**
@@ -172,20 +172,20 @@ define([
this.performance = false;
/**
- * Gets or sets the flag to show stats. This property is observable.
+ * Gets or sets the flag to show statistics. This property is observable.
*
* @type {Boolean}
* @default true
*/
- this.showStats = true;
+ this.showStatistics = true;
/**
- * Gets or sets the flag to show pick stats. This property is observable.
+ * Gets or sets the flag to show pick statistics. This property is observable.
*
* @type {Boolean}
* @default false
*/
- this.showPickStats = true;
+ this.showPickStatistics = true;
/**
* Gets or sets the flag to show the inspector. This property is observable.
@@ -254,7 +254,7 @@ define([
this._tileset = undefined;
this._feature = undefined;
- knockout.track(this, ['performance', 'inspectorVisible', '_statsText', '_pickStatsText', '_editorError', 'showPickStats', 'showStats',
+ knockout.track(this, ['performance', 'inspectorVisible', '_statisticsText', '_pickStatisticsText', '_editorError', 'showPickStatistics', 'showStatistics',
'tilesetVisible', 'displayVisible', 'updateVisible', 'loggingVisible', 'styleVisible', 'tileDebugLabelsVisible', 'styleString', '_feature']);
this._properties = knockout.observable({});
@@ -327,7 +327,7 @@ define([
var picked = scene.pick(e.endPosition);
if (picked instanceof Cesium3DTileFeature) {
that.feature = picked;
- that._pickStatsText = getStats(that._tileset, true);
+ that._pickStatisticsText = getStatistics(that._tileset, true);
} else {
that.feature = undefined;
}
@@ -698,25 +698,25 @@ define([
},
/**
- * Gets the stats text. This property is observable.
+ * Gets the statistics text. This property is observable.
* @memberof Cesium3DTilesInspectorViewModel.prototype
* @type {String}
* @readonly
*/
- statsText : {
+ statisticsText : {
get : function() {
- return this._statsText;
+ return this._statisticsText;
}
},
/**
- * Gets the pick stats text. This property is observable.
+ * Gets the pick statistics text. This property is observable.
* @memberof Cesium3DTilesInspectorViewModel.prototype
* @type {String}
* @readonly
*/
- pickStatsText : {
+ pickStatisticsText : {
get : function() {
- return this._pickStatsText;
+ return this._pickStatisticsText;
}
},
@@ -745,7 +745,7 @@ define([
},
/**
- * Gets or sets the tileset of the view model
+ * Gets or sets the tileset of the view model.
* @memberof Cesium3DTilesInspectorViewModel.prototype
* @type {Cesium3DTileset}
*/
@@ -794,13 +794,13 @@ define([
this._properties({});
}
- this._statsText = getStats(tileset, false);
- this._pickStatsText = getStats(tileset, true);
+ this._statisticsText = getStatistics(tileset, false);
+ this._pickStatisticsText = getStatistics(tileset, true);
}
},
/**
- * Gets the current feature of the view model
+ * Gets the current feature of the view model.
* @memberof Cesium3DTilesInspectorViewModel.prototype
* @type {Cesium3DTileFeature}
*/
@@ -898,7 +898,7 @@ define([
};
/**
- * Compiles the style in the style editor
+ * Compiles the style in the style editor.
*/
Cesium3DTilesInspectorViewModel.prototype.compileStyle = function() {
var tileset = this._tileset;
@@ -921,7 +921,7 @@ define([
};
/**
- * Handles key press events on the style editor
+ * Handles key press events on the style editor.
*/
Cesium3DTilesInspectorViewModel.prototype.styleEditorKeyPress = function(sender, event) {
if (event.keyCode === 9) { //tab
@@ -985,8 +985,8 @@ define([
}
}
}
- if (this.showStats) {
- this._statsText = getStats(tileset, false);
+ if (this.showStatistics) {
+ this._statisticsText = getStatistics(tileset, false);
}
};
@@ -1019,7 +1019,7 @@ define([
* @param {Boolean} isPick Whether this is getting the statistics for the pick pass
* @returns {String} The formatted statistics
*/
- Cesium3DTilesInspectorViewModel.getStats = getStats;
+ Cesium3DTilesInspectorViewModel.getStatistics = getStatistics;
return Cesium3DTilesInspectorViewModel;
});
diff --git a/Source/Widgets/CesiumInspector/CesiumInspector.css b/Source/Widgets/CesiumInspector/CesiumInspector.css
index b62d4a28e692..89b8b66ee65e 100644
--- a/Source/Widgets/CesiumInspector/CesiumInspector.css
+++ b/Source/Widgets/CesiumInspector/CesiumInspector.css
@@ -55,7 +55,7 @@
width: 185px;
}
-.cesium-cesiumInspector-frustumStats {
+.cesium-cesiumInspector-frustumStatistics {
padding-left: 10px;
padding: 5px;
background-color: rgba(80, 80, 80, 0.75);
diff --git a/Source/Widgets/CesiumInspector/CesiumInspector.js b/Source/Widgets/CesiumInspector/CesiumInspector.js
index b04ddae222f9..d9dd5d9d360d 100644
--- a/Source/Widgets/CesiumInspector/CesiumInspector.js
+++ b/Source/Widgets/CesiumInspector/CesiumInspector.js
@@ -80,15 +80,15 @@ define([
var debugShowFrustums = document.createElement('div');
generalSection.appendChild(debugShowFrustums);
- var frustumStats = document.createElement('div');
- frustumStats.className = 'cesium-cesiumInspector-frustumStats';
- frustumStats.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : frustums, "cesium-cesiumInspector-hide" : !frustums}, html: frustumStatisticText');
+ var frustumStatistics = document.createElement('div');
+ frustumStatistics.className = 'cesium-cesiumInspector-frustumStatistics';
+ frustumStatistics.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : frustums, "cesium-cesiumInspector-hide" : !frustums}, html: frustumStatisticText');
var frustumsCheckbox = document.createElement('input');
frustumsCheckbox.type = 'checkbox';
frustumsCheckbox.setAttribute('data-bind', 'checked: frustums');
debugShowFrustums.appendChild(frustumsCheckbox);
debugShowFrustums.appendChild(document.createTextNode('Show Frustums'));
- debugShowFrustums.appendChild(frustumStats);
+ debugShowFrustums.appendChild(frustumStatistics);
var debugShowFrustumPlanes = document.createElement('div');
generalSection.appendChild(debugShowFrustumPlanes);
@@ -268,7 +268,7 @@ define([
var tileText = document.createElement('div');
tileText.className = 'cesium-cesiumInspector-tileText';
- tileInfo.className = 'cesium-cesiumInspector-frustumStats';
+ tileInfo.className = 'cesium-cesiumInspector-frustumStatistics';
tileInfo.appendChild(tileText);
tileInfo.setAttribute('data-bind', 'css: {"cesium-cesiumInspector-show" : hasPickedTile, "cesium-cesiumInspector-hide" : !hasPickedTile}');
tileText.setAttribute('data-bind', 'html: tileText');
diff --git a/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js b/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js
index cf1c0b650e6f..7082697ef435 100644
--- a/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js
+++ b/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js
@@ -27,11 +27,11 @@ define([
createCommand) {
'use strict';
- function frustumStatsToString(stats) {
+ function frustumStatisticsToString(statistics) {
var str;
- if (defined(stats)) {
+ if (defined(statistics)) {
str = 'Command Statistics';
- var com = stats.commandsInFrustums;
+ var com = statistics.commandsInFrustums;
for (var n in com) {
if (com.hasOwnProperty(n)) {
var num = parseInt(n, 10);
@@ -52,7 +52,7 @@ define([
str += '
' + com[n] + ' in frustum ' + s;
}
}
- str += '
Total: ' + stats.totalCommands;
+ str += '
Total: ' + statistics.totalCommands;
}
return str;
@@ -921,7 +921,7 @@ define([
*/
CesiumInspectorViewModel.prototype._update = function() {
if (this.frustums) {
- this.frustumStatisticText = frustumStatsToString(this._scene.debugFrustumStatistics);
+ this.frustumStatisticText = frustumStatisticsToString(this._scene.debugFrustumStatistics);
}
// Determine the number of frustums being used.
diff --git a/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js b/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js
index c8f47707b272..069189bc5f3b 100644
--- a/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js
+++ b/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js
@@ -10,15 +10,13 @@ define([
'use strict';
/**
- * A mixin which adds the Cesium3DTilesInspector widget to the Viewer widget.
+ * A mixin which adds the {@link Cesium3DTilesInspector} widget to the {@link Viewer} widget.
* Rather than being called directly, this function is normally passed as
* a parameter to {@link Viewer#extend}, as shown in the example below.
* @exports viewerCesium3DTilesInspectorMixin
*
* @param {Viewer} viewer The viewer instance.
*
- * @exception {DeveloperError} viewer is required.
- *
* @example
* var viewer = new Cesium.Viewer('cesiumContainer');
* viewer.extend(Cesium.viewerCesium3DTilesInspectorMixin);
diff --git a/Specs/Cesium3DTilesTester.js b/Specs/Cesium3DTilesTester.js
index 245cba12ec9b..7df050000976 100644
--- a/Specs/Cesium3DTilesTester.js
+++ b/Specs/Cesium3DTilesTester.js
@@ -142,7 +142,7 @@ define([
var counter = 0;
Cesium3DTilesTester.rejectsReadyPromiseOnError = function(scene, arrayBuffer, type) {
var tileset = {
- baseUrl : counter++
+ basePath : counter++
};
var url = '';
var content = Cesium3DTileContentFactory[type](tileset, mockTile, url, arrayBuffer, 0);
diff --git a/Specs/Scene/Batched3DModel3DTileContentSpec.js b/Specs/Scene/Batched3DModel3DTileContentSpec.js
index 37afecc54bef..54122006f0c1 100644
--- a/Specs/Scene/Batched3DModel3DTileContentSpec.js
+++ b/Specs/Scene/Batched3DModel3DTileContentSpec.js
@@ -260,32 +260,32 @@ defineSuite([
// 10 buildings, 32 ushort indices and 24 vertices per building, 8 float components (position, normal, uv) and 1 ushort component (batchId) per vertex.
// 10 * ((24 * (8 * 4 + 1 * 2)) + (36 * 2)) = 8880
- var vertexMemorySizeInBytes = 8880;
+ var geometryByteLength = 8880;
// Texture is 128x128 RGBA bytes, not mipmapped
- var textureMemorySizeInBytes = 65536;
+ var texturesByteLength = 65536;
// One RGBA byte pixel per feature
- var batchTextureMemorySizeInBytes = content.featuresLength * 4;
- var pickTextureMemorySizeInBytes = content.featuresLength * 4;
+ var batchTexturesByteLength = content.featuresLength * 4;
+ var pickTexturesByteLength = content.featuresLength * 4;
// Features have not been picked or colored yet, so the batch table contribution is 0.
- expect(content.vertexMemorySizeInBytes).toEqual(vertexMemorySizeInBytes);
- expect(content.textureMemorySizeInBytes).toEqual(textureMemorySizeInBytes);
- expect(content.batchTableMemorySizeInBytes).toEqual(0);
+ expect(content.geometryByteLength).toEqual(geometryByteLength);
+ expect(content.texturesByteLength).toEqual(texturesByteLength);
+ expect(content.batchTableByteLength).toEqual(0);
// Color a feature and expect the texture memory to increase
content.getFeature(0).color = Color.RED;
scene.renderForSpecs();
- expect(content.vertexMemorySizeInBytes).toEqual(vertexMemorySizeInBytes);
- expect(content.textureMemorySizeInBytes).toEqual(textureMemorySizeInBytes);
- expect(content.batchTableMemorySizeInBytes).toEqual(batchTextureMemorySizeInBytes);
+ expect(content.geometryByteLength).toEqual(geometryByteLength);
+ expect(content.texturesByteLength).toEqual(texturesByteLength);
+ expect(content.batchTableByteLength).toEqual(batchTexturesByteLength);
// Pick the tile and expect the texture memory to increase
scene.pickForSpecs();
- expect(content.vertexMemorySizeInBytes).toEqual(vertexMemorySizeInBytes);
- expect(content.textureMemorySizeInBytes).toEqual(textureMemorySizeInBytes);
- expect(content.batchTableMemorySizeInBytes).toEqual(batchTextureMemorySizeInBytes + pickTextureMemorySizeInBytes);
+ expect(content.geometryByteLength).toEqual(geometryByteLength);
+ expect(content.texturesByteLength).toEqual(texturesByteLength);
+ expect(content.batchTableByteLength).toEqual(batchTexturesByteLength + pickTexturesByteLength);
});
});
diff --git a/Specs/Scene/Cesium3DTileBatchTableSpec.js b/Specs/Scene/Cesium3DTileBatchTableSpec.js
index 9ec0ee175683..56505a200213 100644
--- a/Specs/Scene/Cesium3DTileBatchTableSpec.js
+++ b/Specs/Scene/Cesium3DTileBatchTableSpec.js
@@ -47,7 +47,7 @@ defineSuite([
var mockTileset = {
_statistics : {
- textureMemorySizeInBytes : 0
+ texturesByteLength : 0
}
};
diff --git a/Specs/Scene/Cesium3DTileContentSpec.js b/Specs/Scene/Cesium3DTileContentSpec.js
index b388fea63fca..28b8d03e909f 100644
--- a/Specs/Scene/Cesium3DTileContentSpec.js
+++ b/Specs/Scene/Cesium3DTileContentSpec.js
@@ -17,13 +17,13 @@ defineSuite([
return content.trianglesLength;
}).toThrowDeveloperError();
expect(function() {
- return content.vertexMemorySizeInBytes;
+ return content.geometryByteLength;
}).toThrowDeveloperError();
expect(function() {
- return content.textureMemorySizeInBytes;
+ return content.texturesByteLength;
}).toThrowDeveloperError();
expect(function() {
- return content.batchTableMemorySizeInBytes;
+ return content.batchTableByteLength;
}).toThrowDeveloperError();
expect(function() {
return content.innerContents;
diff --git a/Specs/Scene/Cesium3DTilesetSpec.js b/Specs/Scene/Cesium3DTilesetSpec.js
index 73baf9b57e1d..0f5ad1724abc 100644
--- a/Specs/Scene/Cesium3DTilesetSpec.js
+++ b/Specs/Scene/Cesium3DTilesetSpec.js
@@ -388,9 +388,9 @@ defineSuite([
it('renders tileset', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
});
});
@@ -398,9 +398,9 @@ defineSuite([
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
scene.morphToColumbusView(0.0);
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
});
});
@@ -409,17 +409,17 @@ defineSuite([
scene.morphTo2D(0.0);
tileset.maximumScreenSpaceError = 3;
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(10);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(10);
});
});
it('renders tileset with empty root tile', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetEmptyRootUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(4); // Empty tile doesn't issue a command
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(4); // Empty tile doesn't issue a command
});
});
@@ -429,62 +429,62 @@ defineSuite([
}));
// Verify initial values
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(0);
- expect(stats.numberOfCommands).toEqual(0);
- expect(stats.numberOfPendingRequests).toEqual(0);
- expect(stats.numberProcessing).toEqual(0);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(0);
+ expect(statistics.numberOfCommands).toEqual(0);
+ expect(statistics.numberOfPendingRequests).toEqual(0);
+ expect(statistics.numberProcessing).toEqual(0);
return Cesium3DTilesTester.waitForReady(scene, tileset).then(function() {
// Check that root and children are requested
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(0);
- expect(stats.numberOfPendingRequests).toEqual(5);
- expect(stats.numberProcessing).toEqual(0);
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(0);
+ expect(statistics.numberOfPendingRequests).toEqual(5);
+ expect(statistics.numberProcessing).toEqual(0);
// Wait for all tiles to load and check that they are all visited and rendered
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberOfPendingRequests).toEqual(0);
- expect(stats.numberProcessing).toEqual(0);
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberOfPendingRequests).toEqual(0);
+ expect(statistics.numberProcessing).toEqual(0);
});
});
});
function checkPointAndFeatureCounts(tileset, features, points, triangles) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
- expect(stats.numberOfFeaturesSelected).toEqual(0);
- expect(stats.numberOfFeaturesLoaded).toEqual(0);
- expect(stats.numberOfPointsSelected).toEqual(0);
- expect(stats.numberOfPointsLoaded).toEqual(0);
- expect(stats.numberOfTrianglesSelected).toEqual(0);
+ expect(statistics.numberOfFeaturesSelected).toEqual(0);
+ expect(statistics.numberOfFeaturesLoaded).toEqual(0);
+ expect(statistics.numberOfPointsSelected).toEqual(0);
+ expect(statistics.numberOfPointsLoaded).toEqual(0);
+ expect(statistics.numberOfTrianglesSelected).toEqual(0);
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfFeaturesSelected).toEqual(features);
- expect(stats.numberOfFeaturesLoaded).toEqual(features);
- expect(stats.numberOfPointsSelected).toEqual(points);
- expect(stats.numberOfPointsLoaded).toEqual(points);
- expect(stats.numberOfTrianglesSelected).toEqual(triangles);
+ expect(statistics.numberOfFeaturesSelected).toEqual(features);
+ expect(statistics.numberOfFeaturesLoaded).toEqual(features);
+ expect(statistics.numberOfPointsSelected).toEqual(points);
+ expect(statistics.numberOfPointsLoaded).toEqual(points);
+ expect(statistics.numberOfTrianglesSelected).toEqual(triangles);
viewNothing();
scene.renderForSpecs();
- expect(stats.numberOfFeaturesSelected).toEqual(0);
- expect(stats.numberOfFeaturesLoaded).toEqual(features);
- expect(stats.numberOfPointsSelected).toEqual(0);
- expect(stats.numberOfPointsLoaded).toEqual(points);
- expect(stats.numberOfTrianglesSelected).toEqual(0);
+ expect(statistics.numberOfFeaturesSelected).toEqual(0);
+ expect(statistics.numberOfFeaturesLoaded).toEqual(features);
+ expect(statistics.numberOfPointsSelected).toEqual(0);
+ expect(statistics.numberOfPointsLoaded).toEqual(points);
+ expect(statistics.numberOfTrianglesSelected).toEqual(0);
tileset.trimLoadedTiles();
scene.renderForSpecs();
- expect(stats.numberOfFeaturesSelected).toEqual(0);
- expect(stats.numberOfFeaturesLoaded).toEqual(0);
- expect(stats.numberOfPointsSelected).toEqual(0);
- expect(stats.numberOfPointsLoaded).toEqual(0);
- expect(stats.numberOfTrianglesSelected).toEqual(0);
+ expect(statistics.numberOfFeaturesSelected).toEqual(0);
+ expect(statistics.numberOfFeaturesLoaded).toEqual(0);
+ expect(statistics.numberOfPointsSelected).toEqual(0);
+ expect(statistics.numberOfPointsLoaded).toEqual(0);
+ expect(statistics.numberOfTrianglesSelected).toEqual(0);
});
}
@@ -558,7 +558,7 @@ defineSuite([
it('verify memory usage statistics', function() {
// Calculations in Batched3DModel3DTilesContentSpec
- var singleTileVertexMemory = 8880;
+ var singleTileGeometryMemory = 8880;
var singleTileTextureMemory = 0;
var singleTileBatchTextureMemory = 40;
var singleTilePickTextureMemory = 40;
@@ -566,53 +566,53 @@ defineSuite([
viewNothing();
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
// No tiles loaded
- expect(stats.vertexMemorySizeInBytes).toEqual(0);
- expect(stats.textureMemorySizeInBytes).toEqual(0);
- expect(stats.batchTableMemorySizeInBytes).toEqual(0);
+ expect(statistics.geometryByteLength).toEqual(0);
+ expect(statistics.texturesByteLength).toEqual(0);
+ expect(statistics.batchTableByteLength).toEqual(0);
viewRootOnly();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
// Root tile loaded
- expect(stats.vertexMemorySizeInBytes).toEqual(singleTileVertexMemory);
- expect(stats.textureMemorySizeInBytes).toEqual(singleTileTextureMemory);
- expect(stats.batchTableMemorySizeInBytes).toEqual(0);
+ expect(statistics.geometryByteLength).toEqual(singleTileGeometryMemory);
+ expect(statistics.texturesByteLength).toEqual(singleTileTextureMemory);
+ expect(statistics.batchTableByteLength).toEqual(0);
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
// All tiles loaded
- expect(stats.vertexMemorySizeInBytes).toEqual(singleTileVertexMemory * tilesLength);
- expect(stats.textureMemorySizeInBytes).toEqual(singleTileTextureMemory * tilesLength);
- expect(stats.batchTableMemorySizeInBytes).toEqual(0);
+ expect(statistics.geometryByteLength).toEqual(singleTileGeometryMemory * tilesLength);
+ expect(statistics.texturesByteLength).toEqual(singleTileTextureMemory * tilesLength);
+ expect(statistics.batchTableByteLength).toEqual(0);
// One feature colored, the batch table memory is now higher
tileset._root.content.getFeature(0).color = Color.RED;
scene.renderForSpecs();
- expect(stats.vertexMemorySizeInBytes).toEqual(singleTileVertexMemory * tilesLength);
- expect(stats.textureMemorySizeInBytes).toEqual(singleTileTextureMemory * tilesLength);
- expect(stats.batchTableMemorySizeInBytes).toEqual(singleTileBatchTextureMemory);
+ expect(statistics.geometryByteLength).toEqual(singleTileGeometryMemory * tilesLength);
+ expect(statistics.texturesByteLength).toEqual(singleTileTextureMemory * tilesLength);
+ expect(statistics.batchTableByteLength).toEqual(singleTileBatchTextureMemory);
// All tiles picked, the texture memory is now higher
scene.pickForSpecs();
- expect(stats.vertexMemorySizeInBytes).toEqual(singleTileVertexMemory * tilesLength);
- expect(stats.textureMemorySizeInBytes).toEqual(singleTileTextureMemory * tilesLength);
- expect(stats.batchTableMemorySizeInBytes).toEqual(singleTileBatchTextureMemory + singleTilePickTextureMemory * tilesLength);
+ expect(statistics.geometryByteLength).toEqual(singleTileGeometryMemory * tilesLength);
+ expect(statistics.texturesByteLength).toEqual(singleTileTextureMemory * tilesLength);
+ expect(statistics.batchTableByteLength).toEqual(singleTileBatchTextureMemory + singleTilePickTextureMemory * tilesLength);
// Tiles are still in memory when zoomed out
viewNothing();
scene.renderForSpecs();
- expect(stats.vertexMemorySizeInBytes).toEqual(singleTileVertexMemory * tilesLength);
- expect(stats.textureMemorySizeInBytes).toEqual(singleTileTextureMemory * tilesLength);
- expect(stats.batchTableMemorySizeInBytes).toEqual(singleTileBatchTextureMemory + singleTilePickTextureMemory * tilesLength);
+ expect(statistics.geometryByteLength).toEqual(singleTileGeometryMemory * tilesLength);
+ expect(statistics.texturesByteLength).toEqual(singleTileTextureMemory * tilesLength);
+ expect(statistics.batchTableByteLength).toEqual(singleTileBatchTextureMemory + singleTilePickTextureMemory * tilesLength);
// Trim loaded tiles, expect the memory statistics to be 0
tileset.trimLoadedTiles();
scene.renderForSpecs();
- expect(stats.vertexMemorySizeInBytes).toEqual(0);
- expect(stats.textureMemorySizeInBytes).toEqual(0);
- expect(stats.batchTableMemorySizeInBytes).toEqual(0);
+ expect(statistics.geometryByteLength).toEqual(0);
+ expect(statistics.texturesByteLength).toEqual(0);
+ expect(statistics.batchTableByteLength).toEqual(0);
});
});
});
@@ -627,47 +627,47 @@ defineSuite([
// All tiles reference the same external texture but texture caching is not supported yet
// TODO : tweak test when #5051 is in
- var b3dmVertexMemory = 840; // Only one box in the tile, unlike most other test tiles
- var i3dmVertexMemory = 840;
+ var b3dmGeometryMemory = 840; // Only one box in the tile, unlike most other test tiles
+ var i3dmGeometryMemory = 840;
// Texture is 211x211 RGBA bytes, but upsampled to 256x256 because the wrap mode is REPEAT
- var textureMemorySizeInBytes = 262144;
+ var texturesByteLength = 262144;
- var expectedVertexMemory = b3dmVertexMemory * 2 + i3dmVertexMemory * 3;
- var expectedTextureMemory = textureMemorySizeInBytes * 5;
+ var expectedGeometryMemory = b3dmGeometryMemory * 2 + i3dmGeometryMemory * 3;
+ var expectedTextureMemory = texturesByteLength * 5;
return Cesium3DTilesTester.loadTileset(scene, tilesetWithExternalResourcesUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.vertexMemorySizeInBytes).toBe(expectedVertexMemory);
- expect(stats.textureMemorySizeInBytes).toBe(expectedTextureMemory);
+ var statistics = tileset._statistics;
+ expect(statistics.geometryByteLength).toBe(expectedGeometryMemory);
+ expect(statistics.texturesByteLength).toBe(expectedTextureMemory);
});
});
it('does not process tileset when screen space error is not met', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
// Set zoom far enough away to not meet sse
viewNothing();
scene.renderForSpecs();
- expect(stats.visited).toEqual(0);
- expect(stats.numberOfCommands).toEqual(0);
+ expect(statistics.visited).toEqual(0);
+ expect(statistics.numberOfCommands).toEqual(0);
});
});
it('does not select tiles when outside of view frustum', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
viewSky();
scene.renderForSpecs();
- expect(stats.visited).toEqual(0);
- expect(stats.numberOfCommands).toEqual(0);
+ expect(statistics.visited).toEqual(0);
+ expect(statistics.numberOfCommands).toEqual(0);
expect(tileset._root.visibility(scene.frameState, CullingVolume.MASK_INDETERMINATE)).toEqual(CullingVolume.MASK_OUTSIDE);
});
});
@@ -676,21 +676,21 @@ defineSuite([
// Root tile has a content box that is half the extents of its box
// Expect to cull root tile and three child tiles
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
viewBottomLeft();
scene.renderForSpecs();
- expect(stats.visited).toEqual(2); // Visits root, but does not render it
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.visited).toEqual(2); // Visits root, but does not render it
+ expect(statistics.numberOfCommands).toEqual(1);
expect(tileset._selectedTiles[0]).not.toBe(tileset._root);
// Set contents box to undefined, and now root won't be culled
tileset._root._contentBoundingVolume = undefined;
scene.renderForSpecs();
- expect(stats.visited).toEqual(2);
- expect(stats.numberOfCommands).toEqual(2);
+ expect(statistics.visited).toEqual(2);
+ expect(statistics.numberOfCommands).toEqual(2);
});
});
@@ -733,7 +733,7 @@ defineSuite([
function testDynamicScreenSpaceError(url, distance) {
return Cesium3DTilesTester.loadTileset(scene, url).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
// Horizon view, only root is visible
var center = Cartesian3.fromRadians(centerLongitude, centerLatitude);
@@ -742,16 +742,16 @@ defineSuite([
// Set dynamic SSE to false (default)
tileset.dynamicScreenSpaceError = false;
scene.renderForSpecs();
- expect(stats.visited).toEqual(1);
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.visited).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
// Set dynamic SSE to true, now the root is not rendered
tileset.dynamicScreenSpaceError = true;
tileset.dynamicScreenSpaceErrorDensity = 1.0;
tileset.dynamicScreenSpaceErrorFactor = 10.0;
scene.renderForSpecs();
- expect(stats.visited).toEqual(0);
- expect(stats.numberOfCommands).toEqual(0);
+ expect(statistics.visited).toEqual(0);
+ expect(statistics.numberOfCommands).toEqual(0);
});
}
@@ -790,50 +790,50 @@ defineSuite([
viewRootOnly();
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
// Meets screen space error, only root tile is rendered
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(1);
- expect(stats.numberOfCommands).toEqual(1);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
});
});
it('additive refinement - selects all tiles when sse is not met', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
// Does not meet screen space error, all tiles are visible
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
});
});
it('additive refinement - use parent\'s geometric error on child\'s box for early refinement', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5);
- expect(stats.numberOfCommands).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
// Both right tiles don't meet the SSE anymore
scene.camera.moveLeft(50.0);
scene.renderForSpecs();
- expect(stats.visited).toEqual(3);
- expect(stats.numberOfCommands).toEqual(3);
+ expect(statistics.visited).toEqual(3);
+ expect(statistics.numberOfCommands).toEqual(3);
});
});
it('additive refinement - selects tile when inside viewer request volume', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetWithViewerRequestVolumeUrl).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
// Force root tile to always not meet SSE since this is just checking the request volume
tileset.maximumScreenSpaceError = 0.0;
// Renders all 5 tiles
setZoom(20.0);
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
// No longer renders the tile with a request volume
setZoom(1500.0);
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(4);
+ expect(statistics.numberOfCommands).toEqual(4);
});
});
@@ -845,9 +845,9 @@ defineSuite([
// Meets screen space error, only root tile is rendered
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(1);
- expect(stats.numberOfCommands).toEqual(1);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
});
});
@@ -858,9 +858,9 @@ defineSuite([
// Does not meet screen space error, child tiles replace root tile
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(5); // Visits root, but does not render it
- expect(stats.numberOfCommands).toEqual(4);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(5); // Visits root, but does not render it
+ expect(statistics.numberOfCommands).toEqual(4);
});
});
@@ -876,19 +876,19 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
// LOD skipping visits all visible
- expect(stats.visited).toEqual(5);
+ expect(statistics.visited).toEqual(5);
// no stencil clear command because only the root tile
- expect(stats.numberOfCommands).toEqual(1);
- expect(stats.numberOfPendingRequests).toEqual(4);
+ expect(statistics.numberOfCommands).toEqual(1);
+ expect(statistics.numberOfPendingRequests).toEqual(4);
expect(numberOfChildrenWithoutContent(root)).toEqual(4);
});
});
it('replacement refinement - selects tile when inside viewer request volume', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetWithViewerRequestVolumeUrl).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var root = tileset._root;
root.refine = Cesium3DTileRefine.REPLACE;
@@ -898,14 +898,14 @@ defineSuite([
// Renders all 5 tiles
setZoom(20.0);
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
expect(root.selected).toBe(false);
// No longer renders the tile with a request volume
setZoom(1500.0);
root.hasRenderableContent = true; // mock content
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(4);
+ expect(statistics.numberOfCommands).toEqual(4);
expect(root.selected).toBe(true); // one child is no longer selected. root is chosen instead
});
});
@@ -923,17 +923,17 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var root = tileset._root;
return when.join(root.children[0].contentReadyPromise, root.children[1].contentReadyPromise).then(function() {
// Even though root's children are loaded, the grandchildren need to be loaded before it becomes refinable
expect(numberOfChildrenWithoutContent(root)).toEqual(0); // Children are loaded
- expect(stats.numberOfCommands).toEqual(1); // No stencil or backface commands; no mixed content
- expect(stats.numberOfPendingRequests).toEqual(4); // Loading grandchildren
+ expect(statistics.numberOfCommands).toEqual(1); // No stencil or backface commands; no mixed content
+ expect(statistics.numberOfPendingRequests).toEqual(4); // Loading grandchildren
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(4); // Render children
+ expect(statistics.numberOfCommands).toEqual(4); // Render children
});
});
});
@@ -950,15 +950,15 @@ defineSuite([
viewRootOnly();
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement2Url).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
setZoom(5.0); // Zoom into the last tile, when it is ready the root is refinable
scene.renderForSpecs();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(2); // Renders two content tiles
+ expect(statistics.numberOfCommands).toEqual(2); // Renders two content tiles
});
});
});
@@ -975,21 +975,21 @@ defineSuite([
viewRootOnly();
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var root = tileset._root;
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
viewAllTiles();
scene.renderForSpecs();
return root.children[0].contentReadyPromise.then(function() {
// The external tileset json is loaded, but the external tileset isn't.
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1); // root
- expect(stats.numberOfPendingRequests).toEqual(4); // Loading child content tiles
+ expect(statistics.numberOfCommands).toEqual(1); // root
+ expect(statistics.numberOfPendingRequests).toEqual(4); // Loading child content tiles
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
expect(root.selected).toEqual(false);
- expect(stats.numberOfCommands).toEqual(4); // Render child content tiles
+ expect(statistics.numberOfCommands).toEqual(4); // Render child content tiles
});
});
});
@@ -1001,9 +1001,9 @@ defineSuite([
// R A R A
//
return Cesium3DTilesTester.loadTileset(scene, tilesetRefinementMix).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(7);
- expect(stats.numberOfCommands).toEqual(6);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(7);
+ expect(statistics.numberOfCommands).toEqual(6);
});
});
@@ -1121,9 +1121,9 @@ defineSuite([
// R A R A
//
return Cesium3DTilesTester.loadTileset(scene, tilesetRefinementMix).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(7);
- expect(stats.numberOfCommands).toEqual(6);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(7);
+ expect(statistics.numberOfCommands).toEqual(6);
});
});
@@ -1188,9 +1188,9 @@ defineSuite([
it('renders tileset with external tileset.json', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(7); // Visits two tiles with tileset content, five tiles with b3dm content
- expect(stats.numberOfCommands).toEqual(5); // Render the five tiles with b3dm content
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(7); // Visits two tiles with tileset content, five tiles with b3dm content
+ expect(statistics.numberOfCommands).toEqual(5); // Render the five tiles with b3dm content
});
});
@@ -1198,15 +1198,15 @@ defineSuite([
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
viewRootOnly();
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(1);
- expect(stats.numberOfCommands).toEqual(1);
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
tileset.debugFreezeFrame = true;
viewAllTiles();
scene.renderForSpecs();
- expect(stats.visited).toEqual(0); // selectTiles returns early, so no tiles are visited
- expect(stats.numberOfCommands).toEqual(1); // root tile is still in selectedTiles list
+ expect(statistics.visited).toEqual(0); // selectTiles returns early, so no tiles are visited
+ expect(statistics.numberOfCommands).toEqual(1); // root tile is still in selectedTiles list
});
});
@@ -1285,13 +1285,13 @@ defineSuite([
viewRootOnly();
tileset.debugShowBoundingVolume = true;
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(1);
- expect(stats.numberOfCommands).toEqual(2); // Tile command + bounding volume command
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(2); // Tile command + bounding volume command
tileset.debugShowBoundingVolume = false;
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
});
});
@@ -1300,13 +1300,13 @@ defineSuite([
viewRootOnly();
tileset.debugShowContentBoundingVolume = true;
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(1);
- expect(stats.numberOfCommands).toEqual(2); // Tile command + bounding volume command
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(2); // Tile command + bounding volume command
tileset.debugShowContentBoundingVolume = false;
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
});
});
@@ -1314,13 +1314,13 @@ defineSuite([
return Cesium3DTilesTester.loadTileset(scene, tilesetWithViewerRequestVolumeUrl).then(function(tileset) {
tileset.debugShowViewerRequestVolume = true;
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.visited).toEqual(6); // 1 empty root tile + 4 b3dm tiles + 1 pnts tile
- expect(stats.numberOfCommands).toEqual(6); // 5 tile commands + viewer request volume command
+ var statistics = tileset._statistics;
+ expect(statistics.visited).toEqual(6); // 1 empty root tile + 4 b3dm tiles + 1 pnts tile
+ expect(statistics.numberOfCommands).toEqual(6); // 5 tile commands + viewer request volume command
tileset.debugShowViewerRequestVolume = false;
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
});
});
@@ -1415,7 +1415,7 @@ defineSuite([
expect(tileset._tileDebugLabels.length).toEqual(1);
var expected = 'Texture Memory: 0\n' +
- 'Vertex Memory: 0.008';
+ 'Geometry Memory: 0.008';
expect(tileset._tileDebugLabels._labels[0].text).toEqual(expected);
@@ -1425,7 +1425,7 @@ defineSuite([
});
});
- it('show tile debug labels with all stats', function() {
+ it('show tile debug labels with all statistics', function() {
// tilesetUrl has bounding regions
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
tileset.debugShowGeometricError = true;
@@ -1440,7 +1440,7 @@ defineSuite([
'Triangles: 120\n' +
'Features: 10\n' +
'Texture Memory: 0\n' +
- 'Vertex Memory: 0.008';
+ 'Geometry Memory: 0.008';
expect(tileset._tileDebugLabels._labels[0].text).toEqual(expected);
tileset.debugShowGeometricError = false;
@@ -1471,7 +1471,7 @@ defineSuite([
'Triangles: 120\n' +
'Features: 10\n' +
'Texture Memory: 0\n' +
- 'Vertex Memory: 0.008';
+ 'Geometry Memory: 0.008';
expect(tileset._tileDebugLabels.get(0).text).toEqual(expected);
expect(tileset._tileDebugLabels.get(0).position).toEqual(scratchPosition);
@@ -1513,9 +1513,9 @@ defineSuite([
viewRootOnly(); // Root tiles are loaded initially
var promises = [
- // skip LODs loads a base level of content first
- Cesium3DTilesTester.loadTileset(scene, tilesetUrl, {skipLODs: false}),
- Cesium3DTilesTester.loadTileset(scene, tilesetUrl, {skipLODs: false})
+ // skipLevelOfDetails loads a base level of content first
+ Cesium3DTilesTester.loadTileset(scene, tilesetUrl, {skipLevelOfDetail: false}),
+ Cesium3DTilesTester.loadTileset(scene, tilesetUrl, {skipLevelOfDetail: false})
];
return when.all(promises, function(tilesets) {
@@ -1630,8 +1630,8 @@ defineSuite([
viewRootOnly();
scene.renderForSpecs(); // Request external tileset.json
- var stats = tileset._statistics;
- expect(stats.numberOfPendingRequests).toEqual(1);
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfPendingRequests).toEqual(1);
scene.primitives.remove(tileset);
return root.contentReadyPromise.then(function(root) {
@@ -2050,9 +2050,9 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5); // Five loaded tiles
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
expect(tileset.totalMemoryUsageInBytes).toEqual(44400); // Specific to this tileset
// Zoom out so only root tile is needed to meet SSE. This unloads
@@ -2060,16 +2060,16 @@ defineSuite([
viewRootOnly();
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
- expect(stats.numberContentReady).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
+ expect(statistics.numberContentReady).toEqual(1);
expect(tileset.totalMemoryUsageInBytes).toEqual(8880); // Specific to this tileset
// Zoom back in so all four children are re-requested.
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
expect(tileset.totalMemoryUsageInBytes).toEqual(44400); // Specific to this tileset
});
});
@@ -2083,9 +2083,9 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5); // Five loaded tiles
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
// Zoom out so only root tile is needed to meet SSE. This unloads
// two of the four children so three tiles are still loaded (the
@@ -2093,15 +2093,15 @@ defineSuite([
viewRootOnly();
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
- expect(stats.numberContentReady).toEqual(3);
+ expect(statistics.numberOfCommands).toEqual(1);
+ expect(statistics.numberContentReady).toEqual(3);
// Zoom back in so the two children are re-requested.
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5); // Five loaded tiles
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
});
});
});
@@ -2111,37 +2111,37 @@ defineSuite([
tileset.maximumMemoryUsage = 0;
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5);
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5);
viewSky();
// All tiles are unloaded
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(0);
- expect(stats.numberContentReady).toEqual(0);
+ expect(statistics.numberOfCommands).toEqual(0);
+ expect(statistics.numberContentReady).toEqual(0);
// Reset camera so all tiles are reloaded
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5);
});
});
});
it('Unloads cached tiles in a tileset with external tileset.json using maximumMemoryUsage', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var replacementList = tileset._replacementList;
tileset.maximumMemoryUsage = 0.025;
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5);
expect(replacementList.length - 1).toEqual(5); // Only tiles with content are on the replacement list. -1 for sentinel.
// Zoom out so only root tile is needed to meet SSE. This unloads
@@ -2149,16 +2149,16 @@ defineSuite([
viewRootOnly();
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
- expect(stats.numberContentReady).toEqual(2);
+ expect(statistics.numberOfCommands).toEqual(1);
+ expect(statistics.numberContentReady).toEqual(2);
expect(replacementList.length - 1).toEqual(2);
// Reset camera so all tiles are reloaded
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5);
expect(replacementList.length - 1).toEqual(5);
});
@@ -2167,27 +2167,27 @@ defineSuite([
it('Unloads cached tiles in a tileset with empty tiles using maximumMemoryUsage', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetEmptyRootUrl).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
tileset.maximumMemoryUsage = 0.025;
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(4);
- expect(stats.numberContentReady).toEqual(4); // 4 children with b3dm content (does not include empty root)
+ expect(statistics.numberOfCommands).toEqual(4);
+ expect(statistics.numberContentReady).toEqual(4); // 4 children with b3dm content (does not include empty root)
viewSky();
// Unload tiles to meet cache size
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(0);
- expect(stats.numberContentReady).toEqual(2); // 2 children with b3dm content (does not include empty root)
+ expect(statistics.numberOfCommands).toEqual(0);
+ expect(statistics.numberContentReady).toEqual(2); // 2 children with b3dm content (does not include empty root)
// Reset camera so all tiles are reloaded
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(4);
- expect(stats.numberContentReady).toEqual(4);
+ expect(statistics.numberOfCommands).toEqual(4);
+ expect(statistics.numberContentReady).toEqual(4);
});
});
});
@@ -2206,24 +2206,24 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.numberOfCommands).toEqual(4); // 4 grandchildren. Root is replaced.
- expect(stats.numberContentReady).toEqual(5); // Root + four grandchildren (does not include empty children)
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfCommands).toEqual(4); // 4 grandchildren. Root is replaced.
+ expect(statistics.numberContentReady).toEqual(5); // Root + four grandchildren (does not include empty children)
// Zoom out so only root tile is needed to meet SSE. This unloads
// all grandchildren since the max number of loaded tiles is one.
viewRootOnly();
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
- expect(stats.numberContentReady).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
+ expect(statistics.numberContentReady).toEqual(1);
// Zoom back in so the four children are re-requested.
viewAllTiles();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function() {
- expect(stats.numberOfCommands).toEqual(4);
- expect(stats.numberContentReady).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(4);
+ expect(statistics.numberContentReady).toEqual(5);
});
});
});
@@ -2236,23 +2236,23 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5); // Five loaded tiles
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
// Zoom out so only root tile is needed to meet SSE. The children
// are not unloaded since max number of loaded tiles is five.
viewRootOnly();
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
- expect(stats.numberContentReady).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(1);
+ expect(statistics.numberContentReady).toEqual(5);
tileset.trimLoadedTiles();
scene.renderForSpecs();
- expect(stats.numberOfCommands).toEqual(1);
- expect(stats.numberContentReady).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
+ expect(statistics.numberContentReady).toEqual(1);
});
});
@@ -2264,9 +2264,9 @@ defineSuite([
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.numberOfCommands).toEqual(5);
- expect(stats.numberContentReady).toEqual(5); // Five loaded tiles
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfCommands).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5); // Five loaded tiles
// Zoom out so only root tile is needed to meet SSE. All the
// children are unloaded since max number of loaded tiles is one.
@@ -2307,7 +2307,7 @@ defineSuite([
var i3dmCommands = scene.context.instancedArrays ? 1 : 25; // When instancing is not supported there is one command per instance
var totalCommands = b3dmCommands + i3dmCommands;
return Cesium3DTilesTester.loadTileset(scene, tilesetWithTransformsUrl).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var root = tileset._root;
var rootTransform = Matrix4.unpack(root._header.transform);
@@ -2315,7 +2315,7 @@ defineSuite([
var childTransform = Matrix4.unpack(child._header.transform);
var computedTransform = Matrix4.multiply(rootTransform, childTransform, new Matrix4());
- expect(stats.numberOfCommands).toBe(totalCommands);
+ expect(statistics.numberOfCommands).toBe(totalCommands);
expect(root.computedTransform).toEqual(rootTransform);
expect(child.computedTransform).toEqual(computedTransform);
@@ -2329,20 +2329,20 @@ defineSuite([
// Set the modelMatrix somewhere off screen
tileset.modelMatrix = Matrix4.fromTranslation(new Cartesian3(0.0, 100000.0, 0.0));
scene.renderForSpecs();
- expect(stats.numberOfCommands).toBe(0);
+ expect(statistics.numberOfCommands).toBe(0);
// Now bring it back
tileset.modelMatrix = Matrix4.IDENTITY;
scene.renderForSpecs();
- expect(stats.numberOfCommands).toBe(totalCommands);
+ expect(statistics.numberOfCommands).toBe(totalCommands);
// Do the same steps for a tile transform
child.transform = Matrix4.fromTranslation(new Cartesian3(0.0, 100000.0, 0.0));
scene.renderForSpecs();
- expect(stats.numberOfCommands).toBe(1);
+ expect(statistics.numberOfCommands).toBe(1);
child.transform = Matrix4.IDENTITY;
scene.renderForSpecs();
- expect(stats.numberOfCommands).toBe(totalCommands);
+ expect(statistics.numberOfCommands).toBe(totalCommands);
});
});
@@ -2351,13 +2351,13 @@ defineSuite([
return Cesium3DTilesTester.loadTileset(scene, tilesetUrl).then(function(tileset) {
viewAllTiles();
scene.renderForSpecs();
- var stats = tileset._statistics;
- expect(stats.numberContentReady).toEqual(1);
+ var statistics = tileset._statistics;
+ expect(statistics.numberContentReady).toEqual(1);
expect(tileset._selectedTiles[0]._selectionDepth).toEqual(0);
expect(tileset._hasMixedContent).toBe(false);
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) {
- expect(stats.numberContentReady).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5);
expect(tileset._hasMixedContent).toBe(false);
});
});
@@ -2365,22 +2365,22 @@ defineSuite([
it('marks tileset as mixed when tiles have nonzero selection depth', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
tileset._root.children[0].children[0].children[0].unloadContent();
tileset._root.children[0].children[0].children[1].unloadContent();
tileset._root.children[0].children[0].children[2].unloadContent();
- stats.numberContentReady -= 3;
+ statistics.numberContentReady -= 3;
scene.renderForSpecs();
expect(tileset._hasMixedContent).toBe(true);
- expect(stats.numberContentReady).toEqual(2);
+ expect(statistics.numberContentReady).toEqual(2);
expect(tileset._root.children[0].children[0].children[3]._selectionDepth).toEqual(1);
expect(tileset._root._selectionDepth).toEqual(0);
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) {
- expect(stats.numberContentReady).toEqual(5);
+ expect(statistics.numberContentReady).toEqual(5);
expect(tileset._hasMixedContent).toBe(false);
});
});
@@ -2403,7 +2403,7 @@ defineSuite([
it('creates duplicate backface commands', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var root = tileset._root;
tileset._root.children[0].children[0].children[0].unloadContent();
@@ -2413,7 +2413,7 @@ defineSuite([
scene.renderForSpecs();
// 2 for root tile, 2 for child, 1 for stencil clear
- expect(stats.numberOfCommands).toEqual(5);
+ expect(statistics.numberOfCommands).toEqual(5);
expect(root.selected).toBe(true);
expect(root._finalResolution).toBe(false);
expect(root.children[0].children[0].children[3].selected).toBe(true);
@@ -2429,7 +2429,7 @@ defineSuite([
it('does not create duplicate backface commands if no selected descendants', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var root = tileset._root;
tileset._root.children[0].children[0].children[0].unloadContent();
@@ -2440,7 +2440,7 @@ defineSuite([
scene.renderForSpecs();
// 2 for root tile, 1 for child, 1 for stencil clear
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
expect(root.selected).toBe(true);
expect(root._finalResolution).toBe(true);
expect(root.children[0].children[0].children[0].selected).toBe(false);
@@ -2456,16 +2456,16 @@ defineSuite([
url : tilesetUrl
}));
scene.renderForSpecs();
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
expect(tileset._selectedTiles.length).toEqual(0);
- expect(stats.numberOfCommands).toEqual(0);
+ expect(statistics.numberOfCommands).toEqual(0);
});
it('does not add stencil clear command or backface commands when fully resolved', function() {
viewAllTiles();
return Cesium3DTilesTester.loadTileset(scene, tilesetReplacement3Url).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.numberOfCommands).toEqual(tileset._selectedTiles.length);
+ var statistics = tileset._statistics;
+ expect(statistics.numberOfCommands).toEqual(tileset._selectedTiles.length);
var commandList = scene.frameState.commandList;
var length = commandList.length;
@@ -2483,21 +2483,21 @@ defineSuite([
loadSiblings : false,
baseScreenSpaceError: 1000000000
}).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.numberContentReady).toBe(2);
+ var statistics = tileset._statistics;
+ expect(statistics.numberContentReady).toBe(2);
tileset.loadSiblings = true;
scene.renderForSpecs();
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) {
- expect(stats.numberContentReady).toBe(5);
+ expect(statistics.numberContentReady).toBe(5);
});
});
});
- it('immediatelyLoadDesiredLOD', function() {
+ it('immediatelyLoadDesiredLevelOfDetail', function() {
viewBottomLeft();
var tileset = scene.primitives.add(new Cesium3DTileset({
url : tilesetOfTilesetsUrl,
- immediatelyLoadDesiredLOD : true
+ immediatelyLoadDesiredLevelOfDetail : true
}));
return Cesium3DTilesTester.waitForReady(scene, tileset).then(function(tileset) {
scene.renderForSpecs();
@@ -2505,8 +2505,8 @@ defineSuite([
tileset._root.refine = Cesium3DTileRefine.REPLACE;
tileset._root.children[0].refine = Cesium3DTileRefine.REPLACE;
return Cesium3DTilesTester.waitForTilesLoaded(scene, tileset).then(function(tileset) {
- var stats = tileset._statistics;
- expect(stats.numberContentReady).toBe(1);
+ var statistics = tileset._statistics;
+ expect(statistics.numberContentReady).toBe(1);
});
});
});
@@ -2514,7 +2514,7 @@ defineSuite([
it('selects children if no ancestors available', function() {
return Cesium3DTilesTester.loadTileset(scene, tilesetOfTilesetsUrl).then(function(tileset) {
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var parent = tileset._root.children[0];
var child = parent.children[3].children[0];
parent.refine = Cesium3DTileRefine.REPLACE;
@@ -2527,7 +2527,7 @@ defineSuite([
expect(parent.contentReady).toBe(false);
expect(child.selected).toBe(true);
expect(parent.selected).toBe(false);
- expect(stats.numberOfCommands).toEqual(1);
+ expect(statistics.numberOfCommands).toEqual(1);
});
});
@@ -2538,7 +2538,7 @@ defineSuite([
loadWithXhr.defaultLoad(batchedColorsB3dmUrl, responseType, method, data, headers, deferred, overrideMimeType);
});
var tile = tileset._root;
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
var expiredContent;
// Check that expireDuration and expireDate are correctly set
@@ -2550,9 +2550,9 @@ defineSuite([
expect(tile.contentAvailable).toBe(true);
expect(tile._expiredContent).toBeUndefined();
- // Check stats
- expect(stats.numberOfCommands).toBe(1);
- expect(stats.numberTotal).toBe(1);
+ // Check statistics
+ expect(statistics.numberOfCommands).toBe(1);
+ expect(statistics.numberTotal).toBe(1);
// Trigger expiration to happen next frame
tile.expireDate = JulianDate.addSeconds(JulianDate.now(), -1.0, new JulianDate());
@@ -2568,8 +2568,8 @@ defineSuite([
expect(expiredContent).toBeDefined();
// Expired content renders while new content loads in
- expect(stats.numberOfCommands).toBe(1);
- expect(stats.numberTotal).toBe(1);
+ expect(statistics.numberOfCommands).toBe(1);
+ expect(statistics.numberTotal).toBe(1);
// Request goes through, now in the LOADING state
scene.renderForSpecs();
@@ -2583,13 +2583,13 @@ defineSuite([
var url = loadWithXhr.load.calls.first().args[0];
expect(url.indexOf('expired=') >= 0).toBe(true);
- // Stats are still the same
- expect(stats.numberOfCommands).toBe(1);
- expect(stats.numberTotal).toBe(1);
+ // statistics are still the same
+ expect(statistics.numberOfCommands).toBe(1);
+ expect(statistics.numberTotal).toBe(1);
return pollToPromise(function() {
scene.renderForSpecs();
- expect(stats.numberOfCommands).toBe(1); // Still renders expired content
+ expect(statistics.numberOfCommands).toBe(1); // Still renders expired content
return tile.contentReady;
}).then(function() {
@@ -2599,9 +2599,9 @@ defineSuite([
expect(tile._expiredContent).toBeUndefined();
expect(expiredContent.isDestroyed()).toBe(true);
- // Stats for new content
- expect(stats.numberOfCommands).toBe(10);
- expect(stats.numberTotal).toBe(1);
+ // statistics for new content
+ expect(statistics.numberOfCommands).toBe(10);
+ expect(statistics.numberTotal).toBe(1);
});
});
});
@@ -2636,12 +2636,12 @@ defineSuite([
var subtreeRoot = tileset._root.children[0];
var subtreeChildren = subtreeRoot.children[0].children;
var childrenLength = subtreeChildren.length;
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
- // Check stats
- expect(stats.numberOfCommands).toBe(5);
- expect(stats.numberTotal).toBe(7);
- expect(stats.numberContentReady).toBe(5);
+ // Check statistics
+ expect(statistics.numberOfCommands).toBe(5);
+ expect(statistics.numberTotal).toBe(7);
+ expect(statistics.numberContentReady).toBe(5);
// Trigger expiration to happen next frame
subtreeRoot.expireDate = JulianDate.addSeconds(JulianDate.now(), -1.0, new JulianDate());
@@ -2668,9 +2668,9 @@ defineSuite([
return subtreeRoot.contentReady && tileset.tilesLoaded;
}).then(function() {
scene.renderForSpecs();
- expect(stats.numberOfCommands).toBe(4);
- expect(stats.numberTotal).toBe(6);
- expect(stats.numberContentReady).toBe(4);
+ expect(statistics.numberOfCommands).toBe(4);
+ expect(statistics.numberTotal).toBe(6);
+ expect(statistics.numberContentReady).toBe(4);
});
});
});
@@ -2681,7 +2681,7 @@ defineSuite([
deferred.reject();
});
var tile = tileset._root;
- var stats = tileset._statistics;
+ var statistics = tileset._statistics;
// Trigger expiration to happen next frame
tile.expireDate = JulianDate.addSeconds(JulianDate.now(), -1.0, new JulianDate());
@@ -2695,8 +2695,8 @@ defineSuite([
// Render scene
scene.renderForSpecs();
expect(tile._contentState).toBe(Cesium3DTileContentState.FAILED);
- expect(stats.numberOfCommands).toBe(0);
- expect(stats.numberTotal).toBe(1);
+ expect(statistics.numberOfCommands).toBe(0);
+ expect(statistics.numberTotal).toBe(1);
});
});
diff --git a/Specs/Scene/Instanced3DModel3DTileContentSpec.js b/Specs/Scene/Instanced3DModel3DTileContentSpec.js
index f5f6fd95d99e..7ff687f5e473 100644
--- a/Specs/Scene/Instanced3DModel3DTileContentSpec.js
+++ b/Specs/Scene/Instanced3DModel3DTileContentSpec.js
@@ -277,32 +277,32 @@ defineSuite([
// Box model - 32 ushort indices and 24 vertices per building, 8 float components (position, normal, uv) per vertex.
// (24 * 8 * 4) + (36 * 2) = 840
- var vertexMemorySizeInBytes = 840;
+ var geometryByteLength = 840;
// Texture is 211x211 RGBA bytes, but upsampled to 256x256 because the wrap mode is REPEAT
- var textureMemorySizeInBytes = 262144;
+ var texturesByteLength = 262144;
// One RGBA byte pixel per feature
- var batchTextureMemorySizeInBytes = content.featuresLength * 4;
- var pickTextureMemorySizeInBytes = content.featuresLength * 4;
+ var batchTexturesByteLength = content.featuresLength * 4;
+ var pickTexturesByteLength = content.featuresLength * 4;
// Features have not been picked or colored yet, so the batch table contribution is 0.
- expect(content.vertexMemorySizeInBytes).toEqual(vertexMemorySizeInBytes);
- expect(content.textureMemorySizeInBytes).toEqual(textureMemorySizeInBytes);
- expect(content.batchTableMemorySizeInBytes).toEqual(0);
+ expect(content.geometryByteLength).toEqual(geometryByteLength);
+ expect(content.texturesByteLength).toEqual(texturesByteLength);
+ expect(content.batchTableByteLength).toEqual(0);
// Color a feature and expect the texture memory to increase
content.getFeature(0).color = Color.RED;
scene.renderForSpecs();
- expect(content.vertexMemorySizeInBytes).toEqual(vertexMemorySizeInBytes);
- expect(content.textureMemorySizeInBytes).toEqual(textureMemorySizeInBytes);
- expect(content.batchTableMemorySizeInBytes).toEqual(batchTextureMemorySizeInBytes);
+ expect(content.geometryByteLength).toEqual(geometryByteLength);
+ expect(content.texturesByteLength).toEqual(texturesByteLength);
+ expect(content.batchTableByteLength).toEqual(batchTexturesByteLength);
// Pick the tile and expect the texture memory to increase
scene.pickForSpecs();
- expect(content.vertexMemorySizeInBytes).toEqual(vertexMemorySizeInBytes);
- expect(content.textureMemorySizeInBytes).toEqual(textureMemorySizeInBytes);
- expect(content.batchTableMemorySizeInBytes).toEqual(batchTextureMemorySizeInBytes + pickTextureMemorySizeInBytes);
+ expect(content.geometryByteLength).toEqual(geometryByteLength);
+ expect(content.texturesByteLength).toEqual(texturesByteLength);
+ expect(content.batchTableByteLength).toEqual(batchTexturesByteLength + pickTexturesByteLength);
});
});
diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js
index e9d07dc47350..cec63b7f24e2 100644
--- a/Specs/Scene/ModelSpec.js
+++ b/Specs/Scene/ModelSpec.js
@@ -2301,24 +2301,24 @@ defineSuite([
it('gets memory usage', function() {
// Texture is originally 211*211 but is scaled up to 256*256 to support its minification filter and then is mipmapped
var expectedTextureMemory = Math.floor(256*256*4*(4/3));
- var expectedVertexMemory = 840;
+ var expectedGeometryMemory = 840;
var options = {
cacheKey : 'memory-usage-test',
incrementallyLoadTextures : false
};
return loadModel(texturedBoxUrl, options).then(function(model) {
// The first model owns the resources
- expect(model.vertexMemorySizeInBytes).toBe(expectedVertexMemory);
- expect(model.textureMemorySizeInBytes).toBe(expectedTextureMemory);
- expect(model.cachedVertexMemorySizeInBytes).toBe(0);
- expect(model.cachedTextureMemorySizeInBytes).toBe(0);
+ expect(model.geometryByteLength).toBe(expectedGeometryMemory);
+ expect(model.texturesByteLength).toBe(expectedTextureMemory);
+ expect(model.cachedGeometryByteLength).toBe(0);
+ expect(model.cachedTexturesByteLength).toBe(0);
return loadModel(texturedBoxUrl, options).then(function(model) {
// The second model is sharing the resources, so its memory usage is reported as 0
- expect(model.vertexMemorySizeInBytes).toBe(0);
- expect(model.textureMemorySizeInBytes).toBe(0);
- expect(model.cachedVertexMemorySizeInBytes).toBe(expectedVertexMemory);
- expect(model.cachedTextureMemorySizeInBytes).toBe(expectedTextureMemory);
+ expect(model.geometryByteLength).toBe(0);
+ expect(model.texturesByteLength).toBe(0);
+ expect(model.cachedGeometryByteLength).toBe(expectedGeometryMemory);
+ expect(model.cachedTexturesByteLength).toBe(expectedTextureMemory);
});
});
});
diff --git a/Specs/Scene/PointCloud3DTileContentSpec.js b/Specs/Scene/PointCloud3DTileContentSpec.js
index a64b782391da..027b178e36bc 100644
--- a/Specs/Scene/PointCloud3DTileContentSpec.js
+++ b/Specs/Scene/PointCloud3DTileContentSpec.js
@@ -637,7 +637,7 @@ defineSuite([
];
// 1000 points
- var expectedVertexMemory = [
+ var expectedGeometryMemory = [
1000 * 12, // 3 floats (xyz)
1000 * 15, // 3 floats (xyz), 3 bytes (rgb)
1000 * 27, // 3 floats (xyz), 3 bytes (rgb), 3 floats (normal)
@@ -648,8 +648,8 @@ defineSuite([
var length = tilesets.length;
for (var i = 0; i < length; ++i) {
var content = tilesets[i]._root.content;
- expect(content.vertexMemorySizeInBytes).toEqual(expectedVertexMemory[i]);
- expect(content.textureMemorySizeInBytes).toEqual(0);
+ expect(content.geometryByteLength).toEqual(expectedGeometryMemory[i]);
+ expect(content.texturesByteLength).toEqual(0);
}
});
});
@@ -660,29 +660,29 @@ defineSuite([
// Point cloud consists of positions, colors, normals, and batchIds
// 3 floats (xyz), 3 floats (normal), 1 byte (batchId)
- var pointCloudVertexMemory = 1000 * 25;
+ var pointCloudGeometryMemory = 1000 * 25;
// One RGBA byte pixel per feature
- var batchTextureMemorySizeInBytes = content.featuresLength * 4;
- var pickTextureMemorySizeInBytes = content.featuresLength * 4;
+ var batchTexturesByteLength = content.featuresLength * 4;
+ var pickTexturesByteLength = content.featuresLength * 4;
// Features have not been picked or colored yet, so the batch table contribution is 0.
- expect(content.vertexMemorySizeInBytes).toEqual(pointCloudVertexMemory);
- expect(content.textureMemorySizeInBytes).toEqual(0);
- expect(content.batchTableMemorySizeInBytes).toEqual(0);
+ expect(content.geometryByteLength).toEqual(pointCloudGeometryMemory);
+ expect(content.texturesByteLength).toEqual(0);
+ expect(content.batchTableByteLength).toEqual(0);
// Color a feature and expect the texture memory to increase
content.getFeature(0).color = Color.RED;
scene.renderForSpecs();
- expect(content.vertexMemorySizeInBytes).toEqual(pointCloudVertexMemory);
- expect(content.textureMemorySizeInBytes).toEqual(0);
- expect(content.batchTableMemorySizeInBytes).toEqual(batchTextureMemorySizeInBytes);
+ expect(content.geometryByteLength).toEqual(pointCloudGeometryMemory);
+ expect(content.texturesByteLength).toEqual(0);
+ expect(content.batchTableByteLength).toEqual(batchTexturesByteLength);
// Pick the tile and expect the texture memory to increase
scene.pickForSpecs();
- expect(content.vertexMemorySizeInBytes).toEqual(pointCloudVertexMemory);
- expect(content.textureMemorySizeInBytes).toEqual(0);
- expect(content.batchTableMemorySizeInBytes).toEqual(batchTextureMemorySizeInBytes + pickTextureMemorySizeInBytes);
+ expect(content.geometryByteLength).toEqual(pointCloudGeometryMemory);
+ expect(content.texturesByteLength).toEqual(0);
+ expect(content.batchTableByteLength).toEqual(batchTexturesByteLength + pickTexturesByteLength);
});
});