English中文

VoxelPrimitive

new Cesium.VoxelPrimitive(options)

渲染体素数据的原语 A primitive that renders voxel data from a VoxelProvider.
名称 Name 类型 Type 说明 Description
options object 可选 optional 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
provider VoxelProvider 可选 optional 为图元提供图块数据的体素提供者。 The voxel provider that supplies the primitive with tile data.
modelMatrix Matrix4 Matrix4.IDENTITY 可选 optional 用于变换图元的模型矩阵。 The model matrix used to transform the primitive.
customShader CustomShader 可选 optional 用于设置图元样式的自定义着色器。 The custom shader used to style the primitive.
clock Clock 可选 optional 时钟用于控制时间动态行为。 The clock used to control time dynamic behavior.
calculateStatistics boolean 可选 optional 生成性能概况的统计数据。 Generate statistics for performance profile.
实验性 Experimental

此功能不是最终版本,可能会在没有 Cesium 标准弃用政策的情况下进行更改。 This feature is not final and is subject to change without Cesium's standard deprecation policy.

另见: See:

成员 Members

触发该事件以指示加载此帧满足屏幕空间错误的所有图块。该视图的体素基元已完全加载。 The event fired to indicate that all tiles that meet the screen space error this frame are loaded. The voxel primitive is completely loaded for this view.

该事件在场景渲染后的帧末尾触发。 This event is fired at the end of the frame after the scene is rendered.

示例: Example:
voxelPrimitive.allTilesLoaded.addEventListener(function() {
    console.log('All tiles are loaded');
});
获取边界球体。 Gets the bounding sphere.
The ClippingPlaneCollection 用于有选择地禁用渲染图元。 used to selectively disable rendering the primitive.
获取或设置自定义着色器。如果未定义, Gets or sets the custom shader. If undefined, VoxelPrimitive.DefaultCustomShader 已设置。 is set.
另见: See:

readonly customShaderCompilationEvent : Event

获取每当编译自定义着色器时引发的事件。 Gets an event that is raised whenever a custom shader is compiled.
获取或设置是否渲染调试可视化。 Gets or sets whether or not to render debug visualizations.
获取或设置渲染时是否测试深度。 Gets or sets whether or not to test against depth when rendering.
获取每个体素图块的尺寸(z 向上方向)。不包括填充。 Gets the dimensions of each voxel tile, in z-up orientation. Does not include padding.
获取或设置图元是否应在视图更改时更新。 Gets or sets whether or not the primitive should update when the view changes.
触发该事件以指示加载此帧满足屏幕空间错误的所有图块。当加载初始视图中的所有图块时,会触发此事件一次。 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.

该事件在场景渲染后的帧末尾触发。 This event is fired at the end of the frame after the scene is rendered.

示例: Example:
voxelPrimitive.initialTilesLoaded.addEventListener(function() {
    console.log('Initial tiles are loaded');
});
另见: See:
获取输入体素数据的一个图块在输入方向上的尺寸。包括填充物。 Gets the dimensions of one tile of the input voxel data, in the input orientation. Includes padding.
触发该事件以指示加载新图块的进度。当请求新图块、请求的图块下载完成以及下载的图块已被处理并准备好渲染时,会触发此事件。 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.

待处理的图块请求数, 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.

示例: Example:
voxelPrimitive.loadProgress.addEventListener(function(numberOfPendingRequests, numberOfTilesProcessing) {
    if ((numberOfPendingRequests === 0) && (numberOfTilesProcessing === 0)) {
        console.log('Finished loading');
        return;
    }

    console.log(`Loading: requests: ${numberOfPendingRequests}, processing: ${numberOfTilesProcessing}`);
});
获取或设置形状局部坐标系中的最大边界。体素数据被拉伸或压缩以适应边界。 Gets or sets the maximum bounds in the shape's local coordinate system. Voxel data is stretched or squashed to fit the bounds.
获取或设置形状局部坐标系中的最大剪切位置。任何超出范围的体素内容都会被剪掉。 Gets or sets the maximum clipping location in the shape's local coordinate system. Any voxel content outside the range is clipped.

