DebugAppearance

new Cesium.DebugAppearance(options)

通过将顶点属性显示为一种颜色以供调试时使用,从而将其可视化。

已知单位长度向量的分量,即, normal,tan , 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 RenderState optional 可选的渲染状态来覆盖默认的渲染状态。
Throws:
  • DeveloperError : options.glslDatatype 必须是float, vec2, vec3, 或 vec4。
Example:
var primitive = new Cesium.Primitive({
  geometryInstances : // ...
  appearance : new Cesium.DebugAppearance({
    attributeName : 'normal'
  })
});

Members

readonlyattributeName : String

要显示的属性的名称。

readonlyclosed : Boolean

当true时,几何图形将启用背面剔除。
Default Value: false

readonlyfragmentShaderSource : String

片段着色器的GLSL源代码。 完整的片段着色器源程序是根据DebugAppearance#material构建的,使用DebugAppearance#getFragmentShaderSource获取完整的源代码。

readonlyglslDatatype : String

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

readonlyrenderState : Object

在渲染几何图形时使用的WebGL渲染状态。

translucent : Boolean

当true时,几何图形应该是半透明的。
Default Value: false

readonlyvertexShaderSource : String

顶点着色器的GLSL源代码。

Methods

getFragmentShaderSource() → String

返回完整的GLSL片段着色器,对于DebugAppearance来说就是DebugAppearance#fragmentShaderSource。
Returns:
完整的GLSL片段着色器。

getRenderState() → Object

创建渲染状态。
Returns:
渲染状态。

isTranslucent() → Boolean

基于DebugAppearance#translucent确定几何图形是否是半透明的。
Returns:
如果外观是半透明的返回true。