English中文

DebugAppearance

new Cesium.DebugAppearance(options)

通过将顶点属性显示为调试颜色来可视化它。 Visualizes a vertex attribute by displaying it as a color for debugging.

众所周知的单位长度向量的组成部分,即 Components for well-known unit-length vectors, i.e., normal, tangent, 和 , and bitangent,从 [-1.0, 1.0] 缩放并偏置到 (-1.0, 1.0)。 , are scaled and biased from [-1.0, 1.0] to (-1.0, 1.0).

名称 Name 类型 Type 说明 Description
options object 具有以下属性的对象: Object with the following properties:
名称 Name 类型 Type 默认值 Default 说明 Description
attributeName string 要可视化的属性的名称。 The name of the attribute to visualize.
perInstanceAttribute boolean false 可选 optional 布尔值,确定该属性是否是每个实例的几何属性。 Boolean that determines whether this attribute is a per-instance geometry attribute.
glslDatatype string 'vec3' 可选 optional 属性的 GLSL 数据类型。支持的数据类型有 The GLSL datatype of the attribute. Supported datatypes are float, vec2, vec3, 和 , and vec4.
vertexShaderSource string 可选 optional 可选的 GLSL 顶点着色器源来覆盖默认顶点着色器。 Optional GLSL vertex shader source to override the default vertex shader.
fragmentShaderSource string 可选 optional 可选的 GLSL 片段着色器源来覆盖默认片段着色器。 Optional GLSL fragment shader source to override the default fragment shader.
renderState object 可选 optional 可选渲染状态覆盖默认渲染状态。 Optional render state to override the default render state.
抛出: Throws:
  • DeveloperError :options.glslDatatype 必须是 float、vec2、vec3 或 vec4。 : 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

正在可视化的属性的名称。 The name of the attribute being visualized.

readonly closed : boolean

When true,几何预计是封闭的。 , the geometry is expected to be closed.
默认值: Default Value: false

readonly fragmentShaderSource : string

片段着色器的 GLSL 源代码。完整的片段着色器源是在程序上构建的,考虑到 The GLSL source code for the fragment shader. The full fragment shader source is built procedurally taking into account the DebugAppearance#material。使用 . Use DebugAppearance#getFragmentShaderSource 获得完整的源码。 to get the full source.

readonly glslDatatype : string

正在可视化的属性的 GLSL 数据类型。 The GLSL datatype of the attribute being visualized.
此属性是 This property is part of the Appearance 接口,但不被使用 interface, but is not used by DebugAppearance 因为使用了完全自定义的片段着色器。 since a fully custom fragment shader is used.
默认值: Default Value: undefined

readonly renderState : object

渲染几何体时使用的 WebGL 固定功能状态。 The WebGL fixed-function state to use when rendering the geometry.
When true,几何体预计会呈现半透明。 , the geometry is expected to appear translucent.
默认值: Default Value: false

readonly vertexShaderSource : string

顶点着色器的 GLSL 源代码。 The GLSL source code for the vertex shader.

方法 Methods

getFragmentShaderSource()string

返回完整的 GLSL 片段着色器源,其中 Returns the full GLSL fragment shader source, which for DebugAppearance 只是 is just DebugAppearance#fragmentShaderSource.
返回: Returns:
完整的 GLSL 片段着色器源代码。 The full GLSL fragment shader source.

getRenderState()object

创建渲染状态。这不是最终的渲染状态实例;相反,它可以包含与上下文中创建的渲染状态相同的渲染状态属性的子集。 Creates a render state. This is not the final render state instance; instead, it can contain a subset of render state properties identical to the render state created in the context.
返回: Returns:
渲染状态。 The render state.

isTranslucent()boolean

确定几何体是否是半透明的 Determines if the geometry is translucent based on DebugAppearance#translucent.
返回: Returns:
true 如果外观是半透明的。 if the appearance is translucent.
需要帮助吗?获得答案的最快方法是从社区和团队那里获得答案 Need help? The fastest way to get answers is from the community and team on the Cesium Forum.