An efficient binary mesh format which is both small and extremely fast to read.

zenith 664d59af6d first commit 4 年 前
examples 664d59af6d first commit 4 年 前
src 664d59af6d first commit 4 年 前
.gitignore 664d59af6d first commit 4 年 前
Cargo.toml 664d59af6d first commit 4 年 前
README.md 664d59af6d first commit 4 年 前
build.rs 664d59af6d first commit 4 年 前
chair.blend 664d59af6d first commit 4 年 前
chair.chr 664d59af6d first commit 4 年 前
chair_exporter.py 664d59af6d first commit 4 年 前

README.md

chair

An efficient binary mesh format which is both small and extremely fast to read.

Textures are supported by loading them from an atlas and mapping mesh uvs to the region.

loading and drawing meshes with wgpu

let bytes = fs::read("chair.chr")?;
// MyVertex implements the Vertex trait to specify what features are loaded into memory
let mesh = MeshReader::<MyVertex>::new(atlas, Some("fallback"))
	.create(device, bytes)?;

// in render pass code
mesh.draw(&mut pass);

Fallback texture name is specified with the fallback parameter of MeshReader::new.

If it is not specified, decoding the mesh will fail instead of using a fallback texture if any unknown textures are specified.

creating meshes

The easy way is use chair_exporter.py as a blender addon to export your models from blender.

Use the optimal settings for accuracy and size as you see fit.

For minecraft-like meshes you can easily do short pos, uvs and normals as they are all low-detail.

For more complex ones this will lose accuracy, so using floats may be prefered.