aports/testing/draco/0006-Fix-tinygltf-FsCallbacks.patch
Holger Jaekel 31cab7e4d7 testing/draco: new aport
Library for compressing and decompressing 3D geometric meshes and point clouds
https://google.github.io/draco/
2024-06-25 11:30:29 +00:00

33 lines
1.1 KiB
Diff

From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Fri, 14 Jul 2023 20:16:33 +0200
Subject: Fix tinygltf::FsCallbacks
---
src/draco/io/gltf_decoder.cc | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/draco/io/gltf_decoder.cc b/src/draco/io/gltf_decoder.cc
index ebfd3ec..0f4852f 100644
--- a/src/draco/io/gltf_decoder.cc
+++ b/src/draco/io/gltf_decoder.cc
@@ -438,6 +438,12 @@ bool WriteWholeFile(std::string * /*err*/, const std::string &filepath,
return WriteBufferToFile(contents.data(), contents.size(), filepath);
}
+bool GetFileSizeInBytes(size_t *out, std::string * /*err*/,
+ const std::string &filepath, void * /*user_data*/) {
+ *out = GetFileSize(filepath);
+ return true;
+}
+
} // namespace
GltfDecoder::GltfDecoder()
@@ -497,6 +503,7 @@ Status GltfDecoder::LoadFile(const std::string &file_name,
// TinyGLTF's ExpandFilePath does not do filesystem i/o, so it's safe to
// use in all environments.
&tinygltf::ExpandFilePath, &ReadWholeFile, &WriteWholeFile,
+ &GetFileSizeInBytes,
reinterpret_cast<void *>(input_files)};
loader.SetFsCallbacks(fs_callbacks);