English中文

ModelGraphics

new Cesium.ModelGraphics(options)

3D模型基于 A 3D model based on glTF,WebGL、OpenGL ES 和 OpenGL 的运行时资源格式。模型的位置和方向由包含的元素决定 , the runtime asset format for WebGL, OpenGL ES, and OpenGL. The position and orientation of the model is determined by the containing Entity.

Cesium 包括对 glTF 几何、材质、动画和蒙皮的支持。目前不支持相机和灯光。 Cesium includes support for glTF geometry, materials, animations, and skinning. Cameras and lights are not currently supported.

名称 Name 类型 Type 说明 Description
options ModelGraphics.ConstructorOptions 可选 optional 描述初始化选项的对象 Object describing initialization options
演示: Demo:

成员 Members

获取或设置要应用于此模型的关节值集。这表示为 Gets or sets the set of articulation values to apply to this model. This is represented as an PropertyBag,其中键由发音名称、单个空格和舞台名称组成。 , where keys are composed as the name of the articulation, a single space, and the name of the stage.
获取或设置布尔属性,指定 glTF 动画是否应在没有关键帧的情况下保持最后一个姿势一段时间。 Gets or sets the boolean Property specifying if glTF animations should hold the last pose for time durations with no keyframes.
默认值: Default Value: true
指定的属性 A property specifying the ClippingPlaneCollection 用于有选择地禁用渲染模型。 used to selectively disable rendering the model.
获取或设置指定的属性 Gets or sets the Property specifying the Color 与模型的渲染颜色混合。 that blends with the model's rendered color.
默认值: Default Value: Color.WHITE
指定颜色强度的数字属性 A numeric Property specifying the color strength when the colorBlendMode 是混合。值 0.0 会产生模型的渲染颜色,而值 1.0 会产生纯色,中间的任何值都会产生两者的混合。 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.
默认值: Default Value: 0.5
获取或设置指定颜色如何与模型混合的枚举属性。 Gets or sets the enum Property specifying how the color blends with the model.
默认值: Default Value: ColorBlendMode.HIGHLIGHT
获取或设置 Gets or sets the CustomShader 应用于该模型。当 to apply to this model. When undefined,不使用自定义着色器代码。 , no custom shader code is used.
获取每当更改或修改属性或子属性时引发的事件。 Gets the event that is raised whenever a property or sub-property is changed or modified.

distanceDisplayCondition : Property|undefined

获取或设置 Gets or sets the DistanceDisplayCondition 属性指定该模型将在距相机的距离处显示。 Property specifying at what distance from the camera that this model will be displayed.

enableVerticalExaggeration : Property|undefined

获取或设置布尔属性,指定模型在以下情况下是否沿椭球法线夸大 Gets or sets the boolean Property specifying if the model is exaggerated along the ellipsoid normal when Scene.verticalExaggeration 被设置为除 is set to a value other than 1.0.
默认值: Default Value: true
获取或设置 Gets or sets the DynamicEnvironmentMapManager.ConstructorOptions 应用于该模型。这表示为 to apply to this model. This is represented as an PropertyBag.
获取或设置指定的属性 Gets or sets the Property specifying the HeightReference.
默认值: Default Value: HeightReference.NONE

imageBasedLightingFactor : Property|undefined

指定的属性 A property specifying the Cartesian2 用于缩放基于漫反射和镜面反射图像的照明对最终颜色的贡献。 used to scale the diffuse and specular image-based lighting contribution to the final color.

incrementallyLoadTextures : Property|undefined

