FreedoPModelset

new Freedo.FreedoPModelset(options)

A 3D Tiles tileset, used for streaming massive heterogeneous 3D geospatial datasets.
Name Type Description
options Object Object with the following properties:
Name Type Default Description
url Resource | String | Promise.<Resource> | Promise.<String> The url to a tileset JSON file.
show Boolean true optional Determines if the tileset will be shown.
modelMatrix Matrix4 Matrix4.IDENTITY optional A 4x4 transformation matrix that transforms the tileset's root tile.
constraintRegions Array.<Object> optional 限制区参数数组
constraintRegions[i].height Number 0.0 optional 限制区拉平的高度
constraintRegions[i].eraseType String 'ERASE' optional 限制区拉平的操作,是直接改变高度还是在原来的高度上偏移.
constraintRegions[i].constraintRegion Array.<Number> optional 限制区, [minlongitude, maxlongitude, minlatitude, maxlatitude](角度值) 或者 [xmin, xmax, ymin, ymax] (平面模式)
isPlaneViewer Boolean false optional 是否为无球模式三维场景
allowPicking Boolean true optional 是否允许被选中
shadows ShadowMode ShadowMode.ENABLED optional Determines whether the tileset casts or receives shadows from light sources.
maximumScreenSpaceError Number 16 optional The maximum screen space error used to drive level of detail refinement.
maximumMemoryUsage Number 512 optional 内存缓存上限(单位:MB). 如果占用内存低于该值, 则瓦片不会卸载.
maximumAbsoluteMemoryUsage Number 4096 optional 内存占用上限(单位:MB). 如果占用内存达到该值, 则新的瓦片不会加载(除非先卸载不需要的瓦片).
cullWithChildrenBounds Boolean true optional Optimization option. Whether to cull tiles using the union of their children bounding volumes.
cullRequestsWhileMoving Boolean true optional 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 Number 60.0 optional Optimization option. Multiplier used in culling requests while moving. Larger is more aggressive culling, smaller less aggressive culling.
preloadWhenHidden Boolean false optional Preload tiles when tileset.show is false. Loads tiles as if the tileset is visible but does not render them.
preloadFlightDestinations Boolean true optional Optimization option. Preload tiles at the camera's flight destination while the camera is in flight.
preferLeaves Boolean true optional Optimization option. Prefer loading of leaves first.
dynamicScreenSpaceError Boolean false optional Optimization option. Reduce the screen space error for tiles that are further away from the camera.
dynamicScreenSpaceErrorDensity Number 0.00278 optional Density used to adjust the dynamic screen space error, similar to fog density.
dynamicScreenSpaceErrorFactor Number 4.0 optional A factor used to increase the computed dynamic screen space error.
dynamicScreenSpaceErrorHeightFalloff Number 0.25 optional A ratio of the tileset's height at which the density starts to falloff.
progressiveResolutionHeightFraction Number 0.3 optional Optimization option. If between (0.0, 0.5], tiles at or above the screen space error for the reduced screen resolution of progressiveResolutionHeightFraction*screenHeight will be prioritized first. This can help get a quick layer of tiles down while full resolution tiles continue to load.
foveatedScreenSpaceError Boolean true optional 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 FreedoPModelset#foveatedConeSize are loaded.
foveatedConeSize Number 0.1 optional Optimization option. Used when FreedoPModelset#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 their screen space error. This is controlled by FreedoPModelset#foveatedInterpolationCallback and FreedoPModelset#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, disabling the effect.
foveatedMinimumScreenSpaceErrorRelaxation Number 0.0 optional Optimization option. Used when FreedoPModelset#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 tileset value up to FreedoPModelset#maximumScreenSpaceError based on the provided FreedoPModelset#foveatedInterpolationCallback.
foveatedInterpolationCallback FreedoPModelset.foveatedInterpolationCallback Math.lerp optional Optimization option. Used when FreedoPModelset#foveatedScreenSpaceError is true to control how much to raise the screen space error for tiles outside the foveated cone, interpolating between FreedoPModelset#foveatedMinimumScreenSpaceErrorRelaxation and FreedoPModelset#maximumScreenSpaceError
foveatedTimeDelay Number 0.2 optional Optimization option. Used when FreedoPModelset#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.
skipLevelOfDetail Boolean false optional Optimization option. Determines if level of detail skipping should be applied during the traversal.
baseScreenSpaceError Number 1024 optional When skipLevelOfDetail is true, the screen space error that must be reached before skipping levels of detail.
skipScreenSpaceErrorFactor Number 16 optional When skipLevelOfDetail is true, a multiplier defining the minimum screen space error to skip. Used in conjunction with skipLevels to determine which tiles to load.
skipLevels Number 1 optional When skipLevelOfDetail is true, a constant defining the minimum number of levels to skip when loading tiles. When it is 0, no levels are skipped. Used in conjunction with skipScreenSpaceErrorFactor to determine which tiles to load.
immediatelyLoadDesiredLevelOfDetail Boolean false optional When skipLevelOfDetail is 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.
loadSiblings Boolean false optional When skipLevelOfDetail is true, determines whether siblings of visible tiles are always downloaded during traversal.
clippingPlanes ClippingPlaneCollection optional The ClippingPlaneCollection used to selectively disable rendering the tileset.
classificationType ClassificationType optional Determines whether terrain, 3D Tiles or both will be classified by this tileset. See FreedoPModelset#classificationType for details about restrictions and limitations.
ellipsoid Ellipsoid Ellipsoid.WGS84 optional The ellipsoid determining the size and shape of the globe.
pointCloudShading Object optional Options for constructing a PointCloudShading object to control point attenuation based on geometric error and lighting.
imageBasedLightingFactor Cartesian2 new Cartesian2(1.0, 1.0) optional Scales the diffuse and specular image-based lighting from the earth, sky, atmosphere and star skybox.
lightColor Cartesian3 optional The light color when shading models. When undefined the scene's light color is used instead.
enableLighting Boolean optional Determine if the models may be enabled for lighting with the scene's light source.
luminanceAtZenith Number 0.2 optional The sun's luminance at the zenith in kilo candela per meter squared to use for this model's procedural environment map.
sphericalHarmonicCoefficients Array.<Cartesian3> optional The third order spherical harmonic coefficients used for the diffuse color of image-based lighting.
specularEnvironmentMaps String optional A URL to a KTX2 file that contains a cube map of the specular lighting and the convoluted specular mipmaps.
backFaceCulling Boolean true optional 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 Boolean false optional Whether to display the outline for models using the CESIUM_primitive_outline extension. When true, outlines are displayed. When false, outlines are not displayed.
vectorClassificationOnly Boolean false optional Indicates that only the tileset's vector tiles should be used for classification.
vectorKeepDecodedPositions Boolean false optional Whether vector tiles should keep decoded positions in memory. This is used with FreedoPModelFeature.getPolylinePositions.
featureIdIndex Number 0 optional The index into the list of primitive feature IDs used for picking and styling. For EXT_feature_metadata, feature ID attributes are listed before feature ID textures. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
instanceFeatureIdIndex Number 0 optional The index into the list of instance feature IDs used for picking and styling. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
showCreditsOnScreen Boolean false optional Whether to display the credits of this tileset on screen.
debugHeatmapTilePropertyName String optional The tile variable to colorize as a heatmap. All rendered tiles will be colorized relative to each other's specified variable value.
debugFreezeFrame Boolean false optional For debugging only. Determines if only the tiles from last frame should be used for rendering.
debugColorizeTiles Boolean false optional For debugging only. When true, assigns a random color to each tile.
debugWireframe Boolean false optional For debugging only. When true, render's each tile's content as a wireframe.
debugShowBoundingVolume Boolean false optional For debugging only. When true, renders the bounding volume for each tile.
debugShowContentBoundingVolume Boolean false optional For debugging only. When true, renders the bounding volume for each tile's content.
debugShowViewerRequestVolume Boolean false optional For debugging only. When true, renders the viewer request volume for each tile.
debugShowGeometricError Boolean false optional For debugging only. When true, draws labels to indicate the geometric error of each tile.
debugShowRenderingStatistics Boolean false optional For debugging only. When true, draws labels to indicate the number of commands, points, triangles and features for each tile.
debugShowMemoryUsage Boolean false optional For debugging only. When true, draws labels to indicate the texture and geometry memory in megabytes used by each tile.
debugShowUrl Boolean false optional For debugging only. When true, draws labels to indicate the url of each tile.
Throws:
Examples:
const tileset = scene.primitives.add(new Freedo.FreedoPModelset({
     url : 'http://localhost:8002/tilesets/Seattle/tileset.json'
}));
// Common setting for the skipLevelOfDetail optimization
const tileset = scene.primitives.add(new Freedo.FreedoPModelset({
     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
const tileset = scene.primitives.add(new Freedo.FreedoPModelset({
     url : 'http://localhost:8002/tilesets/Seattle/tileset.json',
     dynamicScreenSpaceError : true,
     dynamicScreenSpaceErrorDensity : 0.00278,
     dynamicScreenSpaceErrorFactor : 4.0,
     dynamicScreenSpaceErrorHeightFalloff : 0.25
}));
See:

Members

static Freedo.FreedoPModelset.cachedTotalMemoryUsage : Number

允许所有3dtiles占用的内存缓存上限之和(单位:MB). 如果占用的内存超过该值, 则会释放不需要显示的瓦片.
Default Value: 12288

static Freedo.FreedoPModelset.maximumTotalMemoryUsage : Number

允许所有3dtiles占用的内存上限之和(单位:MB). 如果占用的内存达到这个值, 则不会加载新的瓦片, 必须先释放不需要显示的瓦片.
Default Value: 12288

allowPicking : Boolean

设置是否允许选择物体
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.

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:

readonly asset : Object

Gets the tileset's asset object property, which contains metadata about the tileset.

See the asset schema reference in the 3D Tiles spec for the full set of properties.

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.
Default Value: true

readonly deprecated basePath : String

The base path that non-absolute paths in tileset JSON file are relative to.

Deprecated: true

baseScreenSpaceError : Number

The screen space error that must be reached before skipping levels of detail.

Only used when FreedoPModelset#skipLevelOfDetail is true.

Default Value: 1024

readonly boundingSphere : BoundingSphere

The tileset's bounding sphere.
Example:
const tileset = viewer.scene.primitives.add(new Freedo.FreedoPModelset({
    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 Freedo.HeadingPitchRange(0, -0.5, 0));
});

readonly classificationType : ClassificationType

Determines whether terrain, 3D Tiles or both will be classified by this tileset.

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 Freedo's standard deprecation policy.

The ClippingPlaneCollection used to selectively disable rendering the tileset.

colorBlendAmount : Number

Defines the value used to linearly interpolate between the source color and feature color when the FreedoPModelset#colorBlendMode is MIX. 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.
Default Value: 0.5
Defines how per-feature colors set from the Freedo API or declarative styling blend with the source colors from the original feature, e.g. glTF material or per-point color in the tile.
Default Value: FreedoPModelColorBlendMode.HIGHLIGHT

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.
Default Value: true

cullRequestsWhileMovingMultiplier : Number

Optimization option. Multiplier used in culling requests while moving. Larger is more aggressive culling, smaller less aggressive culling.
Default Value: 60.0

customShader : CustomShader|undefined

A custom shader to apply to all tiles in the tileset. Only used for contents that use ModelExperimental. Using custom shaders with a FreedoPModelStyle may lead to undefined behavior.

To enable ModelExperimental, set ExperimentalFeatures.enableModelExperimental or tileset.enableModelExperimental to true.

Default Value: undefined
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

debugColorizeTiles : Boolean

This property is for debugging only; it is not optimized for production use.

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

debugFreezeFrame : Boolean

This property is for debugging only; it is not optimized for production use.

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

debugShowBoundingVolume : Boolean

This property is for debugging only; it is not optimized for production use.

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

debugShowContentBoundingVolume : Boolean

This property is for debugging only; it is not optimized for production use.

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

debugShowGeometricError : Boolean

This property is for debugging only; it is not optimized for production use.

When true, draws labels to indicate the geometric error of each tile.

Default Value: false

debugShowMemoryUsage : Boolean

This property is for debugging only; it is not optimized for production use.

When true, draws labels to indicate the geometry and texture memory usage of each tile.

Default Value: false

debugShowRenderingStatistics : Boolean

This property is for debugging only; it is not optimized for production use.

When true, draws labels to indicate the number of commands, points, triangles and features of each tile.

Default Value: false

debugShowUrl : Boolean

This property is for debugging only; it is not optimized for production use.

When true, draws labels to indicate the url of each tile.

Default Value: false

debugShowViewerRequestVolume : Boolean

This property is for debugging only; it is not optimized for production use.

When true, renders the viewer request volume for each tile.

Default Value: false

debugWireframe : Boolean

This property is for debugging only; it is not optimized for production use.

When true, renders each tile's content as a wireframe.

Default Value: false

dynamicScreenSpaceError : Boolean

Optimization option. Whether the tileset should refine based on a dynamic screen space error. Tiles that are further away will be rendered with lower detail than closer tiles. This improves performance by rendering fewer tiles and making less requests, but may result in a slight drop in visual quality for tiles in the distance. The algorithm is biased towards "street views" where the camera is close to the ground plane of the tileset and looking at the horizon. In addition results are more accurate for tightly fitting bounding volumes like box and region.
Default Value: false

dynamicScreenSpaceErrorDensity : Number

A scalar that determines the density used to adjust the dynamic screen space error, similar to Fog. Increasing this value has the effect of increasing the maximum screen space error for all tiles, but in a non-linear fashion. The error starts at 0.0 and increases exponentially until a midpoint is reached, and then approaches 1.0 asymptotically. This has the effect of keeping high detail in the closer tiles and lower detail in the further tiles, with all tiles beyond a certain distance all roughly having an error of 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

dynamicScreenSpaceErrorFactor : Number

A factor used to increase the screen space error of tiles for dynamic screen space error. As this value increases less tiles are requested for rendering and tiles in the distance will have lower detail. If set to zero, the feature will be disabled.
Default Value: 4.0

dynamicScreenSpaceErrorHeightFalloff : Number

A ratio of the tileset's height at which the density starts to falloff. If the camera is below this height the full computed density is applied, otherwise the density falls off. This has the effect of higher density at street level views.

Valid values are between 0.0 and 1.0.

Default Value: 0.25
Gets an ellipsoid describing the shape of the globe.

enableLighting : Boolean

Enable lighting the models with the scene's light source.
Default Value: true

enableModelExperimental : Boolean

If true, ModelExperimental will be used instead of Model for each tile with a glTF or 3D Tiles 1.0 content (where applicable).

The value defaults to ExperimentalFeatures.enableModelExperimental.

Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

examineVectorLinesFunction : function

Function for examining vector lines as they are being streamed.
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

readonly extensions : Object

Gets the tileset's extensions object property.

readonly extras : *

Returns the extras property at the top-level of the tileset JSON, which contains application specific metadata. Returns undefined if extras does not exist.
See:

featureIdIndex : Number

The index into the list of primitive feature IDs used for picking and styling. For EXT_feature_metadata, feature ID attributes are listed before feature ID textures. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

foveatedConeSize : Number

Optimization option. Used when FreedoPModelset#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 FreedoPModelset#foveatedInterpolationCallback and FreedoPModelset#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.
Default Value: 0.3
Gets or sets a callback to control how much to raise the screen space error for tiles outside the foveated cone, interpolating between FreedoPModelset#foveatedMinimumScreenSpaceErrorRelaxation and FreedoPModelset#maximumScreenSpaceError.

foveatedMinimumScreenSpaceErrorRelaxation : Number

Optimization option. Used when FreedoPModelset#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 FreedoPModelset#maximumScreenSpaceError based on the provided FreedoPModelset#foveatedInterpolationCallback.
Default Value: 0.0

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 FreedoPModelset#foveatedConeSize are loaded.
Default Value: true

foveatedTimeDelay : Number

Optimization option. Used when FreedoPModelset#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.
Default Value: 0.2

imageBasedLightingFactor : Cartesian2

Freedo adds lighting from the earth, sky, atmosphere, and star skybox. This cartesian is used to scale the final diffuse and specular lighting contribution from those sources to the final color. A value of 0.0 will disable those light sources.
Default Value: Cartesian2(1.0, 1.0)

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.

Only used when FreedoPModelset#skipLevelOfDetail is true.

Default Value: false

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.

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:

instanceFeatureIdIndex : Number

The index into the list of instance feature IDs used for picking and styling. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority.
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

The light color when shading models. When undefined the scene's light color is used instead.

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
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.

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);
});

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.

