Appearance

new Cesium.Appearance(options)

外观(Appearance)定义了完整的 GLSL 顶点和片段着色器以及用于绘制 Primitive 的渲染状态。所有外观都实现此基础 Appearance 接口。
Name Type Description
options object optional 包含以下属性的对象:
Name Type Default Description
translucent boolean true optional 当为 true 时,几何体预计表现为半透明,因此 Appearance#renderState 会启用 alpha 混合。
closed boolean false optional 当为 true 时,几何体预计是封闭的,因此 Appearance#renderState 会启用背面剔除。
material Material Material.ColorType optional 用于确定片段颜色的材质。
vertexShaderSource string optional 可选的 GLSL 顶点着色器源代码,用于覆盖默认顶点着色器。
fragmentShaderSource string optional 可选的 GLSL 片段着色器源代码,用于覆盖默认片段着色器。
renderState object optional 可选的渲染状态,用于覆盖默认渲染状态。
Demo:
See:

Members

readonly closed : boolean

当为 true 时,几何体预计是封闭的。
Default Value: false

readonly fragmentShaderSource : string

片段着色器的 GLSL 源代码。完整的片段着色器源代码是通过考虑 Appearance#material 以程序化方式构建的。使用 Appearance#getFragmentShaderSource 获取完整的源代码。
用于确定片段颜色的材质。与其他 Appearance 属性不同,此属性不是只读的,因此外观的材质可以动态变化。
See:

readonly renderState : object

渲染几何体时使用的 WebGL 固定功能状态。

translucent : boolean

当为 true 时,几何体预计表现为半透明。
Default Value: true

readonly vertexShaderSource : string

顶点着色器的 GLSL 源代码。

Methods

getFragmentShaderSource()string

通过考虑 Appearance#fragmentShaderSourceAppearance#material,为此外观程序化地创建完整的 GLSL 片段着色器源代码。
Returns:
完整的 GLSL 片段着色器源代码。

getRenderState()object

创建渲染状态。这不是最终的渲染状态实例;相反,它可以包含与在上下文中创建的渲染状态相同的渲染状态属性子集。
Returns:
渲染状态。

isTranslucent()boolean

根据 Appearance#translucentMaterial#isTranslucent 确定几何体是否半透明。
Returns:
如果外观是半透明的,则返回 true
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.