EllipsoidSurfaceAppearance

new Cesium.EllipsoidSurfaceAppearance(options)

为椭球体表面的几何体提供一种外观,例如 PolygonGeometryRectangleGeometry,支持所有材质,如 MaterialAppearanceMaterialAppearance.MaterialSupport.ALL。然而,该外观所需的顶点属性更少,因为片段着色器可以程序性地计算 normaltangentbitangent
Name Type Description
options object optional 具有以下属性的对象:
Name Type Default Description
flat boolean false optionaltrue 时,片段着色器使用平面阴影,这意味着光照不会被考虑。
faceForward boolean options.aboveGround optionaltrue 时,片段着色器根据需要翻转表面法线,以确保法线面向观察者,避免暗点。当几何体的两侧都应着色时,这在 WallGeometry 中非常有用。
translucent boolean true optionaltrue 时,几何体预期显示为半透明,因此 EllipsoidSurfaceAppearance#renderState 启用 alpha 混合。
aboveGround boolean false optionaltrue 时,几何体预期位于椭球体表面,而不是在其上方恒定高度,因此 EllipsoidSurfaceAppearance#renderState 启用背面剔除。
material Material Material.ColorType optional 用于确定片段颜色的材质。
vertexShaderSource string optional 可选的 GLSL 顶点着色器源,以覆盖默认的顶点着色器。
fragmentShaderSource string optional 可选的 GLSL 片段着色器源,以覆盖默认的片段着色器。
renderState object optional 可选的渲染状态,以覆盖默认的渲染状态。
Example:
const primitive = new Cesium.Primitive({
  geometryInstances : new Cesium.GeometryInstance({
    geometry : new Cesium.PolygonGeometry({
      vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
      // ...
    })
  }),
  appearance : new Cesium.EllipsoidSurfaceAppearance({
    material : Cesium.Material.fromType('Stripe')
  })
});
See:

Members

static constant Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT : VertexFormat

所有 EllipsoidSurfaceAppearance 实例兼容的 VertexFormat,仅要求 positionst 属性。其他属性在片段着色器中程序性计算得出。
true 时,几何体预期位于椭球体的 表面——而不是在其上方的恒定高度——所以 EllipsoidSurfaceAppearance#renderState 启用背面剔除。
Default Value: false
true 时,几何图形应闭合,以便 EllipsoidSurfaceAppearance#renderState 启用背面剔除。 如果观察者进入几何体,它将不可见。
Default Value: false
true 时,片段着色器根据需要翻转表面法线, 以确保法线面向观察者,避免 暗点。这在几何体的两侧都应着色时非常有用, 如 WallGeometry
Default Value: true
true 时,片段着色器使用平面阴影, 这意味着光照不被考虑。
Default Value: false

readonly fragmentShaderSource : string

片段着色器的 GLSL 源代码。完整的片段着色器 源代码是程序性构建的,考虑了 EllipsoidSurfaceAppearance#materialEllipsoidSurfaceAppearance#flatEllipsoidSurfaceAppearance#faceForward。 使用 EllipsoidSurfaceAppearance#getFragmentShaderSource 获取完整源代码。
用于确定片段颜色的材质。与其他 EllipsoidSurfaceAppearance 属性不同,这个属性不是只读的,因此外观的材质可以动态更改。
Default Value: Material.ColorType
See:
渲染几何体时使用的 WebGL 固定功能状态。

渲染状态可以在构建 EllipsoidSurfaceAppearance 实例时显式定义,或通过 EllipsoidSurfaceAppearance#translucentEllipsoidSurfaceAppearance#aboveGround 隐式设置。

true 时,几何体预期显示为半透明。
Default Value: true
此外观实例兼容的 VertexFormat。 几何体可以有更多的顶点属性,仍然兼容—— 但可能会牺牲性能——但不能更少。
Default Value: EllipsoidSurfaceAppearance.VERTEX_FORMAT

readonly vertexShaderSource : string

顶点着色器的 GLSL 源代码。

Methods

getFragmentShaderSource()string

程序性地创建完整的 GLSL 片段着色器源代码。对于 EllipsoidSurfaceAppearance, 这来源于 EllipsoidSurfaceAppearance#fragmentShaderSourceEllipsoidSurfaceAppearance#flatEllipsoidSurfaceAppearance#faceForward
Returns:
完整的 GLSL 片段着色器源代码。
创建一个渲染状态。这不是最终的渲染状态实例;相反, 它可以包含与上下文中创建的渲染状态相同的部分渲染状态属性。
Returns:
渲染状态。
根据 EllipsoidSurfaceAppearance#translucentMaterial#isTranslucent 判断几何体是否为半透明。
Returns:
true 如果外观是半透明的。
需要帮助?获得答案的最快方法是来自社区和团队 Cesium Forum.