Appearance
KBE3D / KBCore / Cesium / Cesium3DTileset
类: Cesium3DTileset
A 3D Tiles tileset, used for streaming massive heterogeneous 3D geospatial datasets.
<div class="notice"> This object is normally not instantiated directly, use Cesium3DTileset.fromUrl. </div>
Examples
ts
try {
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json"
);
scene.primitives.add(tileset);
} catch (error) {
console.error(`Error creating tileset: ${error}`);
}ts
// Turn on camera collisions with the tileset.
try {
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json",
{ enableCollision: true }
);
scene.primitives.add(tileset);
} catch (error) {
console.error(`Error creating tileset: ${error}`);
}ts
// Common setting for the skipLevelOfDetail optimization
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json", {
skipLevelOfDetail: true,
baseScreenSpaceError: 1024,
skipScreenSpaceErrorFactor: 16,
skipLevels: 1,
immediatelyLoadDesiredLevelOfDetail: false,
loadSiblings: false,
cullWithChildrenBounds: true
});
scene.primitives.add(tileset);ts
// Common settings for the dynamicScreenSpaceError optimization
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json", {
dynamicScreenSpaceError: true,
dynamicScreenSpaceErrorDensity: 2.0e-4,
dynamicScreenSpaceErrorFactor: 24.0,
dynamicScreenSpaceErrorHeightFalloff: 0.25
});
scene.primitives.add(tileset);参数
An object describing initialization options
属性
cullRequestsWhileMoving
cullRequestsWhileMoving:
boolean
Optimization option. Don't request tiles that will likely be unused when they come back because of the camera's movement. This optimization only applies to stationary tilesets.
cullRequestsWhileMovingMultiplier
cullRequestsWhileMovingMultiplier:
number
Optimization option. Multiplier used in culling requests while moving. Larger is more aggressive culling, smaller less aggressive culling.
progressiveResolutionHeightFraction
progressiveResolutionHeightFraction:
number
Optimization option. If between (0.0, 0.5], tiles at or above the screen space error for the reduced screen resolution of <code>progressiveResolutionHeightFraction*screenHeight</code> will be prioritized first. This can help get a quick layer of tiles down while full resolution tiles continue to load.
preferLeaves
preferLeaves:
boolean
Optimization option. Prefer loading of leaves first.
preloadWhenHidden
preloadWhenHidden:
boolean
Preload tiles when <code>tileset.show</code> is <code>false</code>. Loads tiles as if the tileset is visible but does not render them.
preloadFlightDestinations
preloadFlightDestinations:
boolean
Optimization option. Fetch tiles at the camera's flight destination while the camera is in flight.
dynamicScreenSpaceError
dynamicScreenSpaceError:
boolean
Optimization option. For street-level horizon views, use lower resolution tiles far from the camera. This reduces the amount of data loaded and improves tileset loading time with a slight drop in visual quality in the distance. <p> This optimization is strongest when the camera is close to the ground plane of the tileset and looking at the horizon. Furthermore, the results are more accurate for tightly fitting bounding volumes like box and region.
foveatedScreenSpaceError
foveatedScreenSpaceError:
boolean
Optimization option. Prioritize loading tiles in the center of the screen by temporarily raising the screen space error for tiles around the edge of the screen. Screen space error returns to normal once all the tiles in the center of the screen as determined by the Cesium3DTileset#foveatedConeSize are loaded.
foveatedInterpolationCallback
foveatedInterpolationCallback:
foveatedInterpolationCallback
Gets or sets a callback to control how much to raise the screen space error for tiles outside the foveated cone, interpolating between Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation and Cesium3DTileset#maximumScreenSpaceError.
foveatedTimeDelay
foveatedTimeDelay:
number
Optimization option. Used when Cesium3DTileset#foveatedScreenSpaceError is true to control how long in seconds to wait after the camera stops moving before deferred tiles start loading in. This time delay prevents requesting tiles around the edges of the screen when the camera is moving. Setting this to 0.0 will immediately request all tiles in any given view.
dynamicScreenSpaceErrorDensity
dynamicScreenSpaceErrorDensity:
number
Similar to Fog#density, this option controls the camera distance at which the Cesium3DTileset#dynamicScreenSpaceError optimization applies. Larger values will cause tiles closer to the camera to be affected. This value must be non-negative. <p> This optimization works by rolling off the tile screen space error (SSE) with camera distance like a bell curve. This has the effect of selecting lower resolution tiles far from the camera. Near the camera, no adjustment is made. For tiles further away, the SSE is reduced by up to Cesium3DTileset#dynamicScreenSpaceErrorFactor (measured in pixels of error). </p> <p> Increasing the density makes the bell curve narrower so tiles closer to the camera are affected. This is analagous to moving fog closer to the camera. </p> <p> When the density is 0, the optimization will have no effect on the tileset. </p>
dynamicScreenSpaceErrorFactor
dynamicScreenSpaceErrorFactor:
number
A parameter that controls the intensity of the Cesium3DTileset#dynamicScreenSpaceError optimization for tiles on the horizon. Larger values cause lower resolution tiles to load, improving runtime performance at a slight reduction of visual quality. The value must be non-negative. <p> More specifically, this parameter represents the maximum adjustment to screen space error (SSE) in pixels for tiles far away from the camera. See Cesium3DTileset#dynamicScreenSpaceErrorDensity for more details about how this optimization works. </p> <p> When the SSE factor is set to 0, the optimization will have no effect on the tileset. </p>
dynamicScreenSpaceErrorHeightFalloff
dynamicScreenSpaceErrorHeightFalloff:
number
A ratio of the tileset's height that determines "street level" for the Cesium3DTileset#dynamicScreenSpaceError optimization. When the camera is below this height, the dynamic screen space error optimization will have the maximum effect, and it will roll off above this value. Valid values are between 0.0 and 1.0. <p>
shadows
shadows:
ShadowMode
Determines whether the tileset casts or receives shadows from light sources. <p> 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. </p> <p> Shadows are rendered only when Viewer#shadows is <code>true</code>. </p>
show
show:
boolean
Determines if the tileset will be shown.
colorBlendMode
colorBlendMode:
Cesium3DTileColorBlendMode
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.
colorBlendAmount
colorBlendAmount:
number
Defines the value used to linearly interpolate between the source color and feature color when the Cesium3DTileset#colorBlendMode is <code>MIX</code>. 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.
loadProgress
loadProgress:
Event
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. <p> The number of pending tile requests, <code>numberOfPendingRequests</code>, and number of tiles processing, <code>numberOfTilesProcessing</code> are passed to the event listener. </p> <p> This event is fired at the end of the frame after the scene is rendered. </p>
示例
ts
tileset.loadProgress.addEventListener(function(numberOfPendingRequests, numberOfTilesProcessing) {
if ((numberOfPendingRequests === 0) && (numberOfTilesProcessing === 0)) {
console.log('Stopped loading');
return;
}
console.log(`Loading: requests: ${numberOfPendingRequests}, processing: ${numberOfTilesProcessing}`);
});allTilesLoaded
allTilesLoaded:
Event
The event fired to indicate that all tiles that meet the screen space error this frame are loaded. The tileset is completely loaded for this view. <p> This event is fired at the end of the frame after the scene is rendered. </p>
示例
ts
tileset.allTilesLoaded.addEventListener(function() {
console.log('All tiles are loaded');
});initialTilesLoaded
initialTilesLoaded:
Event
The event fired to indicate that all tiles that meet the screen space error this frame are loaded. This event is fired once when all tiles in the initial view are loaded. <p> This event is fired at the end of the frame after the scene is rendered. </p>
示例
ts
tileset.initialTilesLoaded.addEventListener(function() {
console.log('Initial tiles are loaded');
});tileLoad
tileLoad:
Event
The event fired to indicate that a tile's content was loaded. <p> The loaded Cesium3DTile is passed to the event listener. </p> <p> 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. </p>
示例
ts
tileset.tileLoad.addEventListener(function(tile) {
console.log('A tile was loaded.');
});tileUnload
tileUnload:
Event
The event fired to indicate that a tile's content was unloaded. <p> The unloaded Cesium3DTile is passed to the event listener. </p> <p> 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. </p>
示例
ts
tileset.tileUnload.addEventListener(function(tile) {
console.log('A tile was unloaded from the cache.');
});tileFailed
tileFailed:
Event
The event fired to indicate that a tile's content failed to load. <p> If there are no event listeners, error messages will be logged to the console. </p> <p> The error object passed to the listener contains two properties: <ul> <li><code>url</code>: the url of the failed tile.</li> <li><code>message</code>: the error message.</li> </ul> <p> If multiple contents are present, this event is raised once per inner content with errors. </p>
示例
ts
tileset.tileFailed.addEventListener(function(error) {
console.log(`An error occurred loading tile: ${error.url}`);
console.log(`Error: ${error.message}`);
});tileVisible
tileVisible:
Event
This event fires once for each visible tile in a frame. This can be used to manually style a tileset. <p> The visible Cesium3DTile is passed to the event listener. </p> <p> 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. </p>
Examples
ts
tileset.tileVisible.addEventListener(function(tile) {
if (tile.content instanceof Cesium.Model3DTileContent) {
console.log('A 3D model tile is visible.');
}
});ts
// 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) {
const content = tile.content;
const featuresLength = content.featuresLength;
for (let i = 0; i < featuresLength; i+=2) {
content.getFeature(i).color = Cesium.Color.fromRandom();
}
});skipLevelOfDetail
skipLevelOfDetail:
boolean
Optimization option. Determines if level of detail skipping should be applied during the traversal. <p> 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. </p>
baseScreenSpaceError
baseScreenSpaceError:
number
The screen space error that must be reached before skipping levels of detail. <p> Only used when Cesium3DTileset#skipLevelOfDetail is <code>true</code>. </p>
skipScreenSpaceErrorFactor
skipScreenSpaceErrorFactor:
number
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 <code><= 100 / skipScreenSpaceErrorFactor</code>. <p> Only used when Cesium3DTileset#skipLevelOfDetail is <code>true</code>. </p>
skipLevels
skipLevels:
number
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. <p> Only used when Cesium3DTileset#skipLevelOfDetail is <code>true</code>. </p>
immediatelyLoadDesiredLevelOfDetail
immediatelyLoadDesiredLevelOfDetail:
boolean
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. <p> Only used when Cesium3DTileset#skipLevelOfDetail is <code>true</code>. </p>
loadSiblings
loadSiblings:
boolean
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. <p> Only used when Cesium3DTileset#skipLevelOfDetail is <code>true</code>. </p>
lightColor
lightColor:
Cartesian3
The light color when shading models. When <code>undefined</code> the scene's light color is used instead. <p> For example, disabling additional light sources by setting <code>tileset.imageBasedLighting.imageBasedLightingFactor = new Cartesian2(0.0, 0.0)</code> will make the tileset much darker. Here, increasing the intensity of the light source will make the tileset brighter. </p>
backFaceCulling
backFaceCulling:
boolean
Whether to cull back-facing geometry. When true, back face culling is determined by the glTF material's doubleSided property; when false, back face culling is disabled.
showOutline
showOutline:
boolean
Whether to display the outline for models using the CESIUM_primitive_outline extension. When true, outlines are displayed. When false, outlines are not displayed.
outlineColor
outlineColor:
Color
The color to use when rendering outlines.
splitDirection
splitDirection:
SplitDirection
The SplitDirection to apply to this tileset.
enableCollision
enableCollision:
boolean
If <code>true</code>, allows collisions for camera collisions or picking. While this is <code>true</code> the camera will be prevented from going in or below the tileset surface if ScreenSpaceCameraController#enableCollisionDetection is true. This can have performance implecations if the tileset contains tile with a larger number of vertices.
debugFreezeFrame
debugFreezeFrame:
boolean
This property is for debugging only; it is not optimized for production use. <p> 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. </p>
debugColorizeTiles
debugColorizeTiles:
boolean
This property is for debugging only; it is not optimized for production use. <p> 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. </p>
debugWireframe
debugWireframe:
boolean
This property is for debugging only; it is not optimized for production use. <p> When true, renders each tile's content as a wireframe. </p>
debugShowBoundingVolume
debugShowBoundingVolume:
boolean
This property is for debugging only; it is not optimized for production use. <p> 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. </p>
debugShowContentBoundingVolume
debugShowContentBoundingVolume:
boolean
This property is for debugging only; it is not optimized for production use. <p> 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. </p>
debugShowViewerRequestVolume
debugShowViewerRequestVolume:
boolean
This property is for debugging only; it is not optimized for production use. <p> When true, renders the viewer request volume for each tile. </p>
debugShowGeometricError
debugShowGeometricError:
boolean
This property is for debugging only; it is not optimized for production use. <p> When true, draws labels to indicate the geometric error of each tile. </p>
debugShowRenderingStatistics
debugShowRenderingStatistics:
boolean
This property is for debugging only; it is not optimized for production use. <p> When true, draws labels to indicate the number of commands, points, triangles and features of each tile. </p>
debugShowMemoryUsage
debugShowMemoryUsage:
boolean
This property is for debugging only; it is not optimized for production use. <p> When true, draws labels to indicate the geometry and texture memory usage of each tile. </p>
debugShowUrl
debugShowUrl:
boolean
This property is for debugging only; it is not optimized for production use. <p> When true, draws labels to indicate the url of each tile. </p>
examineVectorLinesFunction()
examineVectorLinesFunction: (...
params:any[]) =>any
Function for examining vector lines as they are being streamed.
参数
params
...any[]
返回
any
asset
readonlyasset:any
Gets the tileset's asset object property, which contains metadata about the tileset. <p> See the asset schema reference in the 3D Tiles spec for the full set of properties. </p>
extensions
readonlyextensions:any
Gets the tileset's extensions object property.
clippingPlanes
clippingPlanes:
ClippingPlaneCollection
The ClippingPlaneCollection used to selectively disable rendering the tileset.
clippingPolygons
clippingPolygons:
ClippingPolygonCollection
The ClippingPolygonCollection used to selectively disable rendering the tileset.
imageryLayers
readonlyimageryLayers:ImageryLayerCollection
The collection of <code>ImageryLayer</code> objects providing 2D georeferenced image data that will be rendered over the tileset.
The imagery will be draped over glTF, B3DM, PNTS, or GeoJSON tile content.
示例
ts
// Drape Bing Maps Aerial imagery over the tileset
const imageryProvider = await Cesium.createWorldImageryAsync({
style: Cesium.IonWorldImageryStyle.AERIAL,
});
const imageryLayer = new ImageryLayer(imageryProvider);
tileset.imageryLayers.add(imageryLayer);properties
readonlyproperties:any
Gets the tileset's properties dictionary object, which contains metadata about per-feature properties. <p> See the properties schema reference in the 3D Tiles spec for the full set of properties. </p>
示例
ts
console.log(`Maximum building height: ${tileset.properties.height.maximum}`);
console.log(`Minimum building height: ${tileset.properties.height.minimum}`);tilesLoaded
readonlytilesLoaded:boolean
When <code>true</code>, all tiles that meet the screen space error this frame are loaded. The tileset is completely loaded for this view.
resource
readonlyresource:Resource
The resource used to fetch the tileset JSON file
basePath
readonlybasePath:string
The base path that non-absolute paths in tileset JSON file are relative to.
style
style:
Cesium3DTileStyle|undefined
The style, defined using the 3D Tiles Styling language, applied to each feature in the tileset. <p> Assign <code>undefined</code> to remove the style, which will restore the visual appearance of the tileset to its default when no style was applied. </p> <p> The style is applied to a tile before the Cesium3DTileset#tileVisible event is raised, so code in <code>tileVisible</code> 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. </p> <p> Use an always "true" condition to specify the Color for all objects that are not overridden by pre-existing conditions. Otherwise, the default color Cesium.Color.White will be used. Similarly, use an always "true" condition to specify the show property for all objects that are not overridden by pre-existing conditions. Otherwise, the default show value true will be used. </p>
示例
ts
tileset.style = new Cesium.Cesium3DTileStyle({
color : {
conditions : [
['${Height} >= 100', 'color("purple", 0.5)'],
['${Height} >= 50', 'color("red")'],
['true', 'color("blue")']
]
},
show : '${Height} > 0',
meta : {
description : '"Building id ${id} has height ${Height}."'
}
});customShader
customShader:
CustomShader|undefined
A custom shader to apply to all tiles in the tileset. Only used for contents that use Model. Using custom shaders with a Cesium3DTileStyle may lead to undefined behavior.
maximumScreenSpaceError
maximumScreenSpaceError:
number
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. <p> 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 <b>geometric error</b> were rendered at the tile's position. If this value exceeds <code>maximumScreenSpaceError</code> the tile refines to its descendants. </p> <p> Depending on the tileset, <code>maximumScreenSpaceError</code> may need to be tweaked to achieve the right balance. Higher values provide better performance but lower visual quality. </p>
cacheBytes
cacheBytes:
number
The amount of GPU memory (in bytes) used to cache tiles. This memory usage is estimated from geometry, textures, and batch table textures of loaded tiles. For point clouds, this value also includes per-point metadata. <p> Tiles not in view are unloaded to enforce this. </p> <p> If decreasing this value results in unloading tiles, the tiles are unloaded the next frame. </p> <p> If tiles sized more than <code>cacheBytes</code> are needed to meet the desired screen space error, determined by Cesium3DTileset#maximumScreenSpaceError, for the current view, then the memory usage of the tiles loaded will exceed <code>cacheBytes</code> by up to <code>maximumCacheOverflowBytes</code>. For example, if <code>cacheBytes</code> is 500000, but 600000 bytes of tiles are needed to meet the screen space error, then 600000 bytes of tiles may be loaded (if <code>maximumCacheOverflowBytes</code> is at least 100000). When these tiles go out of view, they will be unloaded. </p>
maximumCacheOverflowBytes
maximumCacheOverflowBytes:
number
The maximum additional amount of GPU memory (in bytes) that will be used to cache tiles. <p> If tiles sized more than <code>cacheBytes</code> plus <code>maximumCacheOverflowBytes</code> are needed to meet the desired screen space error, determined by Cesium3DTileset#maximumScreenSpaceError for the current view, then Cesium3DTileset#memoryAdjustedScreenSpaceError will be adjusted until the tiles required to meet the adjusted screen space error use less than <code>cacheBytes</code> plus <code>maximumCacheOverflowBytes</code>. </p>
pointCloudShading
pointCloudShading:
PointCloudShading
Options for controlling point size based on geometric error and eye dome lighting.
root
readonlyroot:Cesium3DTile
The root tile.
boundingSphere
readonlyboundingSphere:BoundingSphere
The tileset's bounding sphere.
示例
ts
const tileset = await Cesium.Cesium3DTileset.fromUrl("http://localhost:8002/tilesets/Seattle/tileset.json");
viewer.scene.primitives.add(tileset);
// Set the camera to view the newly added tileset
viewer.camera.viewBoundingSphere(tileset.boundingSphere, new Cesium.HeadingPitchRange(0, -0.5, 0));modelMatrix
modelMatrix:
Matrix4
A 4x4 transformation matrix that transforms the entire tileset.
示例
ts
// Adjust a tileset's height from the globe's surface.
const heightOffset = 20.0;
const boundingSphere = tileset.boundingSphere;
const cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
const surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
const offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
const translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);timeSinceLoad
readonlytimeSinceLoad:number
Returns the time, in milliseconds, since the tileset was loaded and first updated.
totalMemoryUsageInBytes
readonlytotalMemoryUsageInBytes:number
The total amount of GPU memory in bytes used by the tileset. This value is estimated from geometry, texture, batch table textures, and binary metadata of loaded tiles.
classificationType
readonlyclassificationType:ClassificationType
Determines whether terrain, 3D Tiles, or both will be classified by this tileset. <p> This option is only applied to tilesets containing batched 3D models, glTF content, geometry data, or vector data. Even when undefined, vector and geometry data must render as classifications and will default to rendering on both terrain and other 3D Tiles tilesets. </p> <p> When enabled for batched 3D model and glTF tilesets, there are a few requirements/limitations on the glTF: <ul> <li>The glTF cannot contain morph targets, skins, or animations.</li> <li>The glTF cannot contain the <code>EXT_mesh_gpu_instancing</code> extension.</li> <li>Only meshes with TRIANGLES can be used to classify other assets.</li> <li>The meshes must be watertight.</li> <li>The <code>POSITION</code> semantic is required.</li> <li>If <code>_BATCHID</code>s and an index buffer are both present, all indices with the same batch id must occupy contiguous sections of the index buffer.</li> <li>If <code>_BATCHID</code>s are present with no index buffer, all positions with the same batch id must occupy contiguous sections of the position buffer.</li> </ul> </p> <p> Additionally, classification is not supported for points or instanced 3D models. </p> <p> The 3D Tiles or terrain receiving the classification must be opaque. </p>
heightReference
readonlyheightReference:HeightReference|undefined
Specifies if the height is relative to terrain, 3D Tiles, or both. <p> This option is only applied to point features in tilesets containing vector data. This option requires the Viewer's scene to be passed in through options.scene. </p>
ellipsoid
readonlyellipsoid:Ellipsoid
Gets an ellipsoid describing the shape of the globe.
foveatedConeSize
foveatedConeSize:
number
Optimization option. Used when Cesium3DTileset#foveatedScreenSpaceError is true to control the cone size that determines which tiles are deferred. Tiles that are inside this cone are loaded immediately. Tiles outside the cone are potentially deferred based on how far outside the cone they are and Cesium3DTileset#foveatedInterpolationCallback and Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation. Setting this to 0.0 means the cone will be the line formed by the camera position and its view direction. Setting this to 1.0 means the cone encompasses the entire field of view of the camera, essentially disabling the effect.
foveatedMinimumScreenSpaceErrorRelaxation
foveatedMinimumScreenSpaceErrorRelaxation:
number
Optimization option. Used when Cesium3DTileset#foveatedScreenSpaceError is true to control the starting screen space error relaxation for tiles outside the foveated cone. The screen space error will be raised starting with this value up to Cesium3DTileset#maximumScreenSpaceError based on the provided Cesium3DTileset#foveatedInterpolationCallback.
extras
readonlyextras:any
Returns the <code>extras</code> property at the top-level of the tileset JSON, which contains application specific metadata. Returns <code>undefined</code> if <code>extras</code> does not exist.
imageBasedLighting
imageBasedLighting:
ImageBasedLighting
The properties for managing image-based lighting on this tileset.
environmentMapManager
readonlyenvironmentMapManager:DynamicEnvironmentMapManager
The properties for managing dynamic environment maps on this model. Affects lighting.
示例
ts
// Change the ground color used for a tileset's environment map to a forest green
const environmentMapManager = tileset.environmentMapManager;
environmentMapManager.groundColor = Cesium.Color.fromCssColorString("#203b34");vectorClassificationOnly
vectorClassificationOnly:
boolean
Indicates that only the tileset's vector tiles should be used for classification.
vectorKeepDecodedPositions
vectorKeepDecodedPositions:
boolean
Whether vector tiles should keep decoded positions in memory. This is used with Cesium3DTileFeature.getPolylinePositions.
showCreditsOnScreen
showCreditsOnScreen:
boolean
Determines whether the credits of the tileset will be displayed on the screen
featureIdLabel
featureIdLabel:
string
Label of the feature ID set to use for picking and styling. <p> For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. </p> <p> If featureIdLabel is set to an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. </p>
instanceFeatureIdLabel
instanceFeatureIdLabel:
string
Label of the instance feature ID set used for picking and styling. <p> If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. </p>
方法
fromIonAssetId()
staticfromIonAssetId(assetId:number,options?:ConstructorOptions):Promise<Cesium3DTileset>
Creates a 3D Tiles tileset, used for streaming massive heterogeneous 3D geospatial datasets, from a Cesium ion asset ID.
参数
assetId
number
The Cesium ion asset id.
options?
An object describing initialization options
返回
Promise<Cesium3DTileset>
示例
ts
// Load a Cesium3DTileset with a Cesium ion asset ID of 124624234
try {
const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(124624234);
scene.primitives.add(tileset);
} catch (error) {
console.error(`Error creating tileset: ${error}`);
}fromUrl()
staticfromUrl(url:string|Resource,options?:ConstructorOptions):Promise<Cesium3DTileset>
Creates a 3D Tiles tileset, used for streaming massive heterogeneous 3D geospatial datasets.
参数
url
The url to a tileset JSON file.
string | Resource
options?
An object describing initialization options
返回
Promise<Cesium3DTileset>
Examples
ts
try {
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json"
);
scene.primitives.add(tileset);
} catch (error) {
console.error(`Error creating tileset: ${error}`);
}ts
// Common setting for the skipLevelOfDetail optimization
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json", {
skipLevelOfDetail: true,
baseScreenSpaceError: 1024,
skipScreenSpaceErrorFactor: 16,
skipLevels: 1,
immediatelyLoadDesiredLevelOfDetail: false,
loadSiblings: false,
cullWithChildrenBounds: true
});
scene.primitives.add(tileset);ts
// Common settings for the dynamicScreenSpaceError optimization
const tileset = await Cesium.Cesium3DTileset.fromUrl(
"http://localhost:8002/tilesets/Seattle/tileset.json", {
dynamicScreenSpaceError: true,
dynamicScreenSpaceErrorDensity: 2.0e-4,
dynamicScreenSpaceErrorFactor: 24.0,
dynamicScreenSpaceErrorHeightFalloff: 0.25
});
scene.primitives.add(tileset);loadJson()
staticloadJson(tilesetUrl:string|Resource):Promise<object>
Provides a hook to override the method used to request the tileset json useful when fetching tilesets from remote servers
参数
tilesetUrl
The url of the json file to be fetched
string | Resource
返回
Promise<object>
A promise that resolves with the fetched json data
makeStyleDirty()
makeStyleDirty():
void
Marks the tileset's Cesium3DTileset#style as dirty, which forces all features to re-evaluate the style in the next frame each is visible.
返回
void
trimLoadedTiles()
trimLoadedTiles():
void
Unloads all tiles that weren't selected the previous frame. This can be used to explicitly manage the tile cache and reduce the total number of tiles loaded below Cesium3DTileset#cacheBytes. <p> Tile unloads occur at the next frame to keep all the WebGL delete calls within the render loop. </p>
返回
void
hasExtension()
hasExtension(
extensionName:string):boolean
<code>true</code> if the tileset JSON file lists the extension in extensionsUsed; otherwise, <code>false</code>.
参数
extensionName
string
The name of the extension to check.
返回
boolean
true if the tileset JSON file lists the extension in extensionsUsed; otherwise, false.
isDestroyed()
isDestroyed():
boolean
Returns true if this object was destroyed; otherwise, false. <br /><br /> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception.
返回
boolean
true if this object was destroyed; otherwise, false.
destroy()
destroy():
void
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object. <br /><br /> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example.
返回
void
示例
ts
tileset = tileset && tileset.destroy();getHeight()
getHeight(
cartographic:Cartographic,scene:Scene):number|undefined
Get the height of the loaded surface at a given cartographic. This function will only take into account meshes for loaded tiles, not neccisarily the most detailed tiles available for a tileset. This function will always return undefined when sampling a point cloud.
参数
cartographic
The cartographic for which to find the height.
scene
The scene where visualization is taking place.
返回
number | undefined
The height of the cartographic or undefined if it could not be found.
示例
ts
const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(124624234);
scene.primitives.add(tileset);
const height = tileset.getHeight(scene.camera.positionCartographic, scene);构造函数
构造函数
new Cesium3DTileset(
options:ConstructorOptions):Cesium3DTileset
参数
options
返回
Cesium3DTileset
