Class MeshBuilder
- Last UpdatedJun 10, 2025
- 2 minute read
- java.lang.Object
-
- com.here.NativeBase
-
- com.here.sdk.mapview.MeshBuilder
-
- Direct Known Subclasses:
QuadMeshBuilder
,TriangleMeshBuilder
public class MeshBuilder extends NativeBase
Builder for meshes. Such meshes can contain different kinds of primitives, like quads or triangles. Both primitives support adding texture coordinates that are mapped to the corners of the primitives. See
TriangleMeshBuilder
andQuadMeshBuilder
for more details.Note: Normals cannot be set as they are not necessary when using the
MeshBuilder
.Example how to build a cube using
QuadMeshBuilder
Mesh cube = new MeshBuilder() .quad(new Point3D(0.5, 0.5, 0.5), new Point3D(-0.5, 0.5, 0.5), new Point3D(0.5, -0.5, 0.5), new Point3D(-0.5, -0.5, 0.5)) .quad(new Point3D(-0.5, 0.5, -0.5), new Point3D(0.5, 0.5, -0.5), new Point3D(-0.5, -0.5, -0.5), new Point3D(0.5, -0.5, -0.5)) .quad(new Point3D(0.5, 0.5, -0.5), new Point3D(0.5, 0.5, 0.5), new Point3D(0.5, -0.5, -0.5), new Point3D(0.5, -0.5, 0.5)) .quad(new Point3D(-0.5, 0.5, 0.5), new Point3D(-0.5, 0.5, -0.5), new Point3D(-0.5, -0.5, 0.5), new Point3D(-0.5, -0.5, -0.5)) .quad(new Point3D(-0.5, 0.5, 0.5), new Point3D(0.5, 0.5, 0.5), new Point3D(-0.5, 0.5, -0.5), new Point3D(0.5, 0.5, -0.5)) .quad(new Point3D(0.5, -0.5, 0.5), new Point3D(-0.5, -0.5, 0.5), new Point3D(0.5, -0.5, -0.5), new Point3D(-0.5, -0.5, -0.5)) .build();
-
-
Constructor Summary
Constructors Constructor Description MeshBuilder()
Constructs an instance of MeshBuilder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mesh
build()
QuadMeshBuilder
quad(Point3D a, Point3D b, Point3D c, Point3D d)
Adds a quad.TriangleMeshBuilder
triangle(Point3D a, Point3D b, Point3D c)
Adds a triangle.
-
-
-
Method Detail
-
triangle
@NonNull public TriangleMeshBuilder triangle(@NonNull Point3D a, @NonNull Point3D b, @NonNull Point3D c)
Adds a triangle.
Triangle visibility is determined via back-face culling. Front-facing triangles are expected to have counter-clockwise winding.
- Parameters:
a
-First vertex of the triangle.
b
-Second vertex of the triangle.
c
-Third vertex of the triangle.
- Returns:
A
TriangleMeshBuilder
instance.
-
quad
@NonNull public QuadMeshBuilder quad(@NonNull Point3D a, @NonNull Point3D b, @NonNull Point3D c, @NonNull Point3D d)
Adds a quad. Internally, this will be transformed into triangles abc and bdc.
Triangle visibility is determined via back-face culling. Front-facing triangles are expected to have counter-clockwise winding.
- Parameters:
a
-First vertex of quad.
b
-Second vertex of the quad.
c
-Third vertex of the quad.
d
-Fourth vertex of the quad.
- Returns:
A
QuadMeshBuilder
instance.
-
build
@Nullable public Mesh build()
- Returns:
mesh containing added geometry or 'null' if no geometry was added.
-
-