Cesium3DTileset.fromUrl。
| Name | Type | Description |
|---|---|---|
options |
Cesium3DTileset.ConstructorOptions | 描述初始化选项的对象。 |
Throws:
-
DeveloperError :tileset 必须是 3D Tiles 0.0 或 1.0 版本。
Examples:
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}`);
}
// 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}`);
}
// 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);
// 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);
Experimental
Support for loading Gaussian splats content encoded with SPZ compression using the draft glTF extensions KHR_gaussian_splatting and KHR_gaussian_splatting_compression_spz_2 is experimental and is subject change without Cesium's standard deprecation policy.
See:
Members
allTilesLoaded : Event
此事件在场景渲染完成后的帧末尾触发。
-
Default Value:
new Event()
Example:
tileset.allTilesLoaded.addEventListener(function() {
console.log('All tiles are loaded');
});
See:
有关完整属性集,请参见 3D Tiles 规范中的 asset schema reference。
-
Default Value:
true
Deprecated: true
仅当 Cesium3DTileset#skipLevelOfDetail 为 true 时使用。
-
Default Value:
1024
readonly boundingSphere : BoundingSphere
Example:
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));
不在视图中的瓦片会被卸载以强制执行此限制。
如果减小此值导致卸载瓦片,则瓦片会在下一帧卸载。
如果为了满足当前视图所需的屏幕空间误差(由 Cesium3DTileset#maximumScreenSpaceError 决定)而需要大于 cacheBytes 的瓦片,则已加载瓦片的内存使用量最多会超出 cacheBytes 达 maximumCacheOverflowBytes。例如,如果 cacheBytes 为 500000,但需要 600000 字节的瓦片来满足屏幕空间误差,则可能会加载 600000 字节的瓦片(如果 maximumCacheOverflowBytes 至少为 100000)。当这些瓦片移出视图时,它们将被卸载。
-
Default Value:
536870912
See:
readonly classificationType : ClassificationType
此选项仅适用于包含批量 3D 模型、glTF 内容、几何数据或矢量数据的 tilesets。即使未定义,矢量和几何数据也必须作为分类渲染,并默认在地形和其他 3D Tiles tilesets 上渲染。
当对批量 3D 模型和 glTF tilesets 启用时,glTF 有一些要求/限制:
- glTF 不能包含变形目标、骨骼或动画。
- glTF 不能包含
EXT_mesh_gpu_instancing扩展。 - 只有包含 TRIANGLES 的网格可用于对其他资源进行分类。
- 网格必须是水密的。
- 需要
POSITION语义。 - 如果同时存在
_BATCHID和索引缓冲区,则具有相同 batch id 的所有索引必须占据索引缓冲区的连续区段。 - 如果存在
_BATCHID但没有索引缓冲区,则具有相同 batch id 的所有位置必须占据位置缓冲区的连续区段。
Additionally, classification is not supported for points or instanced 3D models.
The 3D Tiles or terrain receiving the classification must be opaque.
-
Default Value:
undefined
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
clippingPlanes : ClippingPlaneCollection
ClippingPlaneCollection。
clippingPolygons : ClippingPolygonCollection
ClippingPolygonCollection。
Cesium3DTileset#colorBlendMode 为 MIX 时,在源颜色和要素颜色之间线性插值的数值。值为 0.0 时得到源颜色,值为 1.0 时得到要素颜色,介于两者之间的任何值会得到源颜色和要素颜色的混合。
-
Default Value:
0.5
colorBlendMode : Cesium3DTileColorBlendMode
-
Default Value:
Cesium3DTileColorBlendMode.HIGHLIGHT
-
Default Value:
true
-
Default Value:
60.0
customShader : CustomShader|undefined
Model 的内容。将自定义着色器与 Cesium3DTileStyle 一起使用可能会导致未定义的行为。
-
Default Value:
undefined
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
当为 true 时,为每个瓦片分配一个随机颜色。这有助于可视化哪些要素属于哪些瓦片,特别是在附加细化(additive refinement)中,来自父瓦片的要素可能会与来自子瓦片的要素交错在一起。
-
Default Value:
false
确定是否仅使用上一帧的瓦片进行渲染。这实际上将 tileset“冻结”到上一帧,从而可以缩小并查看已渲染的内容。
-
Default Value:
false
当为 true 时,渲染每个可见瓦片的包围体。如果瓦片具有内容包围体或为空,则包围体为白色;否则为红色。未达到屏幕空间误差且仍在向后代细化的瓦片为黄色。
-
Default Value:
false
当为 true 时,渲染每个可见瓦片内容的包围体。如果瓦片具有内容包围体,则包围体为蓝色;否则为红色。
-
Default Value:
false
当为 true 时,绘制标签以指示每个瓦片的几何误差。
-
Default Value:
false
当为 true 时,绘制标签以指示每个瓦片的几何和纹理内存使用量。
-
Default Value:
false
当为 true 时,绘制标签以指示每个瓦片的命令数、点数、三角形数和要素数。
-
Default Value:
false
当为 true 时,绘制标签以指示每个瓦片的 url。
-
Default Value:
false
当为 true 时,渲染每个瓦片的查看器请求体。
-
Default Value:
false
当为 true 时,将每个瓦片的内容渲染为线框。
-
Default Value:
false
当相机靠近 tileset 的地平面并看向视平线时,此优化效果最强。此外,对于像 box 和 region 这样紧密贴合的包围体,结果更准确。
-
Default Value:
true
Fog#density,此选项控制 Cesium3DTileset#dynamicScreenSpaceError 优化生效的相机距离。值越大,距离相机越近的瓦片会受到影响。此值必须非负。
此优化通过像钟形曲线一样随相机距离衰减瓦片屏幕空间误差(SSE)来工作。其效果是选择距离相机较远的较低分辨率瓦片。在相机附近不进行任何调整。对于较远的瓦片,SSE 最多减少 Cesium3DTileset#dynamicScreenSpaceErrorFactor(以误差像素为单位)。
增大密度会使钟形曲线变窄,从而使距离相机较近的瓦片受到影响。这类似于将雾移近相机。
当密度为 0 时,该优化对 tileset 不起作用。
-
Default Value:
2.0e-4
Cesium3DTileset#dynamicScreenSpaceError 优化强度的参数。值越大,加载的分辨率越低的瓦片,以略微降低视觉质量为代价来提高运行时性能。该值必须非负。
更具体地说,此参数表示对距离相机较远的瓦片的屏幕空间误差(SSE)的最大调整量(以像素为单位)。有关此优化如何工作的更多详细信息,请参见 Cesium3DTileset#dynamicScreenSpaceErrorDensity。
当 SSE 因子设置为 0 时,该优化对 tileset 不起作用。
-
Default Value:
24.0
Cesium3DTileset#dynamicScreenSpaceError 优化的“街道级别”。当相机低于此高度时,动态屏幕空间误差优化将产生最大效果,高于此值时效果会衰减。有效值在 0.0 到 1.0 之间。
-
Default Value:
0.25
edgeDisplayMode : EdgeDisplayMode
-
Default Value:
EdgeDisplayMode.SURFACES_ONLY
Experimental
This feature is using part of the glTF spec that is not yet final and is subject to change without Cesium's standard deprecation policy.
readonly ellipsoid : Ellipsoid
true,则允许相机碰撞或拾取的碰撞检测。当此值为 true 时,如果 ScreenSpaceCameraController#enableCollisionDetection 为 true,相机将被阻止进入或低于 tileset 表面。如果 tileset 包含顶点数较多的瓦片,这可能会对性能产生影响。
-
Default Value:
false
readonly environmentMapManager : DynamicEnvironmentMapManager
Example:
// 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");
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
extras 属性,其中包含特定于应用程序的元数据。如果 extras 不存在,则返回 undefined。
对于 EXT_mesh_features,这是要素 ID 的 label 属性;如果未指定,则为 "featureId_N"(其中 N 是 featureIds 数组中的索引)。EXT_feature_metadata 没有 label 字段,因此此类要素 ID 集合始终标记为 "featureId_N",其中 N 是所有要素 ID 列表中的索引,要素 ID 属性列在要素 ID 纹理之前。
如果 featureIdLabel 设置为整数 N,它会自动转换为字符串 "featureId_N"。如果同时存在逐基元和逐实例要素 ID,则实例要素 ID 优先。
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用于控制确定哪些瓦片被延迟的锥体大小。位于此锥体内部的瓦片会立即加载。位于锥体外部的瓦片会根据它们超出锥体的程度以及 Cesium3DTileset#foveatedInterpolationCallback 和 Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation 被延迟。将此值设置为 0.0 表示锥体将是由相机位置和其视图方向形成的直线。将此值设置为 1.0 表示锥体涵盖相机的整个视野,实质上禁用了该效果。
-
Default Value:
0.3
foveatedInterpolationCallback : Cesium3DTileset.foveatedInterpolationCallback
Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation 和 Cesium3DTileset#maximumScreenSpaceError 之间进行插值。
Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用于控制注视点锥体外部瓦片的起始屏幕空间误差松弛。屏幕空间误差将从该值开始,根据提供的 Cesium3DTileset#foveatedInterpolationCallback 提高到 Cesium3DTileset#maximumScreenSpaceError。
-
Default Value:
0.0
Cesium3DTileset#foveatedConeSize 确定的屏幕中央的所有瓦片加载完成,屏幕空间误差将恢复正常。
-
Default Value:
true
Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用于控制相机停止移动后,延迟瓦片开始加载之前等待的秒数。此时间延迟可防止在相机移动时请求屏幕边缘周围的瓦片。将此值设置为 0.0 将立即请求任何给定视图中的所有瓦片。
-
Default Value:
0.2
readonly heightReference : HeightReference|undefined
此选项仅适用于包含矢量数据的 tilesets 中的点要素。此选项需要通过 options.scene 传入 Viewer 的 scene。
-
Default Value:
undefined
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
imageBasedLighting : ImageBasedLighting
readonly imageryLayers : ImageryLayerCollection
ImageryLayer 对象集合。
影像将覆盖在 glTF、B3DM、PNTS 或 GeoJSON 瓦片内容之上。
Example:
// 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);
Experimental
This feature is not final and is subject to change without Cesium's standard deprecation policy.
See:
仅当 Cesium3DTileset#skipLevelOfDetail 为 true 时使用。
-
Default Value:
false
initialTilesLoaded : Event
此事件在场景渲染完成后的帧末尾触发。
-
Default Value:
new Event()
Example:
tileset.initialTilesLoaded.addEventListener(function() {
console.log('Initial tiles are loaded');
});
See:
如果 instanceFeatureIdLabel 设置为整数 N,它会自动转换为字符串 "instanceFeatureId_N"。如果同时存在逐基元和逐实例要素 ID,则实例要素 ID 优先。
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
lightColor : Cartesian3
undefined 时,将改用场景的光照颜色。
例如,通过将 tileset.imageBasedLighting.imageBasedLightingFactor = new Cartesian2(0.0, 0.0) 禁用附加光源会使 tileset 变暗很多。此时,提高光源强度会使 tileset 更亮。
-
Default Value:
undefined
loadProgress : Event
待处理的瓦片请求数 numberOfPendingRequests 和正在处理的瓦片数 numberOfTilesProcessing 会传递给事件监听器。
此事件在场景渲染完成后的帧末尾触发。
-
Default Value:
new Event()
Example:
tileset.loadProgress.addEventListener(function(numberOfPendingRequests, numberOfTilesProcessing) {
if ((numberOfPendingRequests === 0) && (numberOfTilesProcessing === 0)) {
console.log('Stopped loading');
return;
}
console.log(`Loading: requests: ${numberOfPendingRequests}, processing: ${numberOfTilesProcessing}`);
});
仅当 Cesium3DTileset#skipLevelOfDetail 为 true 时使用。
-
Default Value:
false
如果为了满足当前视图所需的屏幕空间误差(由 Cesium3DTileset#maximumScreenSpaceError 决定)而需要大于 cacheBytes 加 maximumCacheOverflowBytes 的瓦片,则 Cesium3DTileset#memoryAdjustedScreenSpaceError 会被调整,直到满足调整后屏幕空间误差所需的瓦片使用的内存少于 cacheBytes 加 maximumCacheOverflowBytes。
-
Default Value:
536870912
See:
瓦片的屏幕空间误差大致相当于:如果在瓦片位置渲染一个半径等于瓦片 几何误差 的球体,将会绘制出的像素宽度。如果此值超过 maximumScreenSpaceError,瓦片将细化到其后代。
根据 tileset 的不同,可能需要调整 maximumScreenSpaceError 以达到适当的平衡。值越大性能越好,但视觉质量越低。
-
Default Value:
16
modelMatrix : Matrix4
-
Default Value:
Matrix4.IDENTITY
Example:
// 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);
outlineColor : Color
-
Default Value:
Color.BLACK
pointCloudShading : PointCloudShading
-
Default Value:
false
-
Default Value:
true
tileset.show 为 false 时预加载瓦片。以 tileset 可见的方式加载瓦片,但不渲染它们。
-
Default Value:
false
progressiveResolutionHeightFraction*screenHeight 降低的屏幕分辨率的屏幕空间误差的瓦片。这有助于在完整分辨率瓦片继续加载的同时快速获取一层瓦片。
-
Default Value:
0.3
有关完整属性集,请参见 3D Tiles 规范中的 properties schema reference。
Example:
console.log(`Maximum building height: ${tileset.properties.height.maximum}`);
console.log(`Minimum building height: ${tileset.properties.height.minimum}`);
See:
readonly resource : Resource
readonly root : Cesium3DTile
readonly scene : Scene|undefined
CesiumWidget#scene,对于指定了 heightReference 值以将 3D Tiles 矢量数据内容(如点、线和标签)贴合到地形或 3D Tiles 的 tilesets 是必需的。
-
Default Value:
undefined
启用阴影会影响性能。投射阴影的 tileset 必须渲染两次,一次从相机视角,一次从光源视角。
仅当 Viewer#shadows 为 true 时才会渲染阴影。
-
Default Value:
ShadowMode.ENABLED
-
Default Value:
true
-
Default Value:
false
-
Default Value:
true
替换细化(replacement-refinement)遍历的常用策略是将树的所有层级存储在内存中,并要求在父节点可以细化之前加载所有子节点。使用此优化后,树的层级可以完全跳过,子节点可以与其父节点一起渲染。使用此优化时,tileset 所需的内存显著减少。
-
Default Value:
false
仅当 Cesium3DTileset#skipLevelOfDetail 为 true 时使用。
-
Default Value:
1
<= 100 / skipScreenSpaceErrorFactor。
仅当 Cesium3DTileset#skipLevelOfDetail 为 true 时使用。
-
Default Value:
16
splitDirection : SplitDirection
SplitDirection。
-
Default Value:
SplitDirection.NONE
style : Cesium3DTileStyle|undefined
赋值 undefined 可移除样式,这会将 tileset 的外观恢复到未应用样式时的默认状态。
样式在 Cesium3DTileset#tileVisible 事件触发之前应用于瓦片,因此 tileVisible 中的代码可以在样式应用后手动设置要素的属性(例如颜色和显示)。当分配新样式时,任何手动设置的属性都会被覆盖。
使用始终为 "true" 的条件来为所有未被既有条件覆盖的对象指定颜色。否则将使用默认颜色 Cesium.Color.White。类似地,使用始终为 "true" 的条件来为所有未被既有条件覆盖的对象指定 show 属性。否则将使用默认的 show 值 true。
-
Default Value:
undefined
Example:
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}."'
}
});
See:
tileFailed : Event
如果没有事件监听器,错误消息将被记录到控制台。
传递给监听器的错误对象包含两个属性:
url:失败瓦片的 url。message:错误消息。
If multiple contents are present, this event is raised once per inner content with errors.
-
Default Value:
new Event()
Example:
tileset.tileFailed.addEventListener(function(error) {
console.log(`An error occurred loading tile: ${error.url}`);
console.log(`Error: ${error.message}`);
});
tileLoad : Event
已加载的 Cesium3DTile 会被传递给事件监听器。
此事件在 tileset 遍历期间、帧正在渲染时触发,以便对瓦片的更新在同一帧中生效。请勿在事件监听器中创建或修改 Cesium 实体或图元。
-
Default Value:
new Event()
Example:
tileset.tileLoad.addEventListener(function(tile) {
console.log('A tile was loaded.');
});
true 时,本帧中所有达到屏幕空间误差的瓦片都已加载。对于此视图,tileset 已完全加载。
-
Default Value:
false
See:
tileUnload : Event
被卸载的 Cesium3DTile 会被传递给事件监听器。
此事件在瓦片内容即将被卸载时、帧正在渲染期间触发,以便事件监听器可以访问瓦片的内容。请勿在事件监听器中创建或修改 Cesium 实体或图元。
-
Default Value:
new Event()
Example:
tileset.tileUnload.addEventListener(function(tile) {
console.log('A tile was unloaded from the cache.');
});
See:
tileVisible : Event
可见的 Cesium3DTile 会被传递给事件监听器。
此事件在 tileset 遍历期间、帧正在渲染时触发,以便对瓦片的更新在同一帧中生效。请勿在事件监听器中创建或修改 Cesium 实体或图元。
-
Default Value:
new Event()
Examples:
tileset.tileVisible.addEventListener(function(tile) {
if (tile.content instanceof Cesium.Model3DTileContent) {
console.log('A 3D model tile is visible.');
}
});
// 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();
}
});
-
Default Value:
false
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
Cesium3DTileFeature.getPolylinePositions 一起使用。
-
Default Value:
false
Experimental
This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
Methods
static Cesium.Cesium3DTileset.fromIonAssetId(assetId, options) → Promise.<Cesium3DTileset>
| Name | Type | Description |
|---|---|---|
assetId |
number | Cesium ion 资源 id。 |
options |
Cesium3DTileset.ConstructorOptions | optional 描述初始化选项的对象。 |
Returns:
Throws:
-
RuntimeError :当 tileset 资源版本不是 0.0、1.0 或 1.1,或者当 tileset 包含不受支持的可选扩展时。
- Cesium3DTileset#fromUrl
Example:
// 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}`);
}
See:
static Cesium.Cesium3DTileset.fromUrl(url, options) → Promise.<Cesium3DTileset>
| Name | Type | Description |
|---|---|---|
url |
Resource | string | tileset JSON 文件的 url。 |
options |
Cesium3DTileset.ConstructorOptions | optional 描述初始化选项的对象。 |
Returns:
Throws:
-
RuntimeError :当 tileset 资源版本不是 0.0、1.0 或 1.1,或者当 tileset 包含不受支持的可选扩展时。
- Cesium3DTileset#fromIonAssetId
Examples:
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}`);
}
// 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);
// 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);
See:
| Name | Type | Description |
|---|---|---|
tilesetUrl |
Resource | string | 要获取的 json 文件的 url。 |
Returns:
一旦对象被销毁,就不应再使用它;调用除
isDestroyed 以外的任何函数都会导致 DeveloperError 异常。因此,应像示例中那样将返回值(undefined)赋给该对象。
Throws:
-
DeveloperError :此对象已被销毁,即已调用 destroy()。
Example:
tileset = tileset && tileset.destroy();
See:
| Name | Type | Description |
|---|---|---|
cartographic |
Cartographic | 要查找高度的经纬度。 |
scene |
Scene | 进行可视化的 scene。 |
Returns:
Example:
const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(124624234);
scene.primitives.add(tileset);
const height = tileset.getHeight(scene.camera.positionCartographic, scene);
true;否则为 false。
| Name | Type | Description |
|---|---|---|
extensionName |
string | 要检查的扩展的名称。 |
Returns:
true;否则为 false。
Returns:
true;否则为 false。
Cesium3DTileset#style 标记为脏,从而强制所有要素在其下一次可见的帧中重新评估样式。
Cesium3DTileset#cacheBytes 以下。
瓦片卸载发生在下一帧,以将所有 WebGL 删除调用保持在渲染循环内。
Type Definitions
Properties:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
show |
boolean |
<optional> |
true | 确定 tileset 是否会显示。 |
modelMatrix |
Matrix4 |
<optional> |
Matrix4.IDENTITY | 变换 tileset 根瓦片的 4x4 变换矩阵。 |
modelUpAxis |
Axis |
<optional> |
Axis.Y | 加载瓦片内容的模型时,哪个轴被视为上方向。 |
modelForwardAxis |
Axis |
<optional> |
Axis.X | 加载瓦片内容的模型时,哪个轴被视为前方向。 |
shadows |
ShadowMode |
<optional> |
ShadowMode.ENABLED | 确定 tileset 是否投射或接收来自光源的阴影。 |
maximumScreenSpaceError |
number |
<optional> |
16 | 用于驱动细节层次细化的最大屏幕空间误差。 |
cacheBytes |
number |
<optional> |
536870912 | 如果缓存中包含当前视图不需要的瓦片,则瓦片缓存将被修剪到的尺寸(以字节为单位)。 |
maximumCacheOverflowBytes |
number |
<optional> |
536870912 | 如果当前视图需要超过 Cesium3DTileset#cacheBytes 的内存,则允许用于缓存余量的额外最大内存(以字节为单位)。 |
cullWithChildrenBounds |
boolean |
<optional> |
true | 优化选项。是否使用其子节点包围体的并集来剔除瓦片。 |
cullRequestsWhileMoving |
boolean |
<optional> |
true | 优化选项。不要请求那些由于相机移动而在返回时很可能不会被使用的瓦片。此优化仅适用于静止的 tilesets。 |
cullRequestsWhileMovingMultiplier |
number |
<optional> |
60.0 | 优化选项。在移动时进行剔除请求所用的乘数。值越大剔除越激进,值越小剔除越保守。 |
preloadWhenHidden |
boolean |
<optional> |
false | 当 tileset.show 为 false 时预加载瓦片。以 tileset 可见的方式加载瓦片,但不渲染它们。 |
preloadFlightDestinations |
boolean |
<optional> |
true | 优化选项。在相机飞行过程中,在其飞行目的地预加载瓦片。 |
preferLeaves |
boolean |
<optional> |
false | 优化选项。优先加载叶节点。 |
dynamicScreenSpaceError |
boolean |
<optional> |
true | 优化选项。对于街道级别的视平线视图,使用距离相机较远的较低分辨率瓦片。这减少了加载的数据量,并改善了 tileset 加载时间,但远处视觉质量略有下降。 |
dynamicScreenSpaceErrorDensity |
number |
<optional> |
2.0e-4 | 类似于 Fog#density,此选项控制 Cesium3DTileset#dynamicScreenSpaceError 优化生效的相机距离。值越大,距离相机越近的瓦片会受到影响。 |
dynamicScreenSpaceErrorFactor |
number |
<optional> |
24.0 | 一个控制位于视平线上的瓦片的 Cesium3DTileset#dynamicScreenSpaceError 优化强度的参数。值越大,加载的分辨率越低的瓦片,以略微降低视觉质量为代价来提高运行时性能。 |
dynamicScreenSpaceErrorHeightFalloff |
number |
<optional> |
0.25 | tileset 高度的一个比例,用于确定“街道级别”相机视图出现的位置。当相机低于此高度时,Cesium3DTileset#dynamicScreenSpaceError 优化将产生最大效果,高于此值时效果会衰减。 |
progressiveResolutionHeightFraction |
number |
<optional> |
0.3 | 优化选项。如果在 (0.0, 0.5] 之间,则优先加载达到或高于 progressiveResolutionHeightFraction*screenHeight 降低的屏幕分辨率的屏幕空间误差的瓦片。这有助于在完整分辨率瓦片继续加载的同时快速获取一层瓦片。 |
foveatedScreenSpaceError |
boolean |
<optional> |
true | 优化选项。通过临时提高屏幕边缘周围瓦片的屏幕空间误差,优先加载屏幕中央的瓦片。一旦由 Cesium3DTileset#foveatedConeSize 确定的屏幕中央的所有瓦片加载完成,屏幕空间误差将恢复正常。 |
foveatedConeSize |
number |
<optional> |
0.1 | 优化选项。当 Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用于控制确定哪些瓦片被延迟的锥体大小。位于此锥体内部的瓦片会立即加载。位于锥体外部的瓦片会根据它们超出锥体的程度及其屏幕空间误差被延迟。这由 Cesium3DTileset#foveatedInterpolationCallback 和 Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation 控制。将此值设置为 0.0 表示锥体将是由相机位置和其视图方向形成的直线。将此值设置为 1.0 表示锥体涵盖相机的整个视野,实质上禁用了该效果。 |
foveatedMinimumScreenSpaceErrorRelaxation |
number |
<optional> |
0.0 | 优化选项。当 Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用于控制注视点锥体外部瓦片的起始屏幕空间误差松弛。屏幕空间误差将从 tileset 的值开始,根据提供的 Cesium3DTileset#foveatedInterpolationCallback 提高到 Cesium3DTileset#maximumScreenSpaceError。 |
foveatedInterpolationCallback |
Cesium3DTileset.foveatedInterpolationCallback |
<optional> |
Math.lerp | 优化选项。当 Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用于控制对注视点锥体外部瓦片的屏幕空间误差提高多少,在 Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation 和 Cesium3DTileset#maximumScreenSpaceError 之间进行插值 |
foveatedTimeDelay |
number |
<optional> |
0.2 | 优化选项。当 Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用于控制相机停止移动后,延迟瓦片开始加载之前等待的秒数。此时间延迟可防止在相机移动时请求屏幕边缘周围的瓦片。将此值设置为 0.0 将立即请求任何给定视图中的所有瓦片。 |
skipLevelOfDetail |
boolean |
<optional> |
false | 优化选项。确定在遍历过程中是否应用细节层次跳过。 |
baseScreenSpaceError |
number |
<optional> |
1024 | 当 skipLevelOfDetail 为 true 时,在跳过细节层次之前必须达到的屏幕空间误差。 |
skipScreenSpaceErrorFactor |
number |
<optional> |
16 | 当 skipLevelOfDetail 为 true 时,定义要跳过的最小屏幕空间误差的乘数。与 skipLevels 结合使用以确定要加载哪些瓦片。 |
skipLevels |
number |
<optional> |
1 | 当 skipLevelOfDetail 为 true 时,定义加载瓦片时要跳过的最小层级数的常量。当它为 0 时,不跳过任何层级。与 skipScreenSpaceErrorFactor 结合使用以确定要加载哪些瓦片。 |
immediatelyLoadDesiredLevelOfDetail |
boolean |
<optional> |
false | 当 skipLevelOfDetail 为 true 时,只会下载达到最大屏幕空间误差的瓦片。跳过因子被忽略,仅加载所需的瓦片。 |
loadSiblings |
boolean |
<optional> |
false | 当 skipLevelOfDetail 为 true 时,确定在遍历过程中是否始终下载可见瓦片的同级瓦片。 |
clippingPlanes |
ClippingPlaneCollection |
<optional> |
用于选择性禁用 tileset 渲染的 ClippingPlaneCollection。 |
|
clippingPolygons |
ClippingPolygonCollection |
<optional> |
用于选择性禁用 tileset 渲染的 ClippingPolygonCollection。 |
|
classificationType |
ClassificationType |
<optional> |
确定地形、3D Tiles 或两者是否将由该 tileset 进行分类。有关限制和局限性的详细信息,请参见 Cesium3DTileset#classificationType。 |
|
heightReference |
HeightReference |
<optional> |
为矢量 tilesets 中的点要素设置 HeightReference。 |
|
scene |
Scene |
<optional> |
tileset 将在其中渲染的 CesiumWidget#scene,对于指定了 heightReference 值以将 3D Tiles 矢量数据内容(如点、线和标签)贴合到地形或 3D Tiles 的 tilesets 是必需的。 |
|
ellipsoid |
Ellipsoid |
<optional> |
Ellipsoid.WGS84 | 确定地球大小和形状的椭球体。 |
pointCloudShading |
object |
<optional> |
用于构造 PointCloudShading 对象的选项,以基于几何误差和光照控制点的衰减。 |
|
lightColor |
Cartesian3 |
<optional> |
对模型着色时的光照颜色。当为 undefined 时,将改用场景的光照颜色。 |
|
imageBasedLighting |
ImageBasedLighting |
<optional> |
用于管理此 tileset 上基于图像的照明的属性。 | |
environmentMapOptions |
DynamicEnvironmentMapManager.ConstructorOptions |
<optional> |
用于管理此 tileset 上动态环境贴图的属性。 | |
backFaceCulling |
boolean |
<optional> |
true | 是否剔除背面几何。当为 true 时,背面剔除由 glTF 材质的 doubleSided 属性决定;当为 false 时,背面剔除被禁用。 |
enableShowOutline |
boolean |
<optional> |
true | 是否对使用 CESIUM_primitive_outline 扩展的模型启用轮廓。可以将其设置为 false 以避免在加载时对几何进行额外的处理。当为 false 时,showOutlines 和 outlineColor 选项将被忽略。 |
showOutline |
boolean |
<optional> |
true | 是否显示使用 CESIUM_primitive_outline 扩展的模型的轮廓。当为 true 时显示轮廓,当为 false 时不显示轮廓。 |
outlineColor |
Color |
<optional> |
Color.BLACK | 渲染轮廓时使用的颜色。 |
vectorClassificationOnly |
boolean |
<optional> |
false | 指示仅应使用 tileset 的矢量瓦片进行分类。 |
vectorKeepDecodedPositions |
boolean |
<optional> |
false | 矢量瓦片是否应在内存中保留已解码的位置。这与 Cesium3DTileFeature.getPolylinePositions 一起使用。 |
featureIdLabel |
string | number |
<optional> |
"featureId_0" | 用于拾取和样式设置的要素 ID 集合的标签。对于 EXT_mesh_features,这是要素 ID 的 label 属性;如果未指定,则为 "featureId_N"(其中 N 是 featureIds 数组中的索引)。EXT_feature_metadata 没有 label 字段,因此此类要素 ID 集合始终标记为 "featureId_N",其中 N 是所有要素 ID 列表中的索引,要素 ID 属性列在要素 ID 纹理之前。如果 featureIdLabel 设置为整数 N,它会自动转换为字符串 "featureId_N"。如果同时存在逐基元和逐实例要素 ID,则实例要素 ID 优先。 |
instanceFeatureIdLabel |
string | number |
<optional> |
"instanceFeatureId_0" | 用于拾取和样式设置的实例要素 ID 集合的标签。如果 instanceFeatureIdLabel 设置为整数 N,它会自动转换为字符串 "instanceFeatureId_N"。如果同时存在逐基元和逐实例要素 ID,则实例要素 ID 优先。 |
showCreditsOnScreen |
boolean |
<optional> |
false | 是否在屏幕上显示此 tileset 的署名。 |
splitDirection |
SplitDirection |
<optional> |
SplitDirection.NONE | 应用于此 tileset 的 SplitDirection 分割。 |
enableCollision |
boolean |
<optional> |
false | 当为 true 时,启用相机或 CPU 拾取的碰撞检测。当此值为 true 时,如果 ScreenSpaceCameraController#enableCollisionDetection 为 true,相机将被阻止进入 tileset 表面以下。这还会影响将对象贴合到 3D Tiles 表面时 HeightReference.CLAMP_TO_GROUND 的行为。如果 enableCollision 为 false,实体可能无法正确贴合到 tileset 几何上。 |
projectTo2D |
boolean |
<optional> |
false | 是否将 tileset 精确投影到 2D。如果为 true,tileset 将被精确投影到 2D,但会使用更多内存。如果为 false,tileset 将使用更少的内存,并且仍会在 2D / CV 模式下渲染,但其投影位置可能不准确。这不能在 tileset 创建后设置。 |
enablePick |
boolean |
<optional> |
false | 在使用 WebGL 1 时是否允许通过 pick 进行碰撞和 CPU 拾取。如果使用 WebGL 2 或更高版本,此选项将被忽略。如果使用 WebGL 1 且此选项为 true,则 pick 操作将正常工作,但会使用更多内存。如果使用 WebGL 1 且此选项为 false,模型将使用更少的内存,但 pick 将始终返回 undefined。这不能在 tileset 加载后设置。 |
asynchronouslyLoadImagery |
boolean |
<optional> |
false | 覆盖在 tileset 上的影像的加载是否应异步进行。如果为 true,则瓦片内容将在其原始纹理下显示,直到影像纹理加载完成。如果为 false,则在影像准备就绪之前不会显示瓦片内容。 |
debugHeatmapTilePropertyName |
string |
<optional> |
要作为热力图着色的瓦片变量。所有渲染的瓦片将相对于彼此指定的变量值进行着色。 | |
debugFreezeFrame |
boolean |
<optional> |
false | 仅用于调试。确定是否仅使用上一帧的瓦片进行渲染。 |
debugColorizeTiles |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,为每个瓦片分配一个随机颜色。 |
enableDebugWireframe |
boolean |
<optional> |
false | 仅用于调试。要使 debugWireframe 在 WebGL1 中生效,此值必须为 true。这不能在 tileset 创建后设置。 |
debugWireframe |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,将每个瓦片的内容渲染为线框。 |
edgeDisplayMode |
EdgeDisplayMode |
<optional> |
EdgeDisplayMode.SURFACES_ONLY | 控制来自 EXT_mesh_primitive_edge_visibility glTF 扩展的边相对于表面几何的渲染方式。 |
debugShowBoundingVolume |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,渲染每个瓦片的包围体。 |
debugShowContentBoundingVolume |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,渲染每个瓦片内容的包围体。 |
debugShowViewerRequestVolume |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,渲染每个瓦片的查看器请求体。 |
debugShowGeometricError |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,绘制标签以指示每个瓦片的几何误差。 |
debugShowRenderingStatistics |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,绘制标签以指示每个瓦片的命令数、点数、三角形数和要素数。 |
debugShowMemoryUsage |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,绘制标签以指示每个瓦片使用的纹理和几何内存(以兆字节为单位)。 |
debugShowUrl |
boolean |
<optional> |
false | 仅用于调试。当为 true 时,绘制标签以指示每个瓦片的 url。 |
Cesium3DTileset#foveatedScreenSpaceError 为 true 时,用作回调以控制对注视点锥体外部瓦片的屏幕空间误差提高多少,
在 Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation 和 Cesium3DTileset#maximumScreenSpaceError 之间进行插值。
| Name | Type | Description |
|---|---|---|
p |
number | 要插值的起始值。 |
q |
number | 要插值的结束值。 |
time |
number |
插值的时间,通常在 [0.0, 1.0] 范围内。 |
Returns:
-
Default Value:
Math.lerp
