MeshBVH.serialize(output: io.BytesIO, bvh: Optional[BVH] = None) -> None
将 MeshBVH 转换为 BytesIO 对象。如果提供了 BVH 对象,则使用它来序列化 MeshBVH。
output :io.BytesIO类型的对象,表示输出流。
bvh :可选,BVH 类型的对象。如果提供了 BVH 对象,则使用 BVH 对象来序列化 MeshBVH。
TypeError:提供的输出流不是 io.BytesIO 类型。import io
from three.bvh import BVH
from three.bvh.mesh import MeshBVH
mesh_bvh = MeshBVH(...)
bvh = BVH(...)
# 将 MeshBVH 存储到 BytesIO 对象中
output = io.BytesIO()
mesh_bvh.serialize(output)
# 将 MeshBVH 和 BVH 存储到 BytesIO 对象中
output = io.BytesIO()
mesh_bvh.serialize(output, bvh)
没有返回值,此函数通过提供的 output 参数将 MeshBVH 序列化为二进制数据流并写入输出流。