readonly maximumValues : Array.<Array.<number>>

获取体素数据每个通道的最大值。 Gets the maximum value per channel of the voxel data.
获取或设置形状局部坐标系中的最小边界。体素数据被拉伸或压缩以适应边界。 Gets or sets the minimum bounds in the shape's local coordinate system. Voxel data is stretched or squashed to fit the bounds.
获取或设置形状局部坐标系中的最小剪切位置。任何超出范围的体素内容都会被剪掉。 Gets or sets the minimum clipping location in the shape's local coordinate system. Any voxel content outside the range is clipped.

readonly minimumValues : Array.<Array.<number>>

获取体素数据每个通道的最小值。 Gets the minimum value per channel of the voxel data.
获取模型矩阵。 Gets the model matrix.

nearestSampling : boolean

获取或设置最近的采样。 Gets or sets the nearest sampling.
获取定向边界框。 Gets the oriented bounding box.
获取体素数据后的填充。 Gets the padding after the voxel data.
获取体素数据之前的填充。 Gets the padding before the voxel data.
得到 Gets the VoxelProvider 与这个原语相关联。 associated with this primitive.
获取一个值,该值指示基元是否可供使用。 Gets a value indicating whether or not the primitive is ready for use.

screenSpaceError : number

获取或设置屏幕空间误差(以像素为单位)。如果体素的屏幕空间大小大于屏幕空间误差,则对图块进行细分。较低的屏幕空间误差对应于较高的细节渲染,但可能导致性能较差和内存消耗较高。 Gets or sets the screen space error in pixels. If the screen space size of a voxel is greater than the screen space error, the tile is subdivided. Lower screen space error corresponds with higher detail rendering, but could result in worse performance and higher memory consumption.
获取形状类型。 Gets the shape type.
获取或设置是否应显示此基元。 Gets or sets whether or not this primitive should be displayed.
获取或设置光线行进期间使用的步长乘数。值越低,渲染质量越高,但性能也越差。 Gets or sets the step size multiplier used during raymarching. The lower the value, the higher the rendering quality, but also the worse the performance.
触发该事件以指示图块的内容加载失败。 The event fired to indicate that a tile's content failed to load.
示例: Example:
voxelPrimitive.tileFailed.addEventListener(function() {
    console.log('An error occurred loading tile.');
});
触发该事件以指示图块的内容已加载。 The event fired to indicate that a tile's content was loaded.

在渲染帧时,在图块集遍历过程中会触发此事件,以便对图块的更新在同一帧中生效。不要在事件监听期间创建或修改 Cesium 实体或原语。 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.

示例: Example:
voxelPrimitive.tileLoad.addEventListener(function() {
    console.log('A tile was loaded.');
});
触发该事件以指示图块的内容已卸载。 The event fired to indicate that a tile's content was unloaded.
示例: Example:
voxelPrimitive.tileUnload.addEventListener(function() {
    console.log('A tile was unloaded from the cache.');
});
对于帧中的每个可见图块,此事件都会触发一次。 This event fires once for each visible tile in a frame.

在渲染帧的遍历过程中会触发此事件。 This event is fired during the traversal while the frame is being rendered.

示例: Example:
voxelPrimitive.tileVisible.addEventListener(function() {
    console.log('A tile is visible.');
});

方法 Methods

销毁该对象持有的 WebGL 资源。销毁对象可以确定性地释放 WebGL 资源,而不是依赖垃圾收集器来销毁该对象。 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.

一旦对象被销毁,就不应再使用;调用除 Once an object is destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError 例外。因此,分配返回值( exception. Therefore, assign the return value (undefined) 到对象,如示例中所做的那样。 ) to the object as done in the example.
抛出: Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
示例: Example:
voxelPrimitive = voxelPrimitive && voxelPrimitive.destroy();
另见: See:

isDestroyed()boolean

如果该对象被销毁则返回 true;否则为假。 Returns true if this object was destroyed; otherwise, false.

如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than isDestroyed 将导致 will result in a DeveloperError exception.
返回: Returns:
true 如果该物体被摧毁;否则, if this object was destroyed; otherwise, false.
另见: See:
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.