获取或设置布尔属性,指定加载模型后纹理是否可以继续流入。 Get or sets the boolean Property specifying whether textures may continue to stream in after the model is loaded.
指定的属性 A property specifying the Cartesian3 为模型着色时的浅色。当 light color when shading the model. When undefined 而是使用场景的浅色。 the scene's light color is used instead.
获取或设置指定模型最大比例尺寸的数值属性。该属性用作上限 Gets or sets the numeric Property specifying the maximum scale size of a model. This property is used as an upper limit for ModelGraphics#minimumPixelSize.
获取或设置数字属性,指定模型的近似最小像素大小,无论缩放如何。这可用于确保即使观察者缩小时模型也可见。当 Gets or sets the numeric Property specifying 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.
默认值: Default Value: 0.0
获取或设置要应用于此模型的节点转换集。这表示为 Gets or sets the set of node transformations to apply to this model. This is represented as an PropertyBag,其中键是节点的名称,值是 , where keys are names of nodes, and values are TranslationRotationScale 描述要应用于该节点的转换的属性。该变换在 glTF 中指定的节点的现有变换之后应用,并且不会替换节点的现有变换。 Properties describing the transformation to apply to that node. The transformation is applied after the node's existing transformation as specified in the glTF, and does not replace the node's existing transformation.
获取或设置布尔属性,指定是否应运行 glTF 动画。 Gets or sets the boolean Property specifying if glTF animations should be run.
默认值: Default Value: true
获取或设置指定此模型的统一线性比例的数值属性。大于 1.0 的值会增加模型的大小,而小于 1.0 的值会减小模型的大小。 Gets or sets the numeric Property specifying a uniform linear scale for this model. Values greater than 1.0 increase the size of the model while values less than 1.0 decrease it.
默认值: Default Value: 1.0
获取或设置枚举属性,指定模型是否投射或接收来自光源的阴影。 Get or sets the enum Property specifying whether the model casts or receives shadows from light sources.
默认值: Default Value: ShadowMode.ENABLED
获取或设置指定模型可见性的布尔属性。 Gets or sets the boolean Property specifying the visibility of the model.
默认值: Default Value: true
获取或设置指定的属性 Gets or sets the Property specifying the Color 的剪影。 of the silhouette.
默认值: Default Value: Color.RED
获取或设置指定轮廓大小(以像素为单位)的数字属性。 Gets or sets the numeric Property specifying the size of the silhouette in pixels.
默认值: Default Value: 0.0
获取或设置指定 glTF 资源的 URI 的字符串属性。 Gets or sets the string Property specifying the URI of the glTF asset.

方法 Methods

复制此实例。 Duplicates this instance.
名称 Name 类型 Type 说明 Description
result ModelGraphics 可选 optional 用于存储结果的对象。 The object onto which to store the result.
返回: Returns:
修改后的结果参数或新实例(如果未提供)。 The modified result parameter or a new instance if one was not provided.
将此对象上每个未分配的属性分配给所提供的源对象上相同属性的值。 Assigns each unassigned property on this object to the value of the same property on the provided source object.
名称 Name 类型 Type 说明 Description
source ModelGraphics 要合并到此对象中的对象。 The object to be merged into this object.

类型定义 Type Definitions

Cesium.ModelGraphics.ConstructorOptions