Only used when FreedoPModelset#skipLevelOfDetail is true.

Default Value: false

luminanceAtZenith : Number

The sun's luminance at the zenith in kilo candela per meter squared to use for this model's procedural environment map. This is used when FreedoPModelset#specularEnvironmentMaps and FreedoPModelset#sphericalHarmonicCoefficients are not defined.
Default Value: 0.2

maximumAbsoluteMemoryUsage : Number

允许占用的内存上限(单位:MB). 如果占用的内存达到这个值, 则不会加载新的瓦片, 必须先释放不需要显示的瓦片。
Default Value: 4096
See:

maximumMemoryUsage : Number

内存缓存上限(单位:MB). 当占用内存低于该值时, 所有瓦片都不会卸载(避免再次加载的效率损失).
Default Value: 512
See:

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.

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
A 4x4 transformation matrix that transforms the entire tileset.
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 = Freedo.Cartographic.fromCartesian(boundingSphere.center);
const surface = Freedo.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
const offset = Freedo.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, heightOffset);
const translation = Freedo.Cartesian3.subtract(offset, surface, new Freedo.Cartesian3());
tileset.modelMatrix = Freedo.Matrix4.fromTranslation(translation);
Options for controlling point size based on geometric error and eye dome lighting.

preferLeaves : Boolean

