py3dtiles.tileset.content.gltf_utils module

class py3dtiles.tileset.content.gltf_utils.GltfAttribute(name, accessor_type, component_type, array)[source]

Bases: NamedTuple

accessor_type: pygltflib.SCALAR | pygltflib.VEC2 | pygltflib.VEC3

Alias for field number 1

array: npt.NDArray[np.uint8 | np.uint16 | np.uint32 | np.float32]

Alias for field number 3

component_type: pygltflib.UNSIGNED_BYTE | pygltflib.UNSIGNED_INT | pygltflib.FLOAT

Alias for field number 2

name: str

Alias for field number 0

class py3dtiles.tileset.content.gltf_utils.GltfPrimitive(points: ndarray[Any, dtype[float32]], triangles: ndarray[Any, dtype[uint8 | uint16 | uint32]] | None = None, normals: ndarray[Any, dtype[float32]] | None = None, uvs: ndarray[Any, dtype[float32]] | None = None, batchids: ndarray[Any, dtype[uint32]] | None = None, additional_attributes: list[GltfAttribute] | None = None, texture_uri: str | None = None, material: Material | None = None)[source]

Bases: object

py3dtiles.tileset.content.gltf_utils.get_component_type_from_dtype(dt: dtype[Any]) int[source]
py3dtiles.tileset.content.gltf_utils.gltf_component_from_primitive(primitive: GltfPrimitive, byte_offset: int = 0, attribute_counter: int = 0) tuple[Primitive, list[Accessor], list[BufferView], bytes][source]

Build the GlTF structure that corresponds to a triangulated mesh.

The mesh is represented as numpy arrays as follows:

  • a 3D-point array;

  • a triangle array, where points are identified by their positional ID in the 3D-point array.

See https://gitlab.com/dodgyville/pygltflib/ (section “Create a mesh, convert to bytes, convert back to mesh”).

py3dtiles.tileset.content.gltf_utils.prepare_gltf_component(array_idx: int, array: ndarray[Any, dtype[uint8 | uint16 | uint32 | float32]], byte_offset: int, count: int, accessor_type: str = 'VEC3', component_type: int = 5126, buffer_view_target: int = 34962) tuple[bytes, Accessor, BufferView][source]