ModelGraphics 构造函数的初始化选项 Initialization options for the ModelGraphics constructor
属性: Properties:
名称 Name 类型 Type Attributes 默认值 Default 说明 Description
show Property | boolean <可选> &lt;optional>
true 指定模型可见性的布尔属性。 A boolean Property specifying the visibility of the model.
uri Property | string | Resource <可选> &lt;optional>
指定 glTF 资源 URI 的字符串或资源属性。 A string or Resource Property specifying the URI of the glTF asset.
scale Property | number <可选> &lt;optional>
1.0 指定统一线性比例的数字属性。 A numeric Property specifying a uniform linear scale.
enableVerticalExaggeration Property | boolean <可选> &lt;optional>
true 一个布尔属性,指定模型是否沿椭圆体法线夸大 A boolean Property specifying if the model is exaggerated along the ellipsoid normal when Scene.verticalExaggeration 被设置为除 is set to a value other than 1.0.
minimumPixelSize Property | number <可选> &lt;optional>
0.0 一个数字属性,指定模型的近似最小像素大小,无论缩放如何。 A numeric Property specifying the approximate minimum pixel size of the model regardless of zoom.
maximumScale Property | number <可选> &lt;optional>
模型的最大比例尺寸。 minimumPixelSize 的上限。 The maximum scale size of a model. An upper limit for minimumPixelSize.
incrementallyLoadTextures Property | boolean <可选> &lt;optional>
true 确定加载模型后纹理是否可以继续流入。 Determine if textures may continue to stream in after the model is loaded.
runAnimations Property | boolean <可选> &lt;optional>
true 一个布尔属性,指定是否应启动模型中指定的 glTF 动画。 A boolean Property specifying if glTF animations specified in the model should be started.
clampAnimations Property | boolean <可选> &lt;optional>
true 一个布尔属性,指定 glTF 动画是否应在没有关键帧的情况下保持最后一个姿势一段时间。 A boolean Property specifying if glTF animations should hold the last pose for time durations with no keyframes.
shadows Property | ShadowMode <可选> &lt;optional>
ShadowMode.ENABLED 一个枚举属性,指定模型是否投射或接收来自光源的阴影。 An enum Property specifying whether the model casts or receives shadows from light sources.
heightReference Property | HeightReference <可选> &lt;optional>
HeightReference.NONE 指定高度相对值的属性。 A Property specifying what the height is relative to.
silhouetteColor Property | Color <可选> &lt;optional>
Color.RED 指定的属性 A Property specifying the Color 的剪影。 of the silhouette.
silhouetteSize Property | number <可选> &lt;optional>
0.0 一个数字属性,指定轮廓的大小(以像素为单位)。 A numeric Property specifying the size of the silhouette in pixels.
color Property | Color <可选> &lt;optional>
Color.WHITE 指定的属性 A Property specifying the Color 与模型的渲染颜色混合。 that blends with the model's rendered color.
colorBlendMode Property | ColorBlendMode <可选> &lt;optional>
ColorBlendMode.HIGHLIGHT 一个枚举属性,指定颜色如何与模型混合。 An enum Property specifying how the color blends with the model.
colorBlendAmount Property | number <可选> &lt;optional>
0.5 指定颜色强度的数字属性 A numeric Property specifying the color strength when the colorBlendMode is MIX。值 0.0 会产生模型的渲染颜色,而值 1.0 会产生纯色,中间的任何值都会产生两者的混合。 . 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.
imageBasedLightingFactor Property | Cartesian2 <可选> &lt;optional>
新笛卡尔2(1.0, 1.0) new Cartesian2(1.0, 1.0) 指定基于漫反射和镜面反射图像的照明的贡献的属性。 A property specifying the contribution from diffuse and specular image-based lighting.
environmentMapOptions PropertyBag | Object.<string, *> <可选> &lt;optional>
用于管理动态环境的属性映射到该实体上。 The properties for managing dynamic environment maps on this entity.
lightColor Property | Color <可选> &lt;optional>
指定模型着色时的光颜色的属性。当 A property specifying the light color when shading the model. When undefined 而是使用场景的浅色。 the scene's light color is used instead.
distanceDisplayCondition Property | DistanceDisplayCondition <可选> &lt;optional>
一个属性,指定该模型将在距相机的距离处显示。 A Property specifying at what distance from the camera that this model will be displayed.
nodeTransformations PropertyBag | Object.<string, TranslationRotationScale> <可选> &lt;optional>
一个对象,其中键是节点的名称,值是 An object, where keys are names of nodes, and values are TranslationRotationScale 描述要应用于该节点的转换的属性。该变换在 glTF 中指定的节点的现有变换之后应用,并且不会替换节点的现有变换。 Properties describing the transformation to apply to that node. The transformation is applied after the node's existing transformation as specified in the glTF, and does not replace the node's existing transformation.
articulations PropertyBag | Object.<string, number> <可选> &lt;optional>
一个对象,其中键由发音名称、单个空格和阶段名称组成,值是数字属性。 An object, where keys are composed of an articulation name, a single space, and a stage name, and the values are numeric properties.
clippingPlanes Property | ClippingPlaneCollection <可选> &lt;optional>
指定的属性 A property specifying the ClippingPlaneCollection 用于有选择地禁用渲染模型。 used to selectively disable rendering the model.
customShader Property | CustomShader <可选> &lt;optional>
指定的属性 A property specifying the CustomShader 应用于该模型。 to apply to this model.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.