py3dtiles.tileset.content package#
- class py3dtiles.tileset.content.B3dm(header: B3dmHeader, body: B3dmBody)[source]#
Bases:
TileContent
- static from_gltf(gltf: pygltflib.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: npt.NDArray[np.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: npt.NDArray[np.float32], triangles: npt.NDArray[np.uint8] | None = None, batch_table: BatchTable | None = None, feature_table: B3dmFeatureTable | None = None, normal: npt.NDArray[np.float32] | None = None, uvs: npt.NDArray[np.float32] | None = None, batchids: npt.NDArray[np.uint32] | None = None, transform: npt.NDArray[np.float32] | None = None, texture_uri: str | None = None, material: pygltflib.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.
- class py3dtiles.tileset.content.B3dmBody[source]#
Bases:
TileContentBody
- static from_array(b3dm_header: B3dmHeader, array: ndarray[Any, dtype[uint8]]) B3dmBody [source]#
- class py3dtiles.tileset.content.B3dmHeader[source]#
Bases:
TileContentHeader
- BYTE_LENGTH = 28#
- static from_array(array: ndarray[Any, dtype[uint8]]) B3dmHeader [source]#
- class py3dtiles.tileset.content.GltfAttribute(name: str, accessor_type: str, component_type: pygltflib.UNSIGNED_BYTE | pygltflib.UNSIGNED_INT | pygltflib.FLOAT, array: npt.NDArray[np.uint8 | np.uint16 | np.uint32 | np.float32])[source]#
Bases:
NamedTuple
A high level representation of a gltf attribute
accessor_type can only take values autorized by the spec.
component_type should take these values.
- 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
- class py3dtiles.tileset.content.GltfMesh(points: npt.NDArray[np.float32], name: str | None = None, normals: npt.NDArray[np.float32] | None = None, primitives: list[GltfPrimitive] | None = None, batchids: npt.NDArray[np.uint32] | None = None, uvs: npt.NDArray[np.float32] | None = None, additional_attributes: list[GltfAttribute] | None = None, properties: dict[str, Any] | None = None)[source]#
Bases:
object
A data structure representing a mesh.
This is intended for higher-level usage than pygltflib.Mesh, which are an exact translation of the specification.
This is intented to be easier to construct by keeping a more hierarchical and logical organization. GltfMesh are constructed with all the vertices, normals, uvs and additional attributes, and an optional list of GltfPrimitive that contains indices and material informations.
Use gltf_from_meshes or populate_gltf_from_mesh to convert it to GLTF format.
- Parameters:
points – array of vertex positions, must have a (n, 3) shape.
primitives – array of GltfPrimitive
normals – array of vertex normals for the whole mesh, must have a (n, 3) shape.
batchids – array of batch table IDs, must have a (n) shape.
additional_attributes – additional attributes to add to the primitive.
uvs – array of texture coordinates, must have a (n, 2) shape.
- class py3dtiles.tileset.content.GltfPrimitive(triangles: npt.NDArray[np.uint8 | np.uint16 | np.uint32] | None = None, material: pygltflib.Material | None = None, texture_uri: str | None = None)[source]#
Bases:
object
A data structure storing all information to create a glTF mesh’s primitive.
This is intended for higher-level usage than pygltflib.Primitive.
The transformation will be done automatically while transforming a GltfMesh.
- Parameters:
triangles – array of triangle indices, must have a (n, 3) shape.
material – a glTF material. If not set, a default material is created.
texture_uri – the URI of the texture image if the primitive is textured.
- class py3dtiles.tileset.content.Pnts(header: PntsHeader, body: PntsBody)[source]#
Bases:
TileContent
- static from_features(feature_table_header: PntsFeatureTableHeader, position_array: npt.NDArray[np.float32 | np.uint16], color_array: npt.NDArray[np.uint8 | np.uint16] | None = None, normal_position: npt.NDArray[np.float32 | np.uint8] | None = None) Pnts [source]#
Creates a Pnts from features defined by pd_type and cd_type.
- static from_points(points: Points) Pnts [source]#
Create a pnts from data array:
positions will be included as SemanticPoint.POSITION
if rgb is not None, it will be included as SemanticPoint.RGB
all the extra_fields are included in the batch table
- Parameters:
positions – the positions 1D array
colors – the colors 1D array
extra_fields – a dict of extra arrays to include in the batch_table. The dict keys are the name of the fields, the values are 1D np arrays containing values for each field.
- class py3dtiles.tileset.content.PntsBody[source]#
Bases:
TileContentBody
- static from_array(header: PntsHeader, array: ndarray[Any, dtype[uint8]]) PntsBody [source]#
Creates a PntsBody from an array and the header
- class py3dtiles.tileset.content.PntsHeader[source]#
Bases:
TileContentHeader
- BYTE_LENGTH = 28#
- static from_array(array: ndarray[Any, dtype[uint8]]) PntsHeader [source]#
Create a PntsHeader from an array
- class py3dtiles.tileset.content.TileContent[source]#
Bases:
ABC
- body: TileContentBody#
- abstract static from_array(array: ndarray[Any, dtype[uint8]]) TileContent [source]#
- header: TileContentHeader#
- class py3dtiles.tileset.content.TileContentBody[source]#
Bases:
ABC
- batch_table: BatchTable#
- feature_table: FeatureTable[Any, Any]#
- class py3dtiles.tileset.content.TileContentHeader[source]#
Bases:
ABC
- abstract static from_array(array: ndarray[Any, dtype[uint8]]) TileContentHeader [source]#
- py3dtiles.tileset.content.gltf_from_meshes(meshes: list[GltfMesh], transform: npt.NDArray[np.float32] | None = None) pygltflib.GLTF2 [source]#
Builds a GLTF2 instance from a list of meshes.
- py3dtiles.tileset.content.populate_gltf_from_mesh(gltf: GLTF2, mesh: GltfMesh) None [source]#
Add a GltfMesh to a pygltflib.GLTF2
This method takes care of all the nitty-gritty work about setting buffer, bufferViews, accessors and primitives.
- py3dtiles.tileset.content.read_binary_tile_content(tile_path: Path) TileContent [source]#
Submodules#
- py3dtiles.tileset.content.b3dm module
- py3dtiles.tileset.content.b3dm_feature_table module
- py3dtiles.tileset.content.batch_table module
- py3dtiles.tileset.content.feature_table module
- py3dtiles.tileset.content.gltf_utils module
- py3dtiles.tileset.content.pnts module
- py3dtiles.tileset.content.pnts_feature_table module
- py3dtiles.tileset.content.tile_content module
- py3dtiles.tileset.content.tile_content_reader module