Optimization option. Prefer loading of leaves first.
Default Value: true

preloadFlightDestinations : Boolean

Optimization option. Fetch tiles at the camera's flight destination while the camera is in flight.
Default Value: true

preloadWhenHidden : Boolean

Preload tiles when tileset.show is false. Loads tiles as if the tileset is visible but does not render them.
Default Value: false

progressiveResolutionHeightFraction : Number

Optimization option. If between (0.0, 0.5], tiles at or above the screen space error for the reduced screen resolution of progressiveResolutionHeightFraction*screenHeight will be prioritized first. This can help get a quick layer of tiles down while full resolution tiles continue to load.
Default Value: 0.3

readonly properties : Object

Gets the tileset's properties dictionary object, which contains metadata about per-feature properties.

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:

readonly ready : Boolean

When true, the tileset's root tile is loaded and the tileset is ready to render. This is set to true right before FreedoPModelset#readyPromise is resolved.
Default Value: false

readonly readyPromise : Promise.<FreedoPModelset>

Gets the promise that will be resolved when the tileset's root tile is loaded and the tileset is ready to render.

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.
    const properties = tileset.properties;
    if (Freedo.defined(properties)) {
        for (const name in properties) {
            console.log(properties[name]);
        }
    }
});
The resource used to fetch the tileset JSON file
The root tile.
Determines whether the tileset casts or receives shadows from light sources.

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
Determines if the tileset will be shown.
Default Value: true

