Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | 具有以下属性的对象:
|
Throws:
-
DeveloperError :平铺集必须是3D平铺版本0.0或1.0。
Examples:
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url : 'http://localhost:8002/tilesets/Seattle/tileset.json'
}));
// 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
}));
// 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:
Members
allTilesLoaded : Event
This event is fired at the end of the frame after the scene is rendered.
-
Default Value:
new Event()
Example:
tileset.allTilesLoaded.addEventListener(function() {
console.log('All tiles are loaded');
});
See:
See the asset schema reference in the 3D Tiles spec for the full set of properties.
-
Default Value:
true
Deprecated: true
Only used when Cesium3DTileset#skipLevelOfDetail
is true
.
-
Default Value:
1024
readonly boundingSphere : BoundingSphere
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));
});
readonly classificationType : ClassificationType
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:
- POSITION and _BATCHID semantics are required.
- All indices with the same batch id must occupy contiguous sections of the index buffer.
- All shaders and techniques are ignored. The generated shader simply multiplies the position by the model-view-projection matrix.
- The only supported extensions are CESIUM_RTC and WEB3D_quantized_attributes.
- Only one node is supported.
- Only one mesh per node is supported.
- Only one primitive per mesh is supported.
-
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
用于选择性地禁用对tileset的渲染。Cesium3DTileset#colorBlendMode
为MIX
时用于在源颜色和特征颜色之间进行线性插值的值。
值0.0将生成源颜色,而值1.0将生成特征颜色,其中任何值介于两者之间
导致源颜色和特征颜色的混合。-
Default Value:
0.5
colorBlendMode : Cesium3DTileColorBlendMode
-
Default Value:
Cesium3DTileColorBlendMode.HIGHLIGHT
-
Default Value:
true
-
Default Value:
60.0
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.
-
Default Value:
false
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.
-
Default Value:
false
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.
-
Default Value:
false
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.
-
Default Value:
false
When true, draws labels to indicate the geometric error of each tile.
-
Default Value:
false
When true, draws labels to indicate the geometry and texture memory usage of each tile.
-
Default Value:
false
When true, draws labels to indicate the number of commands, points, triangles and features of each tile.
-
Default Value:
false
When true, draws labels to indicate the url of each tile.
-
Default Value:
false
When true, renders the viewer request volume for each tile.
-
Default Value:
false
When true, renders each tile's content as a wireframe.
-
Default Value:
false
-
Default Value:
false
Fog
。增加这个
值具有增加所有平铺的最大屏幕空间误差的效果,但以非线性方式。
误差从0.0开始,呈指数增长,直到达到中点,然后逐渐接近1.0。
这有助于在所有瓷砖中保持较近瓷砖的高细节,而在其他瓷砖中保持较低的细节
超过一定的距离,误差大约为1.0。
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.
It is analogous to moving fog closer to the camera.
-
Default Value:
0.00278
-
Default Value:
4.0
Valid values are between 0.0 and 1.0.
-
Default Value:
0.25
readonly ellipsoid : Ellipsoid
extras
属性,该属性包含特定于应用程序的元数据。
如果extras
不存在,则返回undefined
。Cesium3DTileset#foveatedScreenSpaceError
为真时使用,用于控制确定哪些瓷砖被延迟的圆锥体大小。
此圆锥体内的瓷砖将立即加载。锥体外的瓷砖可能会根据它们在锥体外的距离以及Cesium3DTileset#foveatedInterpolationCallback
和Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation
延迟。
将该值设置为0.0意味着圆锥体将是由摄影机位置及其视图方向形成的线。将该值设置为1.0意味着圆锥体会覆盖摄影机的整个视野,基本上会禁用该效果。-
Default Value:
0.3
foveatedInterpolationCallback : Cesium3DTileset.foveatedInterpolationCallback
Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation
和Cesium3DTileset#maximumScreenSpaceError
之间插值。Cesium3DTileset#foveatedScreenSpaceError
为真时使用,用于控制中心凹圆锥外瓷砖的起始屏幕空间误差松弛。
根据提供的Cesium3DTileset#foveatedInterpolationCallback
,屏幕空间错误将从该值开始提升到Cesium3DTileset#maximumScreenSpaceError
。-
Default Value:
0.0
Cesium3DTileset#foveatedConeSize
确定的瓷砖。-
Default Value:
true
Cesium3DTileset#foveatedScreenSpaceError
为真控制时使用
相机停止移动后等待延迟的磁贴开始加载之前的秒数。
此时间延迟可防止在相机移动时请求屏幕边缘的平铺。
将此值设置为0.0将立即请求任何给定视图中的所有平铺。-
Default Value:
0.2
imageBasedLightingFactor : Cartesian2
-
Default Value:
Cartesian2(1.0, 1.0)
Only used when Cesium3DTileset#skipLevelOfDetail
is true
.
-
Default Value:
false
initialTilesLoaded : Event
This event is fired at the end of the frame after the scene is rendered.
-
Default Value:
new Event()
Example:
tileset.initialTilesLoaded.addEventListener(function() {
console.log('Initial tiles are loaded');
});
See:
lightColor : Cartesian3
undefined
时,将使用场景的浅色。
For example, disabling additional light sources by setting 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.
-
Default Value:
undefined
loadProgress : Event
The number of pending tile requests, numberOfPendingRequests
, and number of tiles
processing, numberOfTilesProcessing
are passed to the event listener.
This event is fired at the end of the frame after the scene is rendered.
-
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);
});
Only used when Cesium3DTileset#skipLevelOfDetail
is true
.
-
Default Value:
false
Cesium3DTileset#specularEnvironmentMaps
和Cesium3DTileset#sphericalHarmonicCoefficients
时使用。-
Default Value:
0.2
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 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.
-
Default Value:
512
See:
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
maximumScreenSpaceError
the tile refines to its descendants.
Depending on the tileset, maximumScreenSpaceError
may need to be tweaked to achieve the right balance.
Higher values provide better performance but lower visual quality.
-
Default Value:
16
modelMatrix : Matrix4
-
Default Value:
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);
pointCloudShading : PointCloudShading
-
Default Value:
false
-
Default Value:
true
tileset.show
为false
时,预加载瓷砖。加载平铺,如同平铺集可见,但不渲染它们。-
Default Value:
false
progressiveResolutionHeightFraction*screenHeight
的分片将优先考虑。这有助于在全分辨率磁贴继续加载的同时快速放下平铺层。-
Default Value:
0.3
See the properties schema reference in the 3D Tiles spec for the full set of properties.
Example:
console.log('Maximum building height: ' + tileset.properties.height.maximum);
console.log('Minimum building height: ' + tileset.properties.height.minimum);
See:
-
Default Value:
false
readonly readyPromise : Promise.<Cesium3DTileset>
This promise is resolved at the end of the frame before the first frame the tileset is rendered in.
Example:
tileset.readyPromise.then(function(tileset) {
// tile.properties is not defined until readyPromise resolves.
var properties = tileset.properties;
if (Cesium.defined(properties)) {
for (var name in properties) {
console.log(properties[name]);
}
}
});
readonly root : Cesium3DTile
shadows : ShadowMode
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 Viewer#shadows
is true
.
-
Default Value:
ShadowMode.ENABLED
-
Default Value:
true
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.
-
Default Value:
false
Only used when Cesium3DTileset#skipLevelOfDetail
is true
.
-
Default Value:
1
<= 100 / skipScreenSpaceErrorFactor
。
Only used when Cesium3DTileset#skipLevelOfDetail
is true
.
-
Default Value:
16
sphericalHarmonicCoefficients : Array.<Cartesian3>
undefined
时,漫射辐照度
根据大气颜色计算。
There are nine Cartesian3
coefficients.
The order of the coefficients is: L00, L1-1, L10, L11, L2-2, L2-1, L20, L21, L22
cmgen
工具对环境图进行预处理来获得
Google's Filament project这还将生成一个KTX文件,该文件可以
供应至Cesium3DTileset#specularEnvironmentMaps
。Demo:
See:
style : Cesium3DTileStyle|undefined
Assign undefined
to remove the style, which will restore the visual
appearance of the tileset to its default when no style was applied.
The style is applied to a tile before the Cesium3DTileset#tileVisible
event is raised, so code in 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.
-
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
If there are no event listeners, error messages will be logged to the console.
The error object passed to the listener contains two properties:
url
: the url of the failed tile.message
: the error message.
-
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
The loaded 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.
-
Default Value:
new Event()
Example:
tileset.tileLoad.addEventListener(function(tile) {
console.log('A tile was loaded.');
});
true
时,符合屏幕空间误差的所有瓷砖都被加载。瓷砖是
此视图已完全加载。-
Default Value:
false
See:
tileUnload : Event
The unloaded 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.
-
Default Value:
new Event()
Example:
tileset.tileUnload.addEventListener(function(tile) {
console.log('A tile was unloaded from the cache.');
});
See:
tileVisible : Event
The visible 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.
-
Default Value:
new Event()
Examples:
tileset.tileVisible.addEventListener(function(tile) {
if (tile.content instanceof Cesium.Batched3DModel3DTileContent) {
console.log('A Batched 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) {
var content = tile.content;
var featuresLength = content.featuresLength;
for (var i = 0; i < featuresLength; i+=2) {
content.getFeature(i).color = Cesium.Color.fromRandom();
}
});
Methods
Name | Type | Description |
---|---|---|
tilesetUrl |
Resource | String | 要获取的json文件的url |
Returns:
销毁此对象持有的WebGL资源。销毁一个对象允许确定性 释放WebGL资源,而不是依赖垃圾回收器销毁此对象。 一旦一个对象被销毁,就不应该使用它;调用除
isDestroyed
将导致DeveloperError
异常。因此,
如示例所示,将返回值(undefined
)分配给对象。Throws:
-
DeveloperError :此对象已销毁,即调用destroy()。
Example:
tileset = tileset && tileset.destroy();
See:
true
如果tileset JSON文件在所使用的扩展中列出扩展名,则为false
。Name | Type | Description |
---|---|---|
extensionName |
String | 要检查的扩展名的名称。 |
Returns:
true
如果tileset JSON文件在所使用的扩展中列出扩展名,则为false
。Returns:
true
;否则为false
。Cesium3DTileset#style
标记为脏的,这将强制所有
在下一帧中重新评估样式的特征每个都是可见的。Cesium3DTileset#maximumMemoryUsage
Tile unloads occur at the next frame to keep all the WebGL delete calls within the render loop.
Type Definitions
Cesium3DTileset#foveatedScreenSpaceError
为真时用作回调函数,用于控制将中心凹圆锥外的平铺的屏幕空间错误提高多少,
在Cesium3DTileset#foveatedMinimumScreenSpaceErrorRelaxation
和Cesium3DTileset#maximumScreenSpaceError
之间插值。Name | Type | Description |
---|---|---|
p |
Number | 要插值的起始值。 |
q |
Number | 要插值的结束值。 |
time |
Number | 插值时间一般在[0.0, 1.0] 范围内。 |
Returns:
-
Default Value:
Math.lerp