一个用于任意几何体的外观(例如,与
EllipsoidSurfaceAppearance 相对)
,支持使用材料进行着色。
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
optional
包含以下属性的对象:
|
Example:
const 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
Members
当
true 时,几何图形应闭合,
MaterialAppearance#renderState 启用背面剔除。
如果观察者进入几何体,它将不可见。
-
Default Value:
false
当
true 时,片段着色器会根据需要翻转表面法线,
以确保法线面向观察者,避免暗斑。
当几何体的两面都应按 WallGeometry 着色时,这非常有用。
-
Default Value:
true
当
true 时,片段着色器采用平面着色,
这意味着不考虑光照。
-
Default Value:
false
片段着色器的 GLSL 源代码。完整的片段着色器
源代码是根据
MaterialAppearance#material、
MaterialAppearance#flat 和 MaterialAppearance#faceForward
构建的。使用 MaterialAppearance#getFragmentShaderSource 获取完整源代码。
用于确定片段颜色的材料。与其他
MaterialAppearance
属性不同,该属性不是只读的,因此外观的材料可以动态更改。
-
Default Value:
Material.ColorType
See:
readonly materialSupport : MaterialAppearance.MaterialSupportType
此实例支持的材料类型。这会影响所需的
VertexFormat 以及顶点和片段着色器的复杂性。
-
Default Value:
MaterialAppearance.MaterialSupport.TEXTURED
渲染几何体时使用的 WebGL 固定函数状态。
渲染状态可以在构造 MaterialAppearance
实例时显式定义,或者通过 MaterialAppearance#translucent
和 MaterialAppearance#closed 隐式设置。
当
true 时,几何体预期呈现出半透明效果。
-
Default Value:
true
readonly vertexFormat : VertexFormat
此外观实例与之兼容的
VertexFormat。
几何体可以具有更多的顶点属性,并仍然兼容 - 可能
会影响性能 - 但不能更少。
-
Default Value:
MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat
顶点着色器的 GLSL 源代码。
Methods
以程序方式创建完整的 GLSL 片段着色器源代码。对于
MaterialAppearance,
这是从 MaterialAppearance#fragmentShaderSource、 MaterialAppearance#material、
MaterialAppearance#flat 和 MaterialAppearance#faceForward 派生的。
Returns:
完整的 GLSL 片段着色器源代码。
创建一个渲染状态。这不是最终的渲染状态实例;相反,
它可以包含与在上下文中创建的渲染状态相同的渲染状态属性的子集。
Returns:
渲染状态。
根据
MaterialAppearance#translucent 和 Material#isTranslucent 确定几何体是否为半透明。
Returns:
true 如果外观是半透明的。
Type Definitions
Properties:
| Name | Type | Description |
|---|---|---|
vertexFormat |
VertexFormat | |
vertexShaderSource |
string | |
fragmentShaderSource |
string |
