Fix formatting issues I missed before.

This commit is contained in:
Joshua Yanovski 2020-08-02 20:43:52 +02:00
parent a428a3ebba
commit 5f3b7294af
3 changed files with 73 additions and 87 deletions

View File

@ -151,15 +151,7 @@ impl<'a> GreedyMesh<'a> {
/// Returns an estimate of the bounds of the current meshed model. /// Returns an estimate of the bounds of the current meshed model.
/// ///
/// For more information on the config parameter, see [GreedyConfig]. /// For more information on the config parameter, see [GreedyConfig].
pub fn push< pub fn push<M: PartialEq, D: 'a, FL, FC, FO, FS, FP>(
M: PartialEq,
D: 'a,
FL,
FC,
FO,
FS,
FP,
>(
&mut self, &mut self,
config: GreedyConfig<D, FL, FC, FO, FS, FP>, config: GreedyConfig<D, FL, FC, FO, FS, FP>,
) -> Aabb<u16> ) -> Aabb<u16>

View File

@ -82,29 +82,27 @@ where
}; };
let mut opaque_mesh = Mesh::new(); let mut opaque_mesh = Mesh::new();
let bounds = greedy.push( let bounds = greedy.push(GreedyConfig {
GreedyConfig { data: self,
data: self, draw_delta,
draw_delta, greedy_size,
greedy_size, greedy_size_cross,
greedy_size_cross, get_light,
get_light, get_color,
get_color, get_opacity,
get_opacity, should_draw,
should_draw, push_quad: |atlas_origin, dim, origin, draw_dim, norm, meta: &()| {
push_quad: |atlas_origin, dim, origin, draw_dim, norm, meta: &()| { opaque_mesh.push_quad(greedy::create_quad(
opaque_mesh.push_quad(greedy::create_quad( atlas_origin,
atlas_origin, dim,
dim, origin,
origin, draw_dim,
draw_dim, norm,
norm, meta,
meta, |atlas_pos, pos, norm, &_meta| create_opaque(atlas_pos, pos, norm),
|atlas_pos, pos, norm, &_meta| create_opaque(atlas_pos, pos, norm), ));
));
},
}, },
); });
let bounds = bounds.map(f32::from); let bounds = bounds.map(f32::from);
let bounds = Aabb { let bounds = Aabb {
min: (bounds.min + offs) * scale, min: (bounds.min + offs) * scale,
@ -195,29 +193,27 @@ where
}; };
let mut opaque_mesh = Mesh::new(); let mut opaque_mesh = Mesh::new();
let _bounds = greedy.push( let _bounds = greedy.push(GreedyConfig {
GreedyConfig { data: self,
data: self, draw_delta,
draw_delta, greedy_size,
greedy_size, greedy_size_cross,
greedy_size_cross, get_light,
get_light, get_color,
get_color, get_opacity,
get_opacity, should_draw,
should_draw, push_quad: |atlas_origin, dim, origin, draw_dim, norm, meta: &bool| {
push_quad: |atlas_origin, dim, origin, draw_dim, norm, meta: &bool| { opaque_mesh.push_quad(greedy::create_quad(
opaque_mesh.push_quad(greedy::create_quad( atlas_origin,
atlas_origin, dim,
dim, origin,
origin, draw_dim,
draw_dim, norm,
norm, meta,
meta, |atlas_pos, pos, norm, &meta| create_opaque(atlas_pos, pos, norm, meta),
|atlas_pos, pos, norm, &meta| create_opaque(atlas_pos, pos, norm, meta), ));
));
},
}, },
); });
(opaque_mesh, Mesh::new(), Mesh::new(), ()) (opaque_mesh, Mesh::new(), Mesh::new(), ())
} }

View File

@ -519,42 +519,40 @@ impl<'a, V: RectRasterableVol<Vox = Block> + ReadVol + Debug>
let mut greedy = GreedyMesh::new(max_size); let mut greedy = GreedyMesh::new(max_size);
let mut opaque_mesh = Mesh::new(); let mut opaque_mesh = Mesh::new();
let mut fluid_mesh = Mesh::new(); let mut fluid_mesh = Mesh::new();
let bounds = greedy.push( let bounds = greedy.push(GreedyConfig {
GreedyConfig { data: (),
data: (), draw_delta,
draw_delta, greedy_size,
greedy_size, greedy_size_cross,
greedy_size_cross, get_light,
get_light, get_color,
get_color, get_opacity,
get_opacity, should_draw,
should_draw, push_quad: |atlas_origin, dim, origin, draw_dim, norm, meta: &FaceKind| match meta {
push_quad: |atlas_origin, dim, origin, draw_dim, norm, meta: &FaceKind| match meta { FaceKind::Opaque(meta) => {
FaceKind::Opaque(meta) => { opaque_mesh.push_quad(greedy::create_quad(
opaque_mesh.push_quad(greedy::create_quad( atlas_origin,
atlas_origin, dim,
dim, origin,
origin, draw_dim,
draw_dim, norm,
norm, meta,
meta, |atlas_pos, pos, norm, &meta| create_opaque(atlas_pos, pos, norm, meta),
|atlas_pos, pos, norm, &meta| create_opaque(atlas_pos, pos, norm, meta), ));
)); },
}, FaceKind::Fluid => {
FaceKind::Fluid => { fluid_mesh.push_quad(greedy::create_quad(
fluid_mesh.push_quad(greedy::create_quad( atlas_origin,
atlas_origin, dim,
dim, origin,
origin, draw_dim,
draw_dim, norm,
norm, &(),
&(), |atlas_pos, pos, norm, &_meta| create_transparent(atlas_pos, pos, norm),
|atlas_pos, pos, norm, &_meta| create_transparent(atlas_pos, pos, norm), ));
));
},
}, },
}, },
); });
let bounds = bounds.map(f32::from); let bounds = bounds.map(f32::from);
let bounds = Aabb { let bounds = Aabb {