Update mesh_generator.rs

This commit is contained in:
2024-04-27 20:06:09 -04:00
parent 1547e083a9
commit 4c8b52a3ff

View File

@@ -186,3 +186,15 @@ fn create_tile_wall(
uvs.push((Vec2::new(0., pos.y - height) / TEX_MULTI) + tex_off); uvs.push((Vec2::new(0., pos.y - height) / TEX_MULTI) + tex_off);
uvs.push((Vec2::new(1., pos.y - height) / TEX_MULTI) + tex_off); uvs.push((Vec2::new(1., pos.y - height) / TEX_MULTI) + tex_off);
} }
fn pack_vertex_data(offset: IVec2, vert: usize, tex: u32) -> u32 {
//4 bits vert
//6 + 6 bits offset
//12 bits texture
let mut data = offset.x as u32;
data += (offset.y as u32) << 6;
data += (vert as u32) << (6 + 6);
data += tex << (6 + 6 + 4);
return data;
}