py3dtiles.tileset.content.b3dm module#

class py3dtiles.tileset.content.b3dm.B3dm(header: B3dmHeader, body: B3dmBody)[source]#

Bases: LegacyTileContent

classmethod from_array(array: ndarray[tuple[int, ...], dtype[uint8]]) B3dm[source]#
static from_bytes(data: bytes) B3dm[source]#

Load a tile_content from bytes. This method can be directly supplied the bytes in the file.

static from_gltf(gltf: GLTF2, batch_table: BatchTable | None = None, feature_table: B3dmFeatureTable | None = None) B3dm[source]#

Wrap a pygltflib.GLTF2 instance into a b3dm. This gives the most control on the scene creation, as pygltflib.GLTF2 instance are as near as possible to the gltf specification.

static from_meshes(meshes: list[GltfMesh], batch_table: BatchTable | None = None, feature_table: B3dmFeatureTable | None = None, transform: ndarray[tuple[int, ...], dtype[float32]] | None = None) B3dm[source]#

Create a b3dm from GltfMesh instances. This allows for finer control than from_numpy_arrays by allowing several meshes in one b3dm.

static from_numpy_arrays(points: ndarray[tuple[int, ...], dtype[float32]], triangles: ndarray[tuple[int, ...], dtype[uint8]] | None = None, batch_table: BatchTable | None = None, feature_table: B3dmFeatureTable | None = None, normal: ndarray[tuple[int, ...], dtype[float32]] | None = None, uvs: ndarray[tuple[int, ...], dtype[float32]] | None = None, batchids: ndarray[tuple[int, ...], dtype[uint32]] | None = None, transform: ndarray[tuple[int, ...], dtype[float32]] | None = None, texture_uri: str | None = None, material: Material | None = None) B3dm[source]#

Creates a B3DM body from numpy arrays.

Parameters:
  • points – array of vertex positions, must have a (n, 3) shape.

  • triangles – array of triangle indices, must have a (n, 3) shape.

  • batch_table – a batch table.

  • feature_table – a feature table.

  • normals – array of vertex normals, must have a (n, 3) shape.

  • uvs – array of texture coordinates, must have a (n, 2) shape.

  • batchids – array of batch table IDs, must have a (n) shape.

  • texture_uri – the URI of the texture image if the primitive is textured.

  • material – a glTF material. If not set, a default material is created.

get_colors() ndarray[tuple[int, ...], dtype[uint8 | uint16 | float32]] | None[source]#
get_extra_field(fieldname: str) ndarray[tuple[int, ...], dtype[Any]] | None[source]#
get_vertex_count() int[source]#
get_vertices() ndarray[tuple[int, ...], dtype[float32 | uint16]] | None[source]#
sync() None[source]#

Allow to synchronize headers with contents.

class py3dtiles.tileset.content.b3dm.B3dmBody[source]#

Bases: TileContentBody

static from_array(b3dm_header: B3dmHeader, array: ndarray[tuple[int, ...], dtype[uint8]]) B3dmBody[source]#
static from_gltf(gltf: GLTF2) B3dmBody[source]#
static from_meshes(meshes: list[GltfMesh], transform: ndarray[tuple[int, ...], dtype[float32]] | None = None) B3dmBody[source]#
to_array() ndarray[tuple[int, ...], dtype[uint8]][source]#
class py3dtiles.tileset.content.b3dm.B3dmHeader[source]#

Bases: TileContentHeader

BYTE_LENGTH = 28#
static from_array(array: ndarray[tuple[int, ...], dtype[uint8]]) B3dmHeader[source]#
magic_value: Literal[b'b3dm', b'pnts']#
to_array() ndarray[tuple[int, ...], dtype[uint8]][source]#
version: int#