new EllipsoidSurfaceAppearance()
The appearance of ellipsoidal surface geometry, such as PolygonGeometry and Rectangle Geometry, supports all materials, such as MaterialAppearance and MaterialAppearance. materialsupport.all. However, this appearance requires fewer vertex attributes, as fragment shaders can programmatically calculate normal, tangent, and bitangent.
| Name | Type | Default | Description |
|---|---|---|---|
options.flat |
Boolean | false |
optional
When true, flat shading is used in the fragment shader, which means lighting is not taken into account. |
options.faceForward |
Boolean | options.aboveGround |
optional
When true, the fragment shader flips the surface normals as needed to ensure that the normals face the viewer and avoid black spots. This is useful when both sides of the geometry should be colored like WallGeometry. |
options.translucent |
Boolean | true |
optional
When true, the geometry will appear semi-transparent, so EllipsoidSurfaceAppearance#renderState enables alpha blending. |
options.aboveGround |
Boolean | false |
optional
When true, the geometry is expected to be on the surface of the ellipsoid - rather than at a constant height above it - so EllipsoidSurfaceAppearance # renderState enables backside culling. |
options.material |
Material | Material.ColorType |
optional
The material used to determine the color of the fragments. |
options.vertexShaderSource |
String |
optional
Optional GLSL vertex shading source, overriding default vertex shading. |
|
options.fragmentShaderSource |
String |
optional
Optional GLSL fragment shader source, overriding default fragment shading. |
|
options.renderState |
RenderState |
optional
Optional presentation state, overriding the default presentation state. |
Example
var primitive = new SuperMap3D.Primitive({
geometryInstances : new SuperMap3D.GeometryInstance({
geometry : new SuperMap3D.PolygonGeometry({
vertexFormat : SuperMap3D.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
// ...
})
}),
appearance : new SuperMap3D.EllipsoidSurfaceAppearance({
material : SuperMap3D.Material.fromType('Stripe')
})
});
Members
-
(static, constant) VERTEX_FORMATVertexFormat
-
All EllipsoidSurfaceAppearance instances are compatible with VertexFormat, which only requires the position and st properties. Other attributes are calculated by the program in the fragment shader.
-
readonly aboveGroundBoolean
-
When true, the geometry is expected to be on the surface of the ellipsoid - rather than at a constant height above it - so EllipsoidSurfaceAppearance # renderState enables backside culling.
- Default Value: false
readonly closedBoolean
When true, the geometry will be enclosed, so EllipsoidSurfaceAppearance # renderState will enable backside culling. If the observer enters the geometry, it will not be visible.
- Default Value: false
readonly faceForwardBoolean
When true, the fragment shader flips the surface normals as needed to ensure that the normals face the viewer and avoid black spots. This is useful when both sides of the geometry should be colored like WallGeometry.
- Default Value: true
readonly flatBoolean
When true, flat shading is used in the fragment shader, which means lighting is not taken into account.
- Default Value: false
readonly fragmentShaderSourceString
GLSL source code for fragment shader. The complete fragment shader source is built according to the program, considering EllipsoidSurfaceAppearance # material, EllipsoidSurfaceAppearance # flat, and EllipsoidSurfaceAppearance # faceForward. Use EllipsoidSurfaceAppearance # getFragmentShaderSource to obtain the complete source code.
materialMaterial
The material used to determine the color of the fragments. Unlike other EllipsoidSurfaceAppearance properties, this is not read-only, so the material of the appearance can be dynamically changed.
- Default Value:
Material.ColorTypereadonly renderStateObject
The WebGL fixed-function state used when rendering geometry.
The rendering state can be explicitly defined when constructing an EllipsoidSurfaceAppearance instance, or implicitly set through EllipsoidSurfaceAppearance # Translucent and EllipsoidSurfaceAppearance # aboveGround.
translucentBoolean
When true, the geometry should be semi transparent.
- Default Value: true
readonly vertexFormatVertexFormat
This appearance instance is compatible with VertexFormat. A geometry can have more vertex attributes, but still be compatible - at the cost of potential performance costs - but not less.
- Default Value:
EllipsoidSurfaceAppearance.VERTEX_FORMATreadonly vertexShaderSourceString
GLSL source code for vertex shader.
Methods
-
getFragmentShaderSource(){String}
-
Programmatically create a complete GLSL fragment shader source. For Ellipsoid Surface Appearance, this is from EllipsoidSurfaceAppearance#fragmentShaderSourcećEllipsoidSurfaceAppearance#flat Derived from EllipsoidSurfaceAppearance # faceForward.
Returns:
Type Description String Complete GLSL fragment shader source. -
getRenderState(){Object}
-
Create a presentation state. This is not the final presentation state instance. On the contrary, it can contain a subset of presentation state attributes that are the same as those created in the context.
Returns:
Type Description Object Rendering status. -
isTranslucent(){Boolean}
-
Determine whether the geometry is semi transparent based on EllipsoidSurfaceAppearance # translucent and Material # isTranslucent.
Returns:
Type Description Boolean If the appearance is semi transparent, it is true.