MaterialAppearance

new Cesium.MaterialAppearance(options)

任意几何图形的外观(例如,与EllipsoidSurfaceAppearance相反) 支持材质着色。
Name Type Description
options Object optional 具有以下属性的对象:
Name Type Default Description
flat Boolean false optional 在6666中,不考虑阴影,这意味着不考虑碎片。
faceForward Boolean !options.closed optionaltrue时,碎片着色器根据需要翻转曲面法线,以确保法线面向查看器以避免出现黑点。当几何体的两侧都应着色时,这很有用,如WallGeometry
translucent Boolean true optionaltrue时,几何体看起来是半透明的,因此MaterialAppearance#renderState启用了alpha混合。
closed Boolean false optionaltrue时,几何体应关闭,因此MaterialAppearance#renderState启用背面消隐。
materialSupport MaterialAppearance.MaterialSupportType MaterialAppearance.MaterialSupport.TEXTURED optional 将支持的材料类型。
material Material Material.ColorType optional 用来确定碎片颜色的材料。
vertexShaderSource String optional 可选的GLSL顶点着色器源来覆盖默认顶点着色器。
fragmentShaderSource String optional 可选的GLSL fragment shader source来覆盖默认片段着色器。
renderState Object optional 可选渲染状态以覆盖默认渲染状态。
Example:
var primitive = new Cesium.Primitive({
  geometryInstances : new Cesium.GeometryInstance({
    geometry : new Cesium.WallGeometry({
            materialSupport :  Cesium.MaterialAppearance.MaterialSupport.BASIC.vertexFormat,
      // ...
    })
  }),
  appearance : new Cesium.MaterialAppearance({
    material : Cesium.Material.fromType('Color'),
    faceForward : true
  })

});
Demo:
See:

Namespaces

MaterialSupport

Members

readonly closed : Boolean

true时,几何体应该这样闭合 MaterialAppearance#renderState已启用背面消隐。 如果查看器进入几何体,它将不可见。
Default Value: false

readonly faceForward : Boolean

true时,碎片着色器翻转曲面法线 如有必要,确保观察者避开法线 暗点。当几何体的两侧都应该 阴影像WallGeometry
Default Value: true

readonly flat : Boolean

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

readonly fragmentShaderSource : String

片段着色器的GLSL源代码。完整片段着色器 按照程序构建源时考虑到MaterialAppearance#materialMaterialAppearance#flatMaterialAppearance#faceForward。 使用MaterialAppearance#getFragmentShaderSource获取完整源代码。
用来确定碎片颜色的材料。不像其他的MaterialAppearance 属性,这不是只读的,因此外观的材质可以动态更改。
Default Value: Material.ColorType
See:
此实例支持的材质类型。这会影响所需的 VertexFormat以及顶点和碎片着色器的复杂性。
Default Value: MaterialAppearance.MaterialSupport.TEXTURED

readonly renderState : Object

WebGL修复了渲染几何体时要使用的函数状态。

The render state can be explicitly defined when constructing a MaterialAppearance instance, or it is set implicitly via MaterialAppearance#translucent and MaterialAppearance#closed.

translucent : Boolean

true时,几何体看起来是半透明的。
Default Value: true
此外观实例与VertexFormat兼容。 一个几何体可以有更多的顶点属性并且仍然是兼容的 潜在的性能成本-但它不能少。
Default Value: MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat

readonly vertexShaderSource : String

顶点着色器的GLSL源代码。

Methods

getFragmentShaderSource()String

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

getRenderState()Object

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

isTranslucent()Boolean

基于MaterialAppearance#translucentMaterial#isTranslucent确定几何体是否半透明。
Returns:
如果外观是半透明的,则为true

Type Definitions

Cesium.MaterialAppearance.MaterialSupportType

Properties:
Name Type Description
vertexFormat VertexFormat
vertexShaderSource String
fragmentShaderSource String