picogl.renderer.mesh_arrays =========================== .. py:module:: picogl.renderer.mesh_arrays .. autoapi-nested-parse:: CPU-side mesh arrays used by geometry builders. Classes ------- .. autoapisummary:: picogl.renderer.mesh_arrays.MeshArrays Module Contents --------------- .. py:class:: MeshArrays Immutable NumPy arrays for positions, normals, colors, and indices. Geometry producers return this type. Color is optional: atom/bond geometry typically omits it, and :class:`~picogl.renderer.molecular.atoms.AtomsMesh` / :class:`~picogl.renderer.molecular.bonds.BondsMesh` attach it later. Primitive mode is not stored here; :meth:`as_meshdata` supplies :class:`~picogl.renderer.draw_spec.MeshDrawInfo`. .. py:attribute:: positions :type: numpy.ndarray .. py:attribute:: normals :type: numpy.ndarray .. py:attribute:: colors :type: Optional[numpy.ndarray] :value: None .. py:attribute:: indices :type: Optional[numpy.ndarray] :value: None .. py:method:: __post_init__() -> None .. py:property:: indexed :type: bool Whether this mesh carries an index buffer. .. py:method:: from_pnc(part: picogl.renderer.meshdata.PNCPart, *, indices: Optional[numpy.ndarray] = None) -> MeshArrays :classmethod: Build :class:`MeshArrays` from a :data:`~picogl.renderer.meshdata.PNCPart`. :param part: ``(positions, normals, colors)`` :param indices: Optional element buffer :return: New MeshArrays value .. py:method:: as_pnc() -> picogl.renderer.meshdata.PNCPart Return ``(positions, normals, colors)``. :raises ValueError: When colors are missing .. py:method:: with_colors(colors: numpy.ndarray) -> MeshArrays Return a copy with *colors* replacing the current color array. :param colors: RGB triples with shape ``(3,)`` or ``(N, 3)``. :returns: New value with the same positions, normals, and indices. :rtype: MeshArrays .. py:method:: as_meshdata(*, mode: picogl.backend.gl.enums.GLDrawMode = GLDrawMode.TRIANGLES, indexed: bool | None = None, elements_per_item: int | None = None, vertices_per_item: int | None = None) -> picogl.renderer.meshdata.MeshData Convert these arrays into renderable :class:`~picogl.renderer.meshdata.MeshData`. :param mode: Primitive mode. Defaults to triangles so unindexed geometry is not inferred as points. :param indexed: Whether drawing uses an element buffer. Defaults to :attr:`indexed`. :param elements_per_item: Indices (or vertices, when unindexed) per logical item. :param vertices_per_item: Vertices per logical item, used when expanding per-item attributes. :returns: CPU mesh with ``draw_info`` built from *mode* and the layout arguments. :rtype: MeshData