public static final class MeshStyle.Builder extends Object implements AutoCloseable
Constructor and Description |
---|
Builder(MeshStyle.Builder other) |
Modifier and Type | Method and Description |
---|---|
MeshStyle |
build()
Returns a newly created mesh style, based on the properties set on this builder.
|
void |
close() |
MeshStyle.Builder |
colorExpression(StyleExpression<android.graphics.Color> expression)
An expression to specify what colors to apply to mesh data.
|
MeshStyle.Builder |
displacementExpression(StyleExpression<Coordinate> expression)
An expression to displace mesh data.
|
MeshStyle.Builder |
facetCulling(FacetCullingType facetCullingType)
This setting determines which side of the surfaces (facets) that make up a mesh are omitted (culled) from the rendering result.
|
protected void |
finalize() |
MeshStyle.Builder |
visibilityExpression(StyleExpression<Boolean> expression)
An expression to filter mesh data.
|
public Builder(@NotNull MeshStyle.Builder other)
public void close()
close
in interface AutoCloseable
@NotNull public MeshStyle build()
@NotNull public MeshStyle.Builder colorExpression(@NotNull StyleExpression<android.graphics.Color> expression)
To create expressions, you must use the factory methods on StyleExpressionFactory
. The expression must be well-formed and resolve to a color value.
If you want to update the styling very often, consider using parameters
in your expression. Changing the values of parameters is more efficient than replacing the whole expression.
If you define a colorExpression, the texture data, if any, will not be displayed. The color expression will determine the color. Note that the alpha component of the color is ignored so the color will be fully opaque, unless you enable transparency
.
By default, no color expression is set, and the mesh will use the texture data of the mesh, if any.
expression
- a color expression@NotNull public MeshStyle.Builder displacementExpression(@NotNull StyleExpression<Coordinate> expression)
To create expressions, you must use the factory methods on StyleExpressionFactory
. The expression must be well-formed and resolve to a coordinate value. This coordinate is interpreted as a displacement vector during painting.
If you want to update the styling very often, consider using parameters
in your expressions. Changing the values of parameters is more efficient than replacing the whole expression.
By default, meshes are not displaced.
expression
- a coordinate expression@NotNull public MeshStyle.Builder visibilityExpression(@NotNull StyleExpression<Boolean> expression)
To create expressions, you must use the factory methods on StyleExpressionFactory
. The expression must be well-formed and resolve to a boolean value.
If you want to update the styling very often, consider using parameters
in your expressions. Changing the values of parameters is more efficient than replacing the whole expression.
By default, no expression is set. The entire mesh is visible.
expression
- a boolean expression@NotNull public MeshStyle.Builder facetCulling(@NotNull FacetCullingType facetCullingType)
When rendering meshes, all surfaces that make up the mesh face a certain direction. This direction is often called the normal direction. This normal is used to determine if the surface is being seen from the front or the back. When rendering objects that have no holes in them, it is only possible to see the front of all surfaces. Graphics pipelines therefore often don't render the back sides of those surfaces to speed up rendering.
Apart from performance, some applications are made possible by enabling back-face culling. Consider for example a mesh that represents a room. Its normals would all point to the inside of the room. When enabling back-face culling, you can see the walls and floor of the room, without having to move the camera inside the room itself.
In some cases however, enabling back-face culling (i.e. not rendering the back-side of surfaces) can have undesired artifacts. This can for example happen:
Both can be resolved by disabling culling.
By default, no culling takes place and both sides of a surface are painted.
facetCullingType
- the facet culling type to use