DebugAppearance

new Cesium.DebugAppearance(options)

通过将其显示为颜色来可视化顶点属性,以便进行调试。

组件适用于著名的单位长度向量,即 normal, tangent 和 bitangent,并且 从 [-1.0, 1.0] 缩放和偏移到 (-1.0, 1.0)。

Name Type Description
options object 具有以下属性的对象:
Name Type Default Description
attributeName string 要可视化的属性名称。
perInstanceAttribute boolean false optional 布尔值,用于确定该属性是否为每实例几何属性。
glslDatatype string 'vec3' optional 属性的 GLSL 数据类型。支持的数据类型有 float、vec2、vec3 和 vec4。
vertexShaderSource string optional 可选的 GLSL 顶点着色器源,用于覆盖默认的顶点着色器。
fragmentShaderSource string optional 可选的 GLSL 片元着色器源,用于覆盖默认的片元着色器。
renderState object optional 可选的渲染状态,用于覆盖默认的渲染状态。
Throws:
  • DeveloperError : options.glslDatatype 必须是 float、vec2、vec3 或 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 源代码。完整的片元着色器 源代码是根据 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。
需要帮助?获得答案的最快方法是来自社区和团队 Cesium Forum.