mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2026-04-09 05:55:58 +08:00
fix saved glb length
Summary: Make GLB files report their own length correctly. They were off by 28. Reviewed By: davidsonic Differential Revision: D41838340 fbshipit-source-id: 9cd66e8337c142298d5ae1d7c27e51fd812d5c7b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
de3a474d2b
commit
b7a316232a
@@ -740,7 +740,10 @@ class _GLTFWriter:
|
||||
json_length = len(json_bytes)
|
||||
|
||||
# write header
|
||||
header = struct.pack("<III", _GLTF_MAGIC, 2, json_length + byte_offset)
|
||||
version = 2
|
||||
total_header_length = 28 # (file header = 12) + 2 * (chunk header = 8)
|
||||
file_length = json_length + byte_offset + total_header_length
|
||||
header = struct.pack("<III", _GLTF_MAGIC, version, file_length)
|
||||
self.buffer_stream.write(header)
|
||||
|
||||
# write json
|
||||
|
||||
@@ -155,6 +155,9 @@ class IO:
|
||||
include_textures: If textures are present, whether to try to save
|
||||
them.
|
||||
"""
|
||||
if not isinstance(data, Meshes):
|
||||
raise ValueError("Meshes object expected.")
|
||||
|
||||
if len(data) != 1:
|
||||
raise ValueError("Can only save a single mesh.")
|
||||
|
||||
@@ -204,6 +207,9 @@ class IO:
|
||||
path: file to write
|
||||
binary: If there is a choice, whether to save in a binary format.
|
||||
"""
|
||||
if not isinstance(data, Pointclouds):
|
||||
raise ValueError("Pointclouds object expected.")
|
||||
|
||||
if len(data) != 1:
|
||||
raise ValueError("Can only save a single point cloud.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user