picogl.renderer.mesh_builder
Accumulate indexed mesh parts into a single MeshData.
Attributes
Classes
Accumulate mesh parts into one indexed mesh with face-index offsets. |
Functions
|
Build a |
|
Attach face indices to a |
|
Concatenate mesh parts with face-index offsets. |
Module Contents
- picogl.renderer.mesh_builder.solid_color_mesh_part(vertices: numpy.ndarray, faces: numpy.ndarray, normals: numpy.ndarray, color: Tuple[float, float, float] = (0.7, 0.7, 0.7)) MeshPart[source]
Build a
MeshPartwith a single RGB colour tiled per vertex.- Parameters:
vertices –
(N, 3)positionsfaces –
(M, 3)or flat index buffernormals –
(N, 3)normalscolor – RGB triple in
[0, 1]
- Returns:
MeshPart tuple
- picogl.renderer.mesh_builder.mesh_part_from_pnc(pnc, faces: numpy.ndarray) MeshPart[source]
Attach face indices to a
PNCPart.- Parameters:
pnc –
(positions, normals, colors)faces –
(M, 3)or flat index buffer
- Returns:
MeshPart
(positions, faces, normals, colors)
- class picogl.renderer.mesh_builder.MeshBuilder[source]
Accumulate mesh parts into one indexed mesh with face-index offsets.
Each part is
(vertices, faces, normals, colors). Face indices in subsequent parts are offset so they remain valid after concatenation.- vertices: List[numpy.ndarray] = [][source]
- faces: List[numpy.ndarray] = [][source]
- normals: List[numpy.ndarray] = [][source]
- colors: List[numpy.ndarray] = [][source]
- add_part(part: MeshPart | None) None[source]
Append one mesh part, skipping
None/ empty vertex arrays.- Parameters:
part –
(vertices, faces, normals, colors)orNone.facesmay be(M, 3)triangles or a flat index buffer.
- build() MeshPart | None[source]
Stack accumulated parts into
(vertices, faces, normals, colors).- Returns:
Stacked
MeshPart, orNonewhen no parts were added
- mesh_data() picogl.renderer.meshdata.MeshData | None[source]
Build a
MeshDatafrom parts.- Returns:
MeshData, or
Nonewhen no parts were added
- __enter__() MeshBuilder[source]