GLBBuilder#
- class ansys.tools.visualization_interface.backends.usd.web.glb_builder.GLBBuilder(gltf: Any)#
Utility for writing GLTF buffers and accessors.
This class manages the binary buffer and associated glTF structures when converting USD assets to GLB format. It provides methods to append data to the shared buffer and create corresponding buffer views and accessors.
- Parameters:
- gltf
Any An initialized glTF document (e.g. pygltflib.GLTF2) to populate.
- gltf
Overview#
Append binary data to the shared buffer and return its buffer-view index. |
|
Create an accessor for an existing buffer view and return its index. |
|
Finalize the GLTF document and return the serialized GLB bytes. |
Import detail#
from ansys.tools.visualization_interface.backends.usd.web.glb_builder import GLBBuilder
Attribute detail#
- GLBBuilder.gltf#
- GLBBuilder.binary_blob#
Method detail#
- GLBBuilder.add_buffer_view(data: bytes, target: int | None) int#
Append binary data to the shared buffer and return its buffer-view index.
- GLBBuilder.add_accessor(buffer_view_idx: int, component_type: int, count: int, accessor_type: str, min_values: list[float] | None = None, max_values: list[float] | None = None) int#
Create an accessor for an existing buffer view and return its index.
- Parameters:
- buffer_view_idx
int The index of the buffer view this accessor references.
- component_type
int The GLTF component type (e.g., pygltflib.FLOAT, pygltflib.UNSIGNED_SHORT).
- count
int The number of elements in the accessor.
- accessor_type
str The GLTF accessor type (e.g., “SCALAR”, “VEC3”, “MAT4”).
- min_values
list[float] |None,optional Minimum values for the accessor (used for bounding boxes), by default None.
- max_values
list[float] |None,optional Maximum values for the accessor (used for bounding boxes), by default None.
- buffer_view_idx