DebugAppearance

new Cesium.DebugAppearance(options)

通过将顶点属性显示为用于调试的颜色来可视化顶点属性。

已知单位长度向量的分量,即法向向量、 切线双切线是缩放和偏置的 从[-1.0, 1.0] to (-1.0, 1.0).

Name Type Description
options object 对象,具有以下属性:
Name Type Default Description
attributeName string 要可视化的属性的名称。
perInstanceAttribute boolean false optional 确定此属性是否为每个实例的几何属性的布尔值。
glslDatatype string 'vec3' optional 属性的 GLSL 数据类型。 支持的数据类型包括 floatvec2vec3vec4
vertexShaderSource string optional 可选的 GLSL 顶点着色器源,用于覆盖默认顶点着色器。
fragmentShaderSource string optional 可选的 GLSL 片段着色器源,用于覆盖默认片段着色器。
renderState object optional 可选的渲染状态来覆盖默认的渲染状态。
Throws:
  • DeveloperError : options.glslDatatype must be float, vec2, vec3, or vec4.
Example:
const primitive = new Cesium.Primitive({
  geometryInstances : // ...
  appearance : new Cesium.DebugAppearance({
    attributeName : 'normal'
  })
});

Members

readonly attributeName : string

正在可视化的属性的名称。

readonly closed : boolean

如果为 true,则几何图形应为闭合。
Default Value: false

readonly fragmentShaderSource : string

片段着色器的 GLSL 源代码。 完整的片段着色器 source 是按照程序构建的,考虑了 DebugAppearance#material。 使用 DebugAppearance#getFragmentShaderSource 获取完整源代码。

readonly glslDatatype : string

正在可视化的属性的 GLSL 数据类型。
此属性是 Appearance 接口的一部分,但不是 由 DebugAppearance 使用,因为使用的是完全自定义的片段着色器。
Default Value: undefined

readonly renderState : object

渲染几何体时使用的 WebGL 固定函数状态。
如果为 true,则几何体应显示为半透明。
Default Value: false

readonly vertexShaderSource : string

顶点着色器的 GLSL 源代码。

Methods

getFragmentShaderSource()string

返回完整的 GLSL 片段着色器源,对于 DebugAppearance,它只是 DebugAppearance#fragmentShaderSource.
Returns:
完整的 GLSL 片段着色器源。

getRenderState()object

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

isTranslucent()boolean

根据 DebugAppearance#translucent 确定几何体是否为半透明。
Returns:
true,如果外观是半透明的。
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.