A 3D model. This is a new architecture that is more decoupled than the older
Model
. This class is still experimental.
Do not call this function directly, instead use the `from` functions to create
the Model from your source data type.
Name |
Type |
Description |
options |
Object
|
Object with the following properties:
Name |
Type |
Default |
Description |
resource |
Resource
|
|
The Resource to the 3D model. |
modelMatrix |
Matrix4
|
Matrix4.IDENTITY
|
optional
The 4x4 transformation matrix that transforms the model from model to world coordinates. |
scale |
Number
|
1.0
|
optional
A uniform scale applied to this model. |
minimumPixelSize |
Number
|
0.0
|
optional
The approximate minimum pixel size of the model regardless of zoom. |
maximumScale |
Number
|
|
optional
The maximum scale size of a model. An upper limit for minimumPixelSize. |
clampAnimations |
Boolean
|
true
|
optional
Determines if the model's animations should hold a pose over frames where no keyframes are specified. |
debugShowBoundingVolume |
Boolean
|
false
|
optional
For debugging only. Draws the bounding sphere for each draw command in the model. |
enableDebugWireframe |
Boolean
|
false
|
optional
For debugging only. This must be set to true for debugWireframe to work in WebGL1. This cannot be set after the model has loaded. |
debugWireframe |
Boolean
|
false
|
optional
For debugging only. Draws the model in wireframe. Will only work for WebGL1 if enableDebugWireframe is set to true. |
cull |
Boolean
|
true
|
optional
Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used. |
opaquePass |
Boolean
|
Pass.OPAQUE
|
optional
The pass to use in the DrawCommand for the opaque portions of the model. |
allowPicking |
Boolean
|
true
|
optional
When true , each primitive is pickable with Scene#pick . |
customShader |
CustomShader
|
|
optional
A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a Cesium3DTileStyle may lead to undefined behavior. |
content |
Cesium3DTileContent
|
|
optional
The tile content this model belongs to. This property will be undefined if model is not loaded as part of a tileset. |
show |
Boolean
|
true
|
optional
Whether or not to render the model. |
color |
Color
|
|
optional
A color that blends with the model's rendered color. |
colorBlendMode |
ColorBlendMode
|
ColorBlendMode.HIGHLIGHT
|
optional
Defines how the color blends with the model. |
colorBlendAmount |
Number
|
0.5
|
optional
Value used to determine the color strength when the colorBlendMode is MIX . A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two. |
featureIdLabel |
String
|
Number
|
"featureId_0"
|
optional
Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. |
instanceFeatureIdLabel |
String
|
Number
|
"instanceFeatureId_0"
|
optional
Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. |
pointCloudShading |
Object
|
|
optional
Options for constructing a PointCloudShading object to control point attenuation based on geometric error and lighting. |
clippingPlanes |
ClippingPlaneCollection
|
|
optional
The ClippingPlaneCollection used to selectively disable rendering the model. |
lightColor |
Cartesian3
|
|
optional
The light color when shading the model. When undefined the scene's light color is used instead. |
imageBasedLighting |
ImageBasedLighting
|
|
optional
The properties for managing image-based lighting on this model. |
backFaceCulling |
Boolean
|
true
|
optional
Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent. |
shadows |
ShadowMode
|
ShadowMode.ENABLED
|
optional
Determines whether the model casts or receives shadows from light sources. |
showCreditsOnScreen |
Boolean
|
false
|
optional
Whether to display the credits of this model on screen. |
splitDirection |
SplitDirection
|
SplitDirection.NONE
|
optional
The SplitDirection split to apply to this model. |
projectTo2D |
Boolean
|
false
|
optional
Whether to accurately project the model's positions in 2D. If a model is part of a 3D Tiles tileset, this will always be true. If this is false, the model will show up in 2D / CV mode but its positions may be inaccurate. This disables minimumPixelSize and prevents future modification to its model matrix. This also cannot be set after the model has loaded. |
|
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.
Members
The currently playing glTF animations.
Whether to cull back-facing geometry. When true, back face culling is
determined by the material's doubleSided property; when false, back face
culling is disabled. Back faces are not culled if the model's color is
translucent.
true
Gets the model's bounding sphere in world space. This does not take into account
glTF animations, skins, or morph targets. It also does not account for
ModelExperimental#minimumPixelSize
.
Determines if the model's animations should hold a pose over frames where no keyframes are specified.
true
The color to blend with the model's rendered color.
Value used to determine the color strength when the colorBlendMode
is MIX
. A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two.
0.5
Defines how the color blends with the model.
ColorBlendMode.HIGHLIGHT
The model's custom shader, if it exists. Using custom shaders with a
Cesium3DTileStyle
may lead to undefined behavior.
This property is for debugging only; it is not for production use nor is it optimized.
Draws the bounding sphere for each draw command in the model.
false
This property is for debugging only; it is not for production use nor is it optimized.
Draws the model in wireframe.
false
Label of the feature ID set to use for picking and styling.
For EXT_mesh_features, this is the feature ID's label property, or
"featureId_N" (where N is the index in the featureIds array) when not
specified. EXT_feature_metadata did not have a label field, so such
feature ID sets are always labeled "featureId_N" where N is the index in
the list of all feature Ids, where feature ID attributes are listed before
feature ID textures.
If featureIdLabel is set to an integer N, it is converted to
the string "featureId_N" automatically. 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 Cesium's standard deprecation policy.
The properties for managing image-based lighting on this model.
Label of the instance feature ID set used for picking and styling.
If instanceFeatureIdLabel is set to an integer N, it is converted to
the string "instanceFeatureId_N" automatically.
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 Cesium's standard deprecation policy.
The light color when shading the model. When
undefined
the scene's light color is used instead.
Disabling additional light sources by setting
model.imageBasedLighting.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.
undefined
The maximum scale size for a model. This can be used to give
an upper limit to the
Model#minimumPixelSize
, ensuring that the model
is never an unreasonable scale.
The approximate minimum pixel size of the model regardless of zoom.
This can be used to ensure that a model is visible even when the viewer
zooms out. When 0.0
, no minimum size is enforced.
0.0
Point cloud shading settings for controlling point cloud attenuation
and lighting. For 3D Tiles, this is inherited from the
Cesium3DTileset
.
When
true
, this model is ready to render, i.e., the external binary, image,
and shader files were downloaded and the WebGL resources were created. This is set to
true
right before
ModelExperimental#readyPromise
is resolved.
false
Gets the promise that will be resolved when this model is ready to render, i.e. when the external resources
have been downloaded and the WebGL resources are created.
This promise is resolved at the end of the frame before the first frame the model is rendered in.
A uniform scale applied to this model before the
Model#modelMatrix
.
Values greater than
1.0
increase the size of the model; values
less than
1.0
decrease.
1.0
Determines whether the model casts or receives shadows from light sources.
ShadowMode.ENABLED
Whether or not to render the model.
true
Gets or sets whether the credits of the model will be displayed on the screen
false
SplitDirection.NONE
Methods
Creates a model from a glTF asset. When the model is ready to render, i.e., when the external binary, image,
and shader files are downloaded and the WebGL resources are created, the Model#readyPromise
is resolved.
The model can be a traditional glTF asset with a .gltf extension or a Binary glTF using the .glb extension.
Name |
Type |
Description |
options |
Object
|
Object with the following properties:
Name |
Type |
Default |
Description |
url |
String
|
Resource
|
|
The url to the .gltf or .glb file. |
basePath |
String
|
Resource
|
''
|
optional
The base path that paths in the glTF JSON are relative to. |
modelMatrix |
Matrix4
|
Matrix4.IDENTITY
|
optional
The 4x4 transformation matrix that transforms the model from model to world coordinates. |
scale |
Number
|
1.0
|
optional
A uniform scale applied to this model. |
minimumPixelSize |
Number
|
0.0
|
optional
The approximate minimum pixel size of the model regardless of zoom. |
maximumScale |
Number
|
|
optional
The maximum scale size of a model. An upper limit for minimumPixelSize. |
incrementallyLoadTextures |
Boolean
|
true
|
optional
Determine if textures may continue to stream in after the model is loaded. |
releaseGltfJson |
Boolean
|
false
|
optional
When true, the glTF JSON is released once the glTF is loaded. This is is especially useful for cases like 3D Tiles, where each .gltf model is unique and caching the glTF JSON is not effective. |
debugShowBoundingVolume |
Boolean
|
false
|
optional
For debugging only. Draws the bounding sphere for each draw command in the model. |
enableDebugWireframe |
Boolean
|
false
|
optional
For debugging only. This must be set to true for debugWireframe to work in WebGL1. This cannot be set after the model has loaded. |
debugWireframe |
Boolean
|
false
|
optional
For debugging only. Draws the model in wireframe. Will only work for WebGL1 if enableDebugWireframe is set to true. |
cull |
Boolean
|
true
|
optional
Whether or not to cull the model using frustum/horizon culling. If the model is part of a 3D Tiles tileset, this property will always be false, since the 3D Tiles culling system is used. |
opaquePass |
Boolean
|
Pass.OPAQUE
|
optional
The pass to use in the DrawCommand for the opaque portions of the model. |
upAxis |
Axis
|
Axis.Y
|
optional
The up-axis of the glTF model. |
forwardAxis |
Axis
|
Axis.Z
|
optional
The forward-axis of the glTF model. |
allowPicking |
Boolean
|
true
|
optional
When true , each primitive is pickable with Scene#pick . |
customShader |
CustomShader
|
|
optional
A custom shader. This will add user-defined GLSL code to the vertex and fragment shaders. Using custom shaders with a Cesium3DTileStyle may lead to undefined behavior. |
content |
Cesium3DTileContent
|
|
optional
The tile content this model belongs to. This property will be undefined if model is not loaded as part of a tileset. |
show |
Boolean
|
true
|
optional
Whether or not to render the model. |
color |
Color
|
|
optional
A color that blends with the model's rendered color. |
colorBlendMode |
ColorBlendMode
|
ColorBlendMode.HIGHLIGHT
|
optional
Defines how the color blends with the model. |
colorBlendAmount |
Number
|
0.5
|
optional
Value used to determine the color strength when the colorBlendMode is MIX . A value of 0.0 results in the model's rendered color while a value of 1.0 results in a solid color, with any value in-between resulting in a mix of the two. |
featureIdLabel |
String
|
Number
|
"featureId_0"
|
optional
Label of the feature ID set to use for picking and styling. For EXT_mesh_features, this is the feature ID's label property, or "featureId_N" (where N is the index in the featureIds array) when not specified. EXT_feature_metadata did not have a label field, so such feature ID sets are always labeled "featureId_N" where N is the index in the list of all feature Ids, where feature ID attributes are listed before feature ID textures. If featureIdLabel is an integer N, it is converted to the string "featureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. |
instanceFeatureIdLabel |
String
|
Number
|
"instanceFeatureId_0"
|
optional
Label of the instance feature ID set used for picking and styling. If instanceFeatureIdLabel is set to an integer N, it is converted to the string "instanceFeatureId_N" automatically. If both per-primitive and per-instance feature IDs are present, the instance feature IDs take priority. |
pointCloudShading |
Object
|
|
optional
Options for constructing a PointCloudShading object to control point attenuation and lighting. |
clippingPlanes |
ClippingPlaneCollection
|
|
optional
The ClippingPlaneCollection used to selectively disable rendering the model. |
lightColor |
Cartesian3
|
|
optional
The light color when shading the model. When undefined the scene's light color is used instead. |
imageBasedLighting |
ImageBasedLighting
|
|
optional
The properties for managing image-based lighting on this model. |
backFaceCulling |
Boolean
|
true
|
optional
Whether to cull back-facing geometry. When true, back face culling is determined by the material's doubleSided property; when false, back face culling is disabled. Back faces are not culled if the model's color is translucent. |
shadows |
ShadowMode
|
ShadowMode.ENABLED
|
optional
Determines whether the model casts or receives shadows from light sources. |
showCreditsOnScreen |
Boolean
|
false
|
optional
Whether to display the credits of this model on screen. |
splitDirection |
SplitDirection
|
SplitDirection.NONE
|
optional
The SplitDirection split to apply to this model. |
projectTo2D |
Boolean
|
false
|
optional
Whether to accurately project the model's positions in 2D. If a model is part of a 3D Tiles tileset, this will always be true. If this is false, the model will show up in 2D / CV mode but its positions may be inaccurate. This disables minimumPixelSize and prevents future modification to its model matrix. This also cannot be set after the model has loaded. |
|
Returns:
The newly created model.
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:
model = model && model.destroy();
See:
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:
Called when
Viewer
or
CesiumWidget
render the scene to
get the draw commands needed to render this primitive.
Do not call this function directly. This is documented just to
list the exceptions that may be propagated when the scene is rendered:
Throws: