EllipsoidSurfaceAppearance

new Cesium.EllipsoidSurfaceAppearance(options)

用于椭球表面几何(如 PolygonGeometryRectangleGeometry)的外观,支持所有 MaterialAppearance 搭配 MaterialAppearance.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

Procedurally creates the full GLSL fragment shader source. For EllipsoidSurfaceAppearance, this is derived from EllipsoidSurfaceAppearance#fragmentShaderSource, EllipsoidSurfaceAppearance#flat, and EllipsoidSurfaceAppearance#faceForward.
Returns:
The full GLSL fragment shader source.
Creates a render state. This is not the final render state instance; instead, it can contain a subset of render state properties identical to the render state created in the context.
Returns:
The render state.
Determines if the geometry is translucent based on EllipsoidSurfaceAppearance#translucent and Material#isTranslucent.
Returns:
true if the appearance is translucent.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.