py3dtiles.tileset.content.gltf module#
- class py3dtiles.tileset.content.gltf.Gltf(gltf: GLTF2 | None = None)[source]#
Bases:
TileContentThis class wraps a pygltflib.GLTF2 instance, to make it usable to py3dtiles where a TileContent can be used.
- classmethod from_meshes(meshes: list[GltfMesh], transform: ndarray[tuple[int, ...], dtype[float32]] | None = None) Self[source]#
- get_colors() ndarray[tuple[int, ...], dtype[uint8 | uint16 | float32]] | None[source]#
Get the colors in the order they are defined, taking indices into account.
- get_extra_field(fieldname: str) ndarray[tuple[int, ...], dtype[Any]] | None[source]#
Get an extra field in the order they are defined, taking indices into account.
- get_extra_field_names() set[str][source]#
Get the extra field names found in this gltf file. For py3dtiles, an extra field is an attribute found on every primitive in this gltf.
The gltf convention mandates that custom attributes are uppercase and starts with a _. This method removes this leading _ and put each name to lowercase, to stay consistent with get_extra_field and the rest of the py3dtiles codebase.
- get_vertex_count() int[source]#
Get the total vertex count. in the file, without taking into accounts indices. This is therefore different from the total number of vertices drawn on-screen.
- class py3dtiles.tileset.content.gltf.PointsGltf(gltf: GLTF2 | None = None)[source]#
Bases:
GltfRepresents a simple GLTF made uniquely from points and with the following characteristicts:
one scene
one node
one mesh
one primitive
binary blob
This is used by py3dtiles to generate pure points gltf. These assumptions makes it vastly easier to implement some operations, like merging 2 PointsGltf together.
- classmethod from_gltf(gltf: GLTF2) Self[source]#
Builds a PointsGltf from a pygltflib.GLTF2. This checks that the assumptions of PointsGltf are respected before constructing the object.
- merge_with(other: Self) None[source]#
Merge 2 gltf built with gltf_from_points.
Warning: this performs a merge according to the structure of the gltf built with gtlf_from_points. Do not use with other gltf, it will certainly not do the correct thing!
This merges the buffers. It is slower than just concatenating the nodes/meshes, but decreases the number of draw call in the viewer, thus making the pointcloud performs better.