Skip to content

KBE3D / KBCore / Cesium / VoxelPrimitive

类: VoxelPrimitive

A primitive that renders voxel data from a VoxelProvider.

参数

Object with the following properties:

参数

The voxel provider that supplies the primitive with tile data.

参数

The model matrix used to transform the primitive.

参数

The custom shader used to style the primitive.

参数

The clock used to control time dynamic behavior.

参数

Generate statistics for performance profile.

属性

tileLoad

tileLoad: Event

The event fired to indicate that a tile's content was loaded. <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
voxelPrimitive.tileLoad.addEventListener(function() {
    console.log('A tile was loaded.');
});

tileVisible

tileVisible: Event

This event fires once for each visible tile in a frame. <p> This event is fired during the traversal while the frame is being rendered.

示例

ts
voxelPrimitive.tileVisible.addEventListener(function() {
    console.log('A tile is visible.');
});

tileFailed

tileFailed: Event

The event fired to indicate that a tile's content failed to load.

示例

ts
voxelPrimitive.tileFailed.addEventListener(function() {
    console.log('An error occurred loading tile.');
});

tileUnload

tileUnload: Event

The event fired to indicate that a tile's content was unloaded.

示例

ts
voxelPrimitive.tileUnload.addEventListener(function() {
    console.log('A tile was unloaded from the cache.');
});

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
voxelPrimitive.loadProgress.addEventListener(function(numberOfPendingRequests, numberOfTilesProcessing) {
    if ((numberOfPendingRequests === 0) && (numberOfTilesProcessing === 0)) {
        console.log('Finished 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 voxel primitive is completely loaded for this view. <p> This event is fired at the end of the frame after the scene is rendered. </p>

示例

ts
voxelPrimitive.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
voxelPrimitive.initialTilesLoaded.addEventListener(function() {
    console.log('Initial tiles are loaded');
});

ready

readonly ready: boolean

Gets a value indicating whether or not the primitive is ready for use.


provider

readonly provider: VoxelProvider

Gets the VoxelProvider associated with this primitive.


boundingSphere

readonly boundingSphere: BoundingSphere

Gets the bounding sphere.


orientedBoundingBox

readonly orientedBoundingBox: OrientedBoundingBox

Gets the oriented bounding box.


modelMatrix

readonly modelMatrix: Matrix4

Gets the model matrix.


shape

readonly shape: VoxelShapeType

Gets the shape type.


dimensions

readonly dimensions: Cartesian3

Gets the dimensions of each voxel tile, in z-up orientation. Does not include padding.


inputDimensions

readonly inputDimensions: Cartesian3

Gets the dimensions of one tile of the input voxel data, in the input orientation. Includes padding.


paddingBefore

readonly paddingBefore: Cartesian3

Gets the padding before the voxel data.


paddingAfter

readonly paddingAfter: Cartesian3

Gets the padding after the voxel data.


minimumValues

readonly minimumValues: number[][]

Gets the minimum value per channel of the voxel data.


maximumValues

readonly maximumValues: number[][]

Gets the maximum value per channel of the voxel data.


show

show: boolean

Gets or sets whether or not this primitive should be displayed.


disableUpdate

disableUpdate: boolean

Gets or sets whether or not the primitive should update when the view changes.


debugDraw

debugDraw: boolean

Gets or sets whether or not to render debug visualizations.


depthTest

depthTest: boolean

Gets or sets whether or not to test against depth when rendering.


nearestSampling

nearestSampling: boolean

Gets or sets the nearest sampling.


screenSpaceError

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.


stepSize

stepSize: number

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.


minBounds

minBounds: Cartesian3

Gets or sets the minimum bounds in the shape's local coordinate system. Voxel data is stretched or squashed to fit the bounds.


maxBounds

maxBounds: Cartesian3

Gets or sets the maximum bounds in the shape's local coordinate system. Voxel data is stretched or squashed to fit the bounds.


minClippingBounds

minClippingBounds: Cartesian3

Gets or sets the minimum clipping location in the shape's local coordinate system. Any voxel content outside the range is clipped.


maxClippingBounds

maxClippingBounds: Cartesian3

Gets or sets the maximum clipping location in the shape's local coordinate system. Any voxel content outside the range is clipped.


clippingPlanes

clippingPlanes: ClippingPlaneCollection

The ClippingPlaneCollection used to selectively disable rendering the primitive.


customShader

customShader: CustomShader

Gets or sets the custom shader. If undefined, VoxelPrimitive.DefaultCustomShader is set.


customShaderCompilationEvent

readonly customShaderCompilationEvent: Event

Gets an event that is raised whenever a custom shader is compiled.

方法

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
voxelPrimitive = voxelPrimitive && voxelPrimitive.destroy();

构造函数

构造函数

new VoxelPrimitive(options?: { provider?: VoxelProvider; modelMatrix?: Matrix4; customShader?: CustomShader; clock?: Clock; calculateStatistics?: boolean; }): VoxelPrimitive

参数

options?
provider?

VoxelProvider

modelMatrix?

Matrix4

customShader?

CustomShader

clock?

Clock

calculateStatistics?

boolean

返回

VoxelPrimitive

KBE3D @3.0.0 Copyright © 2024-present KBE3D