Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MeshCodec

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.

Progress

  • Accurately (de)compresses all .bfres.mc and .chunk files found in TotK.

Building

Requires at least C++20 (for std::construct_at) and CMake 3.18.

Quick Build Scripts

  • Windows: Run build.bat
  • Linux / macOS: Run ./build.sh

Manual Build

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

CLI tool options:

# 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]

Credit

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages