Skip to content

Instantly share code, notes, and snippets.

View IcyTv's full-sized avatar

IcyTv IcyTv

View GitHub Profile
### Keybase proof
I hereby claim:
* I am icytv on github.
* I am icytv (https://keybase.io/icytv) on keybase.
* I have a public key ASAJsBOvP6ICoOSrRCSFKdlvMKjXuBbVz2pjHWCqrcG7ygo
To claim this, I am signing this object:
@IcyTv
IcyTv / greedy_meshing.rs
Created July 17, 2021 11:50
Greedy meshing algorithm for rust
/*
The original algorithm comes from https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/
and the code is almost a straight adaptation of that code (https://github.com/mikolalysenko/mikolalysenko.github.com/blob/gh-pages/MinecraftMeshes/js/greedy.js)
*/
fn greedy_meshing(
is_voxel_present: &dyn Fn(i32, i32, i32) -> bool,
dims: &[i32; 3],
) -> Vec<[[i32; 3]; 4]> {
let mut quads = Vec::new();