new Appearance()
Used to control Primitive visualization effect classes. Shade and render geometry by defining GLSL shader programs, material properties, and rendering states.
| Name | Type | Default | Description |
|---|---|---|---|
options.translucent |
Boolean | true |
optional
When true, it indicates that the geometry needs to present a semi transparent effect, so Appearance # renderState has enabled alpha blending. |
options.closed |
Boolean | false |
optional
When true, it indicates that the geometry should be a closed structure, so Appearance # renderState will enable backside culling. |
options.material |
Material | Material.ColorType |
optional
The material used to determine the color of the fragment. |
options.vertexShaderSource |
String |
optional
Optional GLSL vertex shader source code, used to replace the default vertex shader implementation. |
|
options.fragmentShaderSource |
String |
optional
Optional GLSL fragment shader source code, used to replace the default fragment shader implementation. |
|
options.renderState |
RenderState |
optional
Optional presentation state, replacing the default presentation state. |
Members
-
readonly closedBoolean
-
When true, the geometry should be a closed structure.
- Default Value: false
readonly fragmentShaderSourceString
GLSL source code for fragment shader. Considering Appearance # material, the complete fragment shader source code is built according to the program. Use Appearance # getFragmentShaderSource to obtain the complete source code.
materialMaterial
The material used to determine the color of the fragment. Unlike other properties of appearance, this property is not read-only, so the material of the appearance can be dynamically modified in real-time.
readonly renderStateObject
The WebGL fixed function pipeline state used when rendering geometry.
translucentBoolean
When true, the geometry appears semi transparent.
- Default Value: true
readonly vertexShaderSourceString
GLSL source code for vertex shader.
Methods
-
getFragmentShaderSource(){String}
-
Generate complete GLSL fragment shader source code suitable for the appearance through programmatic means, taking into account the parameter settings of Appearance # fragmentShaderSource and Appearance # material.
Returns:
Type Description String Complete GLSL fragment shader source code. -
getRenderState(){Object}
-
Create a rendering state. This object is not the final rendering state instance, but can contain a subset of rendering state attributes that are exactly the same as those created in the context.
Returns:
Type Description Object Rendering status. -
isTranslucent(){Boolean}
-
Determine whether the geometric appearance has a semi transparent effect based on Appearance # transparent and Material # isTranslucent.
Returns:
Type Description Boolean If the appearance appears semi transparent, it is true.