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

deltanedas 16c29e1158 update wgpu and stuff před 3 roky
examples 16c29e1158 update wgpu and stuff před 3 roky
src 16c29e1158 update wgpu and stuff před 3 roky
.gitignore 664d59af6d first commit před 4 roky
Cargo.toml 16c29e1158 update wgpu and stuff před 3 roky
README.md 261fb18d17 update readme před 3 roky
build.rs 4fb25f42a9 uvs working + viewer example před 4 roky
chair.blend b110d9c59f fix exported normals + add option to invert winding před 3 roky
chair.chr b110d9c59f fix exported normals + add option to invert winding před 3 roky
chair_exporter.py 164c6887ce fix před 3 roky

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.

Comes with wgpu integration, if using bevy see the [bevy_chair](https://lib.rs/bevy_chair) loader plugin.

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::new::<MyVertex>(&atlas, Some("fallback"))
	.create::<MyVertex>(&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.

Vertex paint mode can be used for per-vertex colours and exported.