define([
'../Core/ApproximateTerrainHeights',
'../Core/Cartesian2',
'../Core/Cartesian3',
'../Core/Cartographic',
'../Core/Check',
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
'../Core/deprecationWarning',
'../Core/destroyObject',
'../Core/DeveloperError',
'../Core/DoublyLinkedList',
'../Core/Ellipsoid',
'../Core/Event',
'../Core/JulianDate',
'../Core/ManagedArray',
'../Core/Math',
'../Core/Matrix4',
'../Core/Resource',
'../Core/RuntimeError',
'../Core/Transforms',
'../Renderer/ClearCommand',
'../Renderer/Pass',
'../ThirdParty/when',
'./Axis',
'./Cesium3DTile',
'./Cesium3DTileColorBlendMode',
'./Cesium3DTileContentState',
'./Cesium3DTileOptimizations',
'./Cesium3DTileRefine',
'./Cesium3DTilesetAsyncTraversal',
'./Cesium3DTilesetCache',
'./Cesium3DTilesetStatistics',
'./Cesium3DTilesetTraversal',
'./Cesium3DTileStyleEngine',
'./ClippingPlaneCollection',
'./LabelCollection',
'./PointCloudEyeDomeLighting',
'./PointCloudShading',
'./SceneMode',
'./ShadowMode',
'./TileBoundingRegion',
'./TileBoundingSphere',
'./TileOrientedBoundingBox'
], function(
ApproximateTerrainHeights,
Cartesian2,
Cartesian3,
Cartographic,
Check,
defaultValue,
defined,
defineProperties,
deprecationWarning,
destroyObject,
DeveloperError,
DoublyLinkedList,
Ellipsoid,
Event,
JulianDate,
ManagedArray,
CesiumMath,
Matrix4,
Resource,
RuntimeError,
Transforms,
ClearCommand,
Pass,
when,
Axis,
Cesium3DTile,
Cesium3DTileColorBlendMode,
Cesium3DTileContentState,
Cesium3DTileOptimizations,
Cesium3DTileRefine,
Cesium3DTilesetAsyncTraversal,
Cesium3DTilesetCache,
Cesium3DTilesetStatistics,
Cesium3DTilesetTraversal,
Cesium3DTileStyleEngine,
ClippingPlaneCollection,
LabelCollection,
PointCloudEyeDomeLighting,
PointCloudShading,
SceneMode,
ShadowMode,
TileBoundingRegion,
TileBoundingSphere,
TileOrientedBoundingBox) {
'use strict';
/**
* A {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification|3D Tiles tileset},
* used for streaming massive heterogeneous 3D geospatial datasets.
*
* @alias Cesium3DTileset
* @constructor
*
* @param {Object} options Object with the following properties:
* @param {Resource|String|Promise
* The dynamic error is in the range [0.0, 1.0) and is multiplied by
* Increasing
* Valid values are between 0.0 and 1.0.
*
* 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
* The number of pending tile requests,
* This event is fired at the end of the frame after the scene is rendered.
*
* This event is fired at the end of the frame after the scene is rendered.
*
* This event is fired at the end of the frame after the scene is rendered.
*
* The loaded {@link Cesium3DTile} is passed to the event listener.
*
* This event is fired during the tileset traversal while the frame is being rendered
* so that updates to the tile take effect in the same frame. Do not create or modify
* Cesium entities or primitives during the event listener.
*
* The unloaded {@link Cesium3DTile} is passed to the event listener.
*
* This event is fired immediately before the tile's content is unloaded while the frame is being
* rendered so that the event listener has access to the tile's content. Do not create
* or modify Cesium entities or primitives during the event listener.
*
* If there are no event listeners, error messages will be logged to the console.
*
* The error object passed to the listener contains two properties:
*
* The visible {@link Cesium3DTile} is passed to the event listener.
*
* This event is fired during the tileset traversal while the frame is being rendered
* so that updates to the tile take effect in the same frame. Do not create or modify
* Cesium entities or primitives during the event listener.
*
* The common strategy for replacement-refinement traversal is to store all levels of the tree in memory and require
* all children to be loaded before the parent can refine. With this optimization levels of the tree can be skipped
* entirely and children can be rendered alongside their parents. The tileset requires significantly less memory when
* using this optimization.
*
* Only used when {@link Cesium3DTileset#skipLevelOfDetail} is
* Only used when {@link Cesium3DTileset#skipLevelOfDetail} is
* Only used when {@link Cesium3DTileset#skipLevelOfDetail} is
* Only used when {@link Cesium3DTileset#skipLevelOfDetail} is
* Only used when {@link Cesium3DTileset#skipLevelOfDetail} is
* For example, disabling additional light sources by setting
* There are nine
* 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.
*
* 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.
*
* When true, renders each tile's content as a wireframe.
*
* When true, renders the bounding volume for each visible tile. The bounding volume is
* white if the tile has a content bounding volume or is empty; otherwise, it is red. Tiles that don't meet the
* screen space error and are still refining to their descendants are yellow.
*
* 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.
*
* When true, renders the viewer request volume for each tile.
*
* When true, draws labels to indicate the geometric error of each tile.
*
* When true, draws labels to indicate the number of commands, points, triangles and features of each tile.
*
* When true, draws labels to indicate the geometry and texture memory usage of each tile.
*
* When true, draws labels to indicate the url of each tile.
*
* See the {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#reference-asset|asset schema reference}
* in the 3D Tiles spec for the full set of properties.
*
* See the {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#reference-properties|properties schema reference}
* in the 3D Tiles spec for the full set of properties.
*
* This promise is resolved at the end of the frame before the first frame the tileset is rendered in.
*
* Assign
* The style is applied to a tile before the {@link Cesium3DTileset#tileVisible}
* event is raised, so code in
* A tile's screen space error is roughly equivalent to the number of pixels wide that would be drawn if a sphere with a
* radius equal to the tile's geometric error were rendered at the tile's position. If this value exceeds
*
* Depending on the tileset,
* 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
* This option is only applied to tilesets containing batched 3D models, geometry data, or vector data. Even when undefined, vector data and geometry data
* must render as classifications and will default to rendering on both terrain and other 3D Tiles tilesets.
*
* When enabled for batched 3D model tilesets, there are a few requirements/limitations on the glTF:
* 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 {ClippingPlaneCollection} [options.clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the tileset.
* @param {ClassificationType} [options.classificationType] Determines whether terrain, 3D Tiles or both will be classified by this tileset. See {@link Cesium3DTileset#classificationType} for details about restrictions and limitations.
* @param {Ellipsoid} [options.ellipsoid=Ellipsoid.WGS84] The ellipsoid determining the size and shape of the globe.
* @param {Object} [options.pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting.
* @param {Cartesian2} [options.imageBasedLightingFactor=new Cartesian2(1.0, 1.0)] Scales the diffuse and specular image-based lighting from the earth, sky, atmosphere and star skybox.
* @param {Cartesian3} [options.lightColor] The color and intensity of the sunlight used to shade models.
* @param {Number} [options.luminanceAtZenith=0.5] The sun's luminance at the zenith in kilo candela per meter squared to use for this model's procedural environment map.
* @param {Cartesian3[]} [options.sphericalHarmonicCoefficients] The third order spherical harmonic coefficients used for the diffuse color of image-based lighting.
* @param {String} [options.specularEnvironmentMaps] A URL to a KTX file that contains a cube map of the specular lighting and the convoluted specular mipmaps.
* @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.
* @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile.
* @param {Boolean} [options.debugShowContentBoundingVolume=false] For debugging only. When true, renders the bounding volume for each tile's content.
* @param {Boolean} [options.debugShowViewerRequestVolume=false] For debugging only. When true, renders the viewer request volume for each tile.
* @param {Boolean} [options.debugShowGeometricError=false] For debugging only. When true, draws labels to indicate the geometric error of each tile.
* @param {Boolean} [options.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 geometry memory in megabytes used by each tile.
* @param {Boolean} [options.debugShowUrl=false] For debugging only. When true, draws labels to indicate the url of each tile.
*
* @exception {DeveloperError} The tileset must be 3D Tiles version 0.0 or 1.0.
*
* @example
* var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
* url : 'http://localhost:8002/tilesets/Seattle/tileset.json'
* }));
*
* @example
* // Common setting for the skipLevelOfDetail optimization
* var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
* url : 'http://localhost:8002/tilesets/Seattle/tileset.json',
* 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/tileset.json',
* dynamicScreenSpaceError : true,
* dynamicScreenSpaceErrorDensity : 0.00278,
* dynamicScreenSpaceErrorFactor : 4.0,
* dynamicScreenSpaceErrorHeightFalloff : 0.25
* }));
*
* @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification|3D Tiles specification}
*/
function Cesium3DTileset(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
//>>includeStart('debug', pragmas.debug);
Check.defined('options.url', options.url);
//>>includeEnd('debug');
this._url = undefined;
this._basePath = undefined;
this._root = undefined;
this._asset = undefined; // Metadata for the entire tileset
this._properties = undefined; // Metadata for per-model/point/etc properties
this._geometricError = undefined; // Geometric error when the tree is not rendered at all
this._extensionsUsed = undefined;
this._gltfUpAxis = undefined;
this._cache = new Cesium3DTilesetCache();
this._processingQueue = [];
this._selectedTiles = [];
this._emptyTiles = [];
this._requestedTiles = [];
this._selectedTilesToStyle = [];
this._loadTimestamp = undefined;
this._timeSinceLoad = 0.0;
this._updatedVisibilityFrame = 0;
this._extras = undefined;
this._cullWithChildrenBounds = defaultValue(options.cullWithChildrenBounds, true);
this._allTilesAdditive = true;
this._hasMixedContent = false;
this._backfaceCommands = new ManagedArray();
this._maximumScreenSpaceError = defaultValue(options.maximumScreenSpaceError, 16);
this._maximumMemoryUsage = defaultValue(options.maximumMemoryUsage, 512);
this._styleEngine = new Cesium3DTileStyleEngine();
this._modelMatrix = defined(options.modelMatrix) ? Matrix4.clone(options.modelMatrix) : Matrix4.clone(Matrix4.IDENTITY);
this._statistics = new Cesium3DTilesetStatistics();
this._statisticsLastRender = new Cesium3DTilesetStatistics();
this._statisticsLastPick = new Cesium3DTilesetStatistics();
this._statisticsLastAsync = new Cesium3DTilesetStatistics();
this._tilesLoaded = false;
this._initialTilesLoaded = false;
this._tileDebugLabels = undefined;
this._readyPromise = when.defer();
this._classificationType = options.classificationType;
this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
this._initialClippingPlanesOriginMatrix = Matrix4.IDENTITY; // Computed from the tileset JSON.
this._clippingPlanesOriginMatrix = undefined; // Combines the above with any run-time transforms.
this._clippingPlanesOriginMatrixDirty = true;
/**
* 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 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}
* @default false
*/
this.dynamicScreenSpaceError = defaultValue(options.dynamicScreenSpaceError, false);
/**
* 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.
* dynamicScreenSpaceErrorFactor to produce the
* final dynamic error. This dynamic error is then subtracted from the tile's actual screen space error.
* dynamicScreenSpaceErrorDensity has the effect of moving the error midpoint closer to the camera.
* It is analogous to moving fog closer to the camera.
* true.
* 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.
*
* @type {Number}
* @default 0.5
*/
this.colorBlendAmount = 0.5;
/**
* Options for controlling point size based on geometric error and eye dome lighting.
* @type {PointCloudShading}
*/
this.pointCloudShading = new PointCloudShading(options.pointCloudShading);
this._pointCloudEyeDomeLighting = new PointCloudEyeDomeLighting();
/**
* The event fired to indicate progress of loading new tiles. This event is fired when a new tile
* is requested, when a requested tile is finished downloading, and when a downloaded tile has been
* processed and is ready to render.
* numberOfPendingRequests, and number of tiles
* processing, numberOfTilesProcessing are passed to the event listener.
*
*
*
* @type {Event}
* @default new Event()
*
* @example
* tileset.tileFailed.addEventListener(function(error) {
* console.log('An error occurred loading tile: ' + error.url);
* console.log('Error: ' + error.message);
* });
*/
this.tileFailed = new Event();
/**
* This event fires once for each visible tile in a frame. This can be used to manually
* style a tileset.
* url: the url of the failed tile.message: the error message.true.
* <= 100 / skipScreenSpaceErrorFactor.
* true.
* true.
* true.
* true.
* model.imageBasedLightingFactor = new Cartesian2(0.0, 0.0) will make the
* model much darker. Here, increasing the intensity of the light source will make the model brighter.
* undefined, a diffuse irradiance
* computed from the atmosphere color is used.
* Cartesian3 coefficients.
* The order of the coefficients is: L00, L1-1, L10, L11, L2-2, L2-1, L20, L21, L22
* cmgen tool of
* {@link https://github.com/google/filament/releases | Google's Filament project}. This will also generate a KTX file that can be
* supplied to {@link Cesium3DTileset#specularEnvironmentMaps}.
*
* @type {Cartesian3[]}
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Image-Based Lighting.html|Sandcastle Image Based Lighting Demo}
* @see {@link https://graphics.stanford.edu/papers/envmap/envmap.pdf|An Efficient Representation for Irradiance Environment Maps}
*/
this.sphericalHarmonicCoefficients = options.sphericalHarmonicCoefficients;
/**
* A URL to a KTX file that contains a cube map of the specular lighting and the convoluted specular mipmaps.
*
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Image-Based Lighting.html|Sandcastle Image Based Lighting Demo}
* @type {String}
* @see Cesium3DTileset#sphericalHarmonicCoefficients
*/
this.specularEnvironmentMaps = options.specularEnvironmentMaps;
/**
* This property is for debugging only; it is not optimized for production use.
* true, the tileset's root tile is loaded and the tileset is ready to render.
* This is set to true right before {@link Cesium3DTileset#readyPromise} is resolved.
*
* @memberof Cesium3DTileset.prototype
*
* @type {Boolean}
* @readonly
*
* @default false
*/
ready : {
get : function() {
return defined(this._root);
}
},
/**
* Gets the promise that will be resolved when the tileset's root tile is loaded and the tileset is ready to render.
* true, all tiles that meet the screen space error this frame are loaded. The tileset is
* completely loaded for this view.
*
* @memberof Cesium3DTileset.prototype
*
* @type {Boolean}
* @readonly
*
* @default false
*
* @see Cesium3DTileset#allTilesLoaded
*/
tilesLoaded : {
get : function() {
return this._tilesLoaded;
}
},
/**
* The url to a tileset JSON file.
*
* @memberof Cesium3DTileset.prototype
*
* @type {String}
* @readonly
*/
url : {
get : function() {
return this._url;
}
},
/**
* The base path that non-absolute paths in tileset JSON file are relative to.
*
* @memberof Cesium3DTileset.prototype
*
* @type {String}
* @readonly
* @deprecated
*/
basePath : {
get : function() {
deprecationWarning('Cesium3DTileset.basePath', 'Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead.');
return this._basePath;
}
},
/**
* The style, defined using the
* {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification/Styling|3D Tiles Styling language},
* applied to each feature in the tileset.
* undefined to remove the style, which will restore the visual
* appearance of the tileset to its default when no style was applied.
* tileVisible can manually set a feature's
* properties (e.g. color and show) after the style is applied. When
* a new style is assigned any manually set properties are overwritten.
* maximumScreenSpaceError the tile refines to its descendants.
* maximumScreenSpaceError may need to be tweaked to achieve the right balance.
* Higher values provide better performance but lower visual quality.
* maximumScreenSpaceError must be greater than or equal to zero.
*/
maximumScreenSpaceError : {
get : function() {
return this._maximumScreenSpaceError;
},
set : function(value) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.number.greaterThanOrEquals('maximumScreenSpaceError', value, 0);
//>>includeEnd('debug');
this._maximumScreenSpaceError = value;
}
},
/**
* The maximum amount of GPU memory (in MB) that may be used to cache tiles. This value is estimated from
* geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also
* includes per-point metadata.
* maximumMemoryUsage are needed
* 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
* these tiles go out of view, they will be unloaded.
* maximumMemoryUsage must be greater than or equal to zero.
* @see Cesium3DTileset#totalMemoryUsageInBytes
*/
maximumMemoryUsage : {
get : function() {
return this._maximumMemoryUsage;
},
set : function(value) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.number.greaterThanOrEquals('value', value, 0);
//>>includeEnd('debug');
this._maximumMemoryUsage = value;
}
},
/**
* The root tile.
*
* @memberOf Cesium3DTileset.prototype
*
* @type {Cesium3DTile}
* @readonly
*
* @exception {DeveloperError} The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.
*/
root : {
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;
}
},
/**
* The tileset's bounding sphere.
*
* @memberof Cesium3DTileset.prototype
*
* @type {BoundingSphere}
* @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.json'
* }));
*
* 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() {
//>>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');
this._root.updateTransform(this._modelMatrix);
return this._root.boundingSphere;
}
},
/**
* A 4x4 transformation matrix that transforms the entire tileset.
*
* @memberof Cesium3DTileset.prototype
*
* @type {Matrix4}
* @default Matrix4.IDENTITY
*
* @example
* // Adjust a tileset's height from the globe's surface.
* var heightOffset = 20.0;
* var boundingSphere = tileset.boundingSphere;
* var cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
* var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
* var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
* var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
* tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
*/
modelMatrix : {
get : function() {
return this._modelMatrix;
},
set : function(value) {
this._modelMatrix = Matrix4.clone(value, this._modelMatrix);
}
},
/**
* Returns the time, in milliseconds, since the tileset was loaded and first updated.
*
* @memberof Cesium3DTileset.prototype
*
* @type {Number}
* @readonly
*/
timeSinceLoad : {
get : function() {
return this._timeSinceLoad;
}
},
/**
* 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.texturesByteLength + statistics.geometryByteLength + statistics.batchTableByteLength;
}
},
/**
* @private
*/
clippingPlanesOriginMatrix : {
get : function() {
if (!defined(this._clippingPlanesOriginMatrix)) {
return Matrix4.IDENTITY;
}
if (this._clippingPlanesOriginMatrixDirty) {
Matrix4.multiply(this.root.computedTransform, this._initialClippingPlanesOriginMatrix, this._clippingPlanesOriginMatrix);
this._clippingPlanesOriginMatrixDirty = false;
}
return this._clippingPlanesOriginMatrix;
}
},
/**
* @private
*/
styleEngine : {
get : function() {
return this._styleEngine;
}
},
/**
* @private
*/
statistics : {
get : function() {
return this._statistics;
}
},
/**
* Determines whether terrain, 3D Tiles or both will be classified by this tileset.
*
*
*
extras property at the top-level of the tileset JSON, which contains application specific metadata.
* Returns undefined if extras does not exist.
*
* @memberof Cesium3DTileset.prototype
*
* @exception {DeveloperError} The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true.
*
* @type {*}
* @readonly
*
* @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#specifying-extensions-and-application-specific-extras|Extras in the 3D Tiles specification.}
*/
extras : {
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._extras;
}
},
/**
* Cesium adds lighting from the earth, sky, atmosphere, and star skybox. This cartesian is used to scale the final
* diffuse and specular lighting contribution from those sources to the final color. A value of 0.0 will disable those light sources.
*
* @type {Cartesian2}
* @default Cartesian2(1.0, 1.0)
*/
imageBasedLightingFactor : {
get : function() {
return this._imageBasedLightingFactor;
},
set : function(value) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.object('imageBasedLightingFactor', value);
Check.typeOf.number.greaterThanOrEquals('imageBasedLightingFactor.x', value.x, 0.0);
Check.typeOf.number.lessThanOrEquals('imageBasedLightingFactor.x', value.x, 1.0);
Check.typeOf.number.greaterThanOrEquals('imageBasedLightingFactor.y', value.y, 0.0);
Check.typeOf.number.lessThanOrEquals('imageBasedLightingFactor.y', value.y, 1.0);
//>>includeEnd('debug');
Cartesian2.clone(value, this._imageBasedLightingFactor);
}
}
});
/**
* Provides a hook to override the method used to request the tileset json
* useful when fetching tilesets from remote servers
* @param {Resource|String} tilesetUrl The url of the json file to be fetched
* @returns {Promise.