This is a reimplementation of the MeshCodec compression/encoding format found in Tears of the Kingdom. MeshCodec makes use of ZStandard for compression/decompression, meshoptimizer for index buffer encoding, and a mix of custom encoding schemes. Both decompression/decoding and re-encoding are supported.
- Accurately (de)compresses all
.bfres.mcand.chunkfiles found in TotK.
Requires at least C++20 (for std::construct_at) and CMake 3.18.
- Windows: Run
build.bat - Linux / macOS: Run
./build.sh
cmake -B build . -DCMAKE_BUILD_TYPE=Release -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_STATIC_LINKING_ONLY=ON -DBUILD_TESTING=ON
cmake --build build# Decompress a file or directory:
meshcodec_cli.exe <path_to_input_dir_or_file> <path_to_output_dir>
# Compress / re-encode a .bfres file or directory to .bfres.mc:
meshcodec_cli.exe -c <path_to_input_dir_or_file> [output_path_or_dir]
meshcodec_cli.exe --compress <path_to_input_dir_or_file> [output_path_or_dir]Some of the code found in mc_IndexCodec.h/mc_IndexCodec.cpp and mc_VertexCodec.cpp is based on Arseny Kapoulkine's meshoptimizer and is licensed under the MIT License (it was not added as a library because significant enough changes were made where using the meshoptimizer library directly is impractical). ZStandard is licened under GPL-2.0 and was developed by Meta. When building with MSVC, due to its lack of float16 support, float16 conversions are handled by an implementation by Phernost from StackOverflow which is licensed under the Unlicense. Everything else comes from reverse engineering work and is licensed under under GPL-2.0.