Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 2.25 KB

README.md

File metadata and controls

55 lines (36 loc) · 2.25 KB

masher

License Star

Roblox mesh loader

masher currently supports loading and writing to the following mesh versions:

  • Version 1.00
  • Version 1.01

Versions 6.00 and 7.00 are intentionally left unsupported since it has yet to officially release.

Building

masher is available both as a CLI app as well as a standalone library for embedding in your own applications. You may turn off the MASHER_BUILD_CLI option to toggle building the CLI application by default. On all platforms, you can use CMake to run the following commands to build masher binaries from source:

mkdir cmake && cd cmake
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake --build . --config RelWithDebInfo

Usage

As of right now, you may clone a mesh file using the mesher CLI by running ./masher.cli <path_to_mesh_file>. You may also embed masher in your own project by simply including the masher.hpp header file and linking against masher. Below is a quick example of loading and converting a version 5.00 mesh file to version 4.00 using the masher library.

#include <masher/RobloxMesh.hpp>

std::unique_ptr<masher::RobloxMesh> mesh = std::make_unique<masher::RobloxMesh>(file->getData());

masher::Error error;
if (!mesh->isLoaded() || (error = masher::GetLastError()) != masher::MASHER_OK) {
    printf("Failed to load mesh! Error code: %d\n", (int)error);
    return;
}

int numFaces = mesh->faces->size();
int numVertices = mesh->vertices->size();

printf("Successfully loaded %d faces and %d vertices!\n", numFaces, numVertices);

if (mesh->getVersion() > masher::ROBLOX_MESH_V1_00) {
    file->write(mesh->write(masher::ROBLOX_MESH_V1_00));
    printf("Successfully converted mesh to v1.00!\n");
}

License

masher is licensed under the MIT license. A copy of it has been included with masher.

masher was written using MaximumADHD's Roblox Mesh Format documentation as a reference for implementing the Roblox mesh file format.