mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Revert "Resolve all '#[allow(clippy::identity_op)]' error supressions"
This reverts commit 63eff216f0
.
This commit is contained in:
parent
3ba6abfcb4
commit
516ad1c772
@ -187,6 +187,7 @@ impl MatSegment {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn from_vox(dot_vox_data: &DotVoxData, flipped: bool) -> Self {
|
pub fn from_vox(dot_vox_data: &DotVoxData, flipped: bool) -> Self {
|
||||||
if let Some(model) = dot_vox_data.models.get(0) {
|
if let Some(model) = dot_vox_data.models.get(0) {
|
||||||
let palette = dot_vox_data
|
let palette = dot_vox_data
|
||||||
|
@ -23,7 +23,8 @@ impl Vertex {
|
|||||||
const EXTRA_NEG_Z: f32 = 65536.0;
|
const EXTRA_NEG_Z: f32 = 65536.0;
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
pos_norm: ((pos.x as u32) & 0x003F)
|
pos_norm: 0
|
||||||
|
| ((pos.x as u32) & 0x003F) << 0
|
||||||
| ((pos.y as u32) & 0x003F) << 6
|
| ((pos.y as u32) & 0x003F) << 6
|
||||||
| (((pos.z + EXTRA_NEG_Z).max(0.0).min((1 << 17) as f32) as u32) & 0x1FFFF) << 12
|
| (((pos.z + EXTRA_NEG_Z).max(0.0).min((1 << 17) as f32) as u32) & 0x1FFFF) << 12
|
||||||
| (norm_bits & 0x7) << 29,
|
| (norm_bits & 0x7) << 29,
|
||||||
|
@ -11,6 +11,7 @@ pub struct Vertex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Vertex {
|
impl Vertex {
|
||||||
|
#[allow(clippy::identity_op)] // TODO: Pending review in #587
|
||||||
/// NOTE: meta is true when the terrain vertex is touching water.
|
/// NOTE: meta is true when the terrain vertex is touching water.
|
||||||
pub fn new(atlas_pos: Vec2<u16>, pos: Vec3<f32>, norm: Vec3<f32>, meta: bool) -> Self {
|
pub fn new(atlas_pos: Vec2<u16>, pos: Vec3<f32>, norm: Vec3<f32>, meta: bool) -> Self {
|
||||||
const EXTRA_NEG_Z: f32 = 32768.0;
|
const EXTRA_NEG_Z: f32 = 32768.0;
|
||||||
@ -25,12 +26,12 @@ impl Vertex {
|
|||||||
5
|
5
|
||||||
};
|
};
|
||||||
Self {
|
Self {
|
||||||
pos_norm: ((pos.x as u32) & 0x003F)
|
pos_norm: ((pos.x as u32) & 0x003F) << 0
|
||||||
| ((pos.y as u32) & 0x003F) << 6
|
| ((pos.y as u32) & 0x003F) << 6
|
||||||
| (((pos + EXTRA_NEG_Z).z.max(0.0).min((1 << 16) as f32) as u32) & 0xFFFF) << 12
|
| (((pos + EXTRA_NEG_Z).z.max(0.0).min((1 << 16) as f32) as u32) & 0xFFFF) << 12
|
||||||
| if meta { 1 } else { 0 } << 28
|
| if meta { 1 } else { 0 } << 28
|
||||||
| (norm_bits & 0x7) << 29,
|
| (norm_bits & 0x7) << 29,
|
||||||
atlas_pos: ((atlas_pos.x as u32) & 0xFFFF) | ((atlas_pos.y as u32) & 0xFFFF) << 16,
|
atlas_pos: ((atlas_pos.x as u32) & 0xFFFF) << 0 | ((atlas_pos.y as u32) & 0xFFFF) << 16,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +97,7 @@ impl Vertex {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
pub fn make_col_light_figure(
|
pub fn make_col_light_figure(
|
||||||
// 0 to 31
|
// 0 to 31
|
||||||
light: u8,
|
light: u8,
|
||||||
@ -103,7 +105,7 @@ impl Vertex {
|
|||||||
shiny: bool,
|
shiny: bool,
|
||||||
col: Rgb<u8>,
|
col: Rgb<u8>,
|
||||||
) -> [u8; 4] {
|
) -> [u8; 4] {
|
||||||
let attr = (glowy as u8) | ((shiny as u8) << 1);
|
let attr = 0 | ((glowy as u8) << 0) | ((shiny as u8) << 1);
|
||||||
[
|
[
|
||||||
(light.min(31) << 3) | ((col.r >> 1) & 0b111),
|
(light.min(31) << 3) | ((col.r >> 1) & 0b111),
|
||||||
(attr.min(31) << 3) | ((col.b >> 1) & 0b111),
|
(attr.min(31) << 3) | ((col.b >> 1) & 0b111),
|
||||||
|
@ -168,7 +168,8 @@ impl<'a> BlockGen<'a> {
|
|||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
// Rocks
|
// Rocks
|
||||||
if (height + 2.5 - wposf.z as f32).div(7.5).abs().powi(2) < rock {
|
if (height + 2.5 - wposf.z as f32).div(7.5).abs().powi(2) < rock {
|
||||||
let field0 = RandomField::new(world.seed);
|
#[allow(clippy::identity_op)]
|
||||||
|
let field0 = RandomField::new(world.seed + 0);
|
||||||
let field1 = RandomField::new(world.seed + 1);
|
let field1 = RandomField::new(world.seed + 1);
|
||||||
let field2 = RandomField::new(world.seed + 2);
|
let field2 = RandomField::new(world.seed + 2);
|
||||||
|
|
||||||
|
@ -128,9 +128,10 @@ pub struct Noise {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Noise {
|
impl Noise {
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
fn new(seed: u32) -> Self {
|
fn new(seed: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
cave_nz: SuperSimplex::new().set_seed(seed),
|
cave_nz: SuperSimplex::new().set_seed(seed + 0),
|
||||||
scatter_nz: SuperSimplex::new().set_seed(seed + 1),
|
scatter_nz: SuperSimplex::new().set_seed(seed + 1),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -561,6 +561,7 @@ impl Settlement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::identity_op)] // TODO: Pending review in #587
|
||||||
pub fn apply_to<'a>(
|
pub fn apply_to<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
index: IndexRef,
|
index: IndexRef,
|
||||||
@ -674,7 +675,7 @@ impl Settlement {
|
|||||||
let in_furrow = (wpos2d * furrow_dir).sum().rem_euclid(5) < 2;
|
let in_furrow = (wpos2d * furrow_dir).sum().rem_euclid(5) < 2;
|
||||||
|
|
||||||
let dirt = Rgb::<u8>::from(colors.plot_field_dirt).map(|e| {
|
let dirt = Rgb::<u8>::from(colors.plot_field_dirt).map(|e| {
|
||||||
e + (self.noise.get(Vec3::broadcast((seed % 4096) as i32)) % 32)
|
e + (self.noise.get(Vec3::broadcast((seed % 4096 + 0) as i32)) % 32)
|
||||||
as u8
|
as u8
|
||||||
});
|
});
|
||||||
let mound = Rgb::<u8>::from(colors.plot_field_mound)
|
let mound = Rgb::<u8>::from(colors.plot_field_mound)
|
||||||
|
@ -42,6 +42,7 @@ impl Castle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Structure for Castle {
|
impl Structure for Castle {
|
||||||
|
#[allow(clippy::identity_op)]
|
||||||
fn render<F: FnMut(Primitive) -> Id<Primitive>, G: FnMut(Id<Primitive>, Fill)>(
|
fn render<F: FnMut(Primitive) -> Id<Primitive>, G: FnMut(Id<Primitive>, Fill)>(
|
||||||
&self,
|
&self,
|
||||||
site: &Site,
|
site: &Site,
|
||||||
@ -126,7 +127,7 @@ impl Structure for Castle {
|
|||||||
.with_z(self.alt + wall_height / 4 + 12),
|
.with_z(self.alt + wall_height / 4 + 12),
|
||||||
}));
|
}));
|
||||||
let window_bottom = prim(Primitive::Aabb(Aabb {
|
let window_bottom = prim(Primitive::Aabb(Aabb {
|
||||||
min: (wpos + dir).with_z(self.alt + wall_height / 4),
|
min: (wpos + 1 * dir).with_z(self.alt + wall_height / 4),
|
||||||
max: (wpos + (ts - 1) * dir + dir.yx())
|
max: (wpos + (ts - 1) * dir + dir.yx())
|
||||||
.with_z(self.alt + wall_height / 4 + 9),
|
.with_z(self.alt + wall_height / 4 + 9),
|
||||||
}));
|
}));
|
||||||
@ -137,7 +138,7 @@ impl Structure for Castle {
|
|||||||
.with_z(self.alt + wall_height / 4 + 12),
|
.with_z(self.alt + wall_height / 4 + 12),
|
||||||
}));
|
}));
|
||||||
let window_bottom2 = prim(Primitive::Aabb(Aabb {
|
let window_bottom2 = prim(Primitive::Aabb(Aabb {
|
||||||
min: (wpos + dir + (ts - 1) * dir.yx())
|
min: (wpos + 1 * dir + (ts - 1) * dir.yx())
|
||||||
.with_z(self.alt + wall_height / 4),
|
.with_z(self.alt + wall_height / 4),
|
||||||
max: (wpos + (ts - 1) * dir + ts * dir.yx())
|
max: (wpos + (ts - 1) * dir + ts * dir.yx())
|
||||||
.with_z(self.alt + wall_height / 4 + 9),
|
.with_z(self.alt + wall_height / 4 + 9),
|
||||||
|
@ -13,11 +13,12 @@ pub struct StructureGen2d {
|
|||||||
pub type StructureField = (Vec2<i32>, u32);
|
pub type StructureField = (Vec2<i32>, u32);
|
||||||
|
|
||||||
impl StructureGen2d {
|
impl StructureGen2d {
|
||||||
|
#[allow(clippy::identity_op)] // TODO: Pending review in #587
|
||||||
pub fn new(seed: u32, freq: u32, spread: u32) -> Self {
|
pub fn new(seed: u32, freq: u32, spread: u32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
freq,
|
freq,
|
||||||
spread,
|
spread,
|
||||||
x_field: RandomField::new(seed),
|
x_field: RandomField::new(seed + 0),
|
||||||
y_field: RandomField::new(seed + 1),
|
y_field: RandomField::new(seed + 1),
|
||||||
seed_field: RandomField::new(seed + 2),
|
seed_field: RandomField::new(seed + 2),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user