showCreditsOnScreen : Boolean

Determines whether the credits of the tileset will be displayed on the screen
Default Value: false

readonly 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.
Default Value: false

skipLevelOfDetail : Boolean

Optimization option. Determines if level of detail skipping should be applied during the traversal.

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

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.

Only used when FreedoPModelset#skipLevelOfDetail is true.

Default Value: 1

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 <= 100 / skipScreenSpaceErrorFactor.

Only used when FreedoPModelset#skipLevelOfDetail is true.

Default Value: 16

specularEnvironmentMaps : String

A URL to a KTX file that contains a cube map of the specular lighting and the convoluted specular mipmaps.
Demo:
See:

sphericalHarmonicCoefficients : Array.<Cartesian3>

The third order spherical harmonic coefficients used for the diffuse color of image-based lighting. When undefined, a diffuse irradiance computed from the atmosphere color is used.

There are nine Cartesian3 coefficients. The order of the coefficients is: L00, L1-1, L10, L11, L2-2, L2-1, L20, L21, L22

These values can be obtained by preprocessing the environment map using the cmgen tool of Google's Filament project. This will also generate a KTX file that can be supplied to FreedoPModelset#specularEnvironmentMaps.
Demo:
See:
The style, defined using the 3D Tiles Styling language, applied to each feature in the tileset.

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 FreedoPModelset#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.

