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.
///
/// For more information on the config parameter, see [GreedyConfig].
pub fn push<
M: PartialEq,
D: 'a,
FL,
FC,
FO,
FS,
FP,
>(
pub fn push<M: PartialEq, D: 'a, FL, FC, FO, FS, FP>(
&mut self,
config: GreedyConfig<D, FL, FC, FO, FS, FP>,
) -> Aabb<u16>

View File

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