py3dtiles.tileset.content.gltf_utils module#
- class py3dtiles.tileset.content.gltf_utils.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.gltf_utils.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.gltf_utils.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.
- py3dtiles.tileset.content.gltf_utils.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.