Use an always "true" condition to specify the Color for all objects that are not overridden by pre-existing conditions. Otherwise, the default color Freedo.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.

Default Value: undefined
Example:
tileset.style = new Freedo.FreedoPModelStyle({
   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:
The event fired to indicate that a tile's content failed to load.

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.

If the 3DTILES_multiple_contents extension is used, 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);
});
The event fired to indicate that a tile's content was loaded.

The loaded FreedoPModel 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 Freedo entities or primitives during the event listener.

Default Value: new Event()
Example:
tileset.tileLoad.addEventListener(function(tile) {
    console.log('A tile was loaded.');
});

readonly tilesLoaded : Boolean

When true, all tiles that meet the screen space error this frame are loaded. The tileset is completely loaded for this view.
Default Value: false
See:
The event fired to indicate that a tile's content was unloaded.

The unloaded FreedoPModel 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 Freedo 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:
This event fires once for each visible tile in a frame. This can be used to manually style a tileset.

The visible FreedoPModel 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 Freedo entities or primitives during the event listener.

Default Value: new Event()
Examples:
tileset.tileVisible.addEventListener(function(tile) {
    if (tile.content instanceof Freedo.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 Freedo.FreedoPModelStyle({
    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 = Freedo.Color.fromRandom();
    }
});

readonly timeSinceLoad : Number

Returns the time, in milliseconds, since the tileset was loaded and first updated.

readonly totalMemoryUsageInBytes : Number

The total amount of GPU memory in bytes used by the tileset. This value is estimated from geometry, texture, and batch table textures of loaded tiles. For point clouds, this value also includes per-point metadata.
See:

readonly url : String

The url to a tileset JSON file.

vectorClassificationOnly : Boolean

Indicates that only the tileset's vector tiles should be used for classification.
Default Value: false
Experimental

This feature is using part of the 3D Tiles spec that is not final and is subject to change without Freedo's standard deprecation policy.

vectorKeepDecodedPositions : Boolean

Whether vector tiles should keep decoded positions in memory. This is used with FreedoPModelFeature.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 Freedo's standard deprecation policy.

Methods

static Freedo.FreedoPModelset.loadJson(tilesetUrl)Promise.<Object>

Provides a hook to override the method used to request the tileset json useful when fetching tilesets from remote servers
Name Type Description
tilesetUrl Resource | String The url of the json file to be fetched
Returns:
A promise that resolves with the fetched json data
if the scene is defined, push the primitive to the destroying list which would be destroyed after render the scene; otherwise, destroy it immediately.
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:
tileset = tileset && tileset.destroyImpl();
See:

hasExtension(extensionName)Boolean

true if the tileset JSON file lists the extension in extensionsUsed; otherwise, false.
Name Type Description
extensionName String The name of the extension to check.
Returns:
true if the tileset JSON file lists the extension in extensionsUsed; otherwise, false.

isDestroyed()Boolean

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:
Marks the tileset's FreedoPModelset#style as dirty, which forces all features to re-evaluate the style in the next frame each is visible.

trimLoadedTiles()

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 FreedoPModelset#maximumMemoryUsage.

Tile unloads occur at the next frame to keep all the WebGL delete calls within the render loop.

Type Definitions

Freedo.FreedoPModelset.foveatedInterpolationCallback(p, q, time)Number

Optimization option. Used as a callback when FreedoPModelset#foveatedScreenSpaceError is true to control how much to raise the screen space error for tiles outside the foveated cone, interpolating between FreedoPModelset#foveatedMinimumScreenSpaceErrorRelaxation and FreedoPModelset#maximumScreenSpaceError.
Name Type Description
p Number The start value to interpolate.
q Number The end value to interpolate.
time Number The time of interpolation generally in the range [0.0, 1.0].
Returns:
The interpolated value.
Default Value: Math.lerp