Class: EllipsoidSurfaceAppearance

EllipsoidSurfaceAppearance

new EllipsoidSurfaceAppearance()

椭球表面几何体的外观,如PolygonGeometryRectangleGeometry,它支持所有的材料,如MaterialAppearanceMaterialAppearance.materialsupport.all。 然而,这种外观需要更少的顶点属性,因为片段着色器可以程序地计算normaltangentbitangent

Name Type Default Description
options.flat Boolean false 可选

当为true时,在片段着色器中使用平面着色,这意味着照明不考虑在内。

options.faceForward Boolean options.aboveGround 可选

当为true时,碎片着色器根据需要翻转表面法线,以确保法线面向观看者,以避免黑点。当几何体的两边都应该像WallGeometry那样着色时,这很有用。

options.translucent Boolean true 可选

当为true时,几何体将呈现半透明,因此EllipsoidSurfaceAppearance#renderState启用alpha混合。

options.aboveGround Boolean false 可选

当为true时,几何体被期望在椭球体的表面上-而不是在它上面的恒定高度-所以EllipsoidSurfaceAppearance#renderState启用了背面剔除。

options.material Material Material.ColorType 可选

用来确定碎片颜色的材质。

options.vertexShaderSource String 可选

可选的GLSL顶点着色源,覆盖默认顶点着色。

options.fragmentShaderSource String 可选

可选的GLSL片段着色源,覆盖默认的片段着色。

options.renderState RenderState 可选

可选的呈现状态,覆盖默认呈现状态。

Example
var primitive = new SuperMap3D.Primitive({
  geometryInstances : new SuperMap3D.GeometryInstance({
    geometry : new SuperMap3D.PolygonGeometry({
      vertexFormat : SuperMap3D.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
      // ...
    })
  }),
  appearance : new SuperMap3D.EllipsoidSurfaceAppearance({
    material : SuperMap3D.Material.fromType('Stripe')
  })
});

Members

(static, constant) VERTEX_FORMATVertexFormat

所有EllipsoidSurfaceAppearance实例都兼容的VertexFormat,它只需要positionst属性。其他属性是在片段着色器中程序计算的。

readonly aboveGroundBoolean

当为true时,几何体被期望在椭球体的表面上-而不是在它上面的恒定高度-所以EllipsoidSurfaceAppearance#renderState启用了背面剔除。

Default Value:
false

readonly closedBoolean

当为true时,几何体将被封闭,因此EllipsoidSurfaceAppearance#renderState将启用背面剔除。如果观察者进入几何体,它将不可见。

Default Value:
false

readonly faceForwardBoolean

当为true时,碎片着色器根据需要翻转表面法线,以确保法线面向观看者,以避免黑点。当几何体的两边都应该像WallGeometry那样着色时,这很有用。

Default Value:
true

readonly flatBoolean

当为true时,在片段着色器中使用平面着色,这意味着照明不考虑在内。

Default Value:
false

readonly fragmentShaderSourceString

片段着色器的GLSL源代码。完整的片段着色器源是按程序构建的,考虑到EllipsoidSurfaceAppearance#materialEllipsoidSurfaceAppearance#flatEllipsoidSurfaceAppearance#faceForward。 使用EllipsoidSurfaceAppearance#getFragmentShaderSource获取完整的源代码。

materialMaterial

用来确定碎片颜色的材质。与其他EllipsoidSurfaceAppearance属性不同,这不是只读的,所以外观的材质可以动态更改。

Default Value:
Material.ColorType

readonly renderStateObject

渲染几何体时使用的WebGL固定函数状态。

渲染状态可以在构造EllipsoidSurfaceAppearance实例时显式定义,也可以通过EllipsoidSurfaceAppearance#半透明EllipsoidSurfaceAppearance#aboveGround隐式设置。

translucentBoolean

当为true时,几何体应该是半透明的。

Default Value:
true

readonly vertexFormatVertexFormat

这个外观实例兼容的VertexFormat。一个几何体可以有更多的顶点属性,但仍然是兼容的——以潜在的性能成本为代价——但不能少。

Default Value:
EllipsoidSurfaceAppearance.VERTEX_FORMAT

readonly vertexShaderSourceString

顶点着色器的GLSL源代码。

Methods

getFragmentShaderSource(){String}

程序化创建完整的 GLSL 片段着色器源。对于EllipsoidSurfaceAppearance来说,这是从EllipsoidSurfaceAppearance#fragmentShaderSourceEllipsoidSurfaceAppearance#flatEllipsoidSurfaceAppearance#faceForward衍生而来。

Returns:
Type Description
String 完整的 GLSL 片段着色器源。

getRenderState(){Object}

创建一个呈现状态。这不是最终的呈现状态实例。相反,它可以包含与上下文中创建的呈现状态相同的呈现状态属性子集。

Returns:
Type Description
Object 渲染状态。

isTranslucent(){Boolean}

根据EllipsoidSurfaceAppearance#translucentMaterial#isTranslucent 确定几何体是否半透明。

Returns:
Type Description
Boolean 如果外观是半透明的,则为 true。