一种用于任意几何体的外观(例如,与
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 |
