picogl.utils.mesh ================= .. py:module:: picogl.utils.mesh .. autoapi-nested-parse:: Mesh helpers built on PicoGL loaders and GL buffer APIs. Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/picogl/utils/mesh/cube_mesh/index /autoapi/picogl/utils/mesh/meshdata_mesh/index /autoapi/picogl/utils/mesh/object_mesh/index /autoapi/picogl/utils/mesh/protocol/index Classes ------- .. autoapisummary:: picogl.utils.mesh.CubeMesh picogl.utils.mesh.MeshDataMesh picogl.utils.mesh.MeshObject picogl.utils.mesh.MeshProtocol Functions --------- .. autoapisummary:: picogl.utils.mesh.meshdata_factory picogl.utils.mesh.flip_texcoord_v Package Contents ---------------- .. py:class:: CubeMesh(vertices: list[float], texcoords: list[float]) Unit cube with position + UV buffers (non-indexed glDrawArrays). .. py:attribute:: vertices .. py:attribute:: texcoords .. py:attribute:: vertex_buffer :type: int | None :value: None .. py:attribute:: uv_buffer :type: int | None :value: None .. py:attribute:: _vertex_count .. py:method:: with_flipped_v() -> CubeMesh .. py:method:: upload() -> None .. py:method:: draw() -> None .. py:class:: MeshDataMesh(data: picogl.renderer.meshdata.MeshData, *, flip_v: bool = False) Position + UV adapter: ``MeshData`` → ``MeshProtocol`` upload/draw. .. py:attribute:: vertices :value: [] .. py:attribute:: texcoords :value: [] .. py:attribute:: indices :value: [] .. py:attribute:: _vertex_count .. py:attribute:: _use_ushort .. py:attribute:: vertex_buffer :type: int | None :value: None .. py:attribute:: uv_buffer :type: int | None :value: None .. py:attribute:: index_buffer :type: int | None :value: None .. py:method:: upload() -> None .. py:method:: draw() -> None .. py:function:: meshdata_factory(data: picogl.renderer.meshdata.MeshData) -> Callable[[bool], picogl.utils.mesh.protocol.MeshProtocol] Factory for ``TexturedRendererSpec.create_mesh`` from a ``MeshData``. .. py:class:: MeshObject(path: pathlib.Path | str) OBJ mesh with GPU buffer upload helpers (positions + UVs + ushort indices). .. py:attribute:: path .. py:attribute:: vertices :type: list[float] | None :value: None .. py:attribute:: texcoords :type: list[float] | None :value: None .. py:attribute:: indices :type: list[int] | None :value: None .. py:attribute:: vertex_buffer :type: int | None :value: None .. py:attribute:: uv_buffer :type: int | None :value: None .. py:attribute:: index_buffer :type: int | None :value: None .. py:attribute:: indices_size :type: int :value: 0 .. py:method:: load_mesh() .. py:method:: get_mesh(*, flip_v: bool = False) -> MeshObject .. py:method:: _upload_vertices() -> None .. py:method:: _upload_texcoords() -> None .. py:method:: _upload_indices() -> None .. py:method:: upload() -> None .. py:method:: draw() -> None Draw the mesh. .. py:method:: _draw_vertices(index: int = 0) -> None .. py:method:: _draw_uvs(index: int = 1) -> None .. py:method:: _draw_indices() -> None .. py:function:: flip_texcoord_v(texcoords: list[float]) -> list[float] Invert V for DDS/top-left origin (``TextureLoader.inversed_v_coords``). .. py:class:: MeshProtocol Bases: :py:obj:`Protocol` Position + UV mesh with GPU upload and draw. .. py:method:: upload() -> None .. py:method:: draw() -> None