Merge branch 'xMAC/update-toolchain' into 'master'

update toolchain to `2024-05-14`

See merge request veloren/veloren!4466
This commit is contained in:
Marcel 2024-05-19 00:40:55 +00:00
commit f5fc2294a6
52 changed files with 125 additions and 197 deletions

View File

@ -13,7 +13,7 @@ variables:
# https://docs.gitlab.com/ee/ci/yaml/#shallow-cloning
GIT_DEPTH: 3
GIT_CLEAN_FLAGS: -f
CACHE_IMAGE_TAG: fb225f5a
CACHE_IMAGE_TAG: d2711284
TAG_REGEX: '/^v[0-9]+\.[0-9]+\.[0-9]+$/'
default:

66
Cargo.lock generated
View File

@ -45,17 +45,6 @@ version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0453232ace82dee0dd0b4c87a59bd90f7b53b314f3e0f61fe2ee7c8a16482289"
[[package]]
name = "ahash"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
dependencies = [
"getrandom 0.2.12",
"once_cell",
"version_check",
]
[[package]]
name = "ahash"
version = "0.8.11"
@ -4473,16 +4462,6 @@ dependencies = [
"ttf-parser",
]
[[package]]
name = "packed_simd"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f9f08af0c877571712e2e3e686ad79efad9657dbf0f7c3c8ba943ff6c38932d"
dependencies = [
"cfg-if 1.0.0",
"num-traits",
]
[[package]]
name = "parking"
version = "2.2.0"
@ -5794,8 +5773,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]]
name = "shred"
version = "0.15.0"
source = "git+https://github.com/amethyst/shred.git?rev=5d52c6fc390dd04c12158633e77591f6523d1f85#5d52c6fc390dd04c12158633e77591f6523d1f85"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "656294f5bdcf6d33f0cf89e88a72b58595e3fca0e77e4a4b9e9026179757fb1e"
dependencies = [
"ahash 0.8.11",
"arrayvec",
@ -5808,8 +5788,9 @@ dependencies = [
[[package]]
name = "shred-derive"
version = "0.6.3"
source = "git+https://github.com/amethyst/shred.git?rev=5d52c6fc390dd04c12158633e77591f6523d1f85#5d52c6fc390dd04c12158633e77591f6523d1f85"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69760b786f8b40361c10663eb63c81fa7d828008527d26aa7595b99c53ab3a8d"
dependencies = [
"proc-macro2 1.0.79",
"quote 1.0.35",
@ -5943,10 +5924,9 @@ dependencies = [
[[package]]
name = "specs"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a60eabdfd5a80e458c3e7bcc9f1076d6ce3cc8ddb71d69691f00fc0de735a635"
source = "git+https://github.com/amethyst/specs.git?rev=4e2da1df29ee840baa9b936593c45592b7c9ae27#4e2da1df29ee840baa9b936593c45592b7c9ae27"
dependencies = [
"ahash 0.7.8",
"ahash 0.8.11",
"crossbeam-queue",
"hibitset",
"log",
@ -5962,8 +5942,7 @@ dependencies = [
[[package]]
name = "specs-derive"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e23e09360f3d2190fec4222cd9e19d3158d5da948c0d1ea362df617dd103511"
source = "git+https://github.com/amethyst/specs.git?rev=4e2da1df29ee840baa9b936593c45592b7c9ae27#4e2da1df29ee840baa9b936593c45592b7c9ae27"
dependencies = [
"proc-macro2 1.0.79",
"quote 1.0.35",
@ -6816,9 +6795,9 @@ dependencies = [
[[package]]
name = "vek"
version = "0.16.1"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c85158043f3bc1fac596d59a77e07948da340b9951b451ed4cb4a8c480aa2157"
checksum = "cb40015035f83ba23d647e647f8be060d0f6f99b7c7687989fbca3e3d65e7234"
dependencies = [
"approx 0.5.1",
"num-integer",
@ -6848,7 +6827,7 @@ dependencies = [
"specs",
"tokio",
"tracing",
"vek 0.16.1",
"vek 0.17.0",
"veloren-client-i18n",
"veloren-common",
"veloren-common-base",
@ -6919,7 +6898,7 @@ dependencies = [
"tracing",
"tracing-subscriber",
"uuid",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common-assets",
"veloren-common-base",
"veloren-common-i18n",
@ -7004,7 +6983,7 @@ dependencies = [
"specs",
"sum_type",
"tracing",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
]
@ -7028,7 +7007,7 @@ dependencies = [
"timer-queue",
"toml 0.8.12",
"tracing",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
"veloren-common-assets",
"veloren-common-base",
@ -7048,7 +7027,7 @@ dependencies = [
"rayon",
"specs",
"tracing",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
"veloren-common-base",
"veloren-common-ecs",
@ -7132,7 +7111,7 @@ dependencies = [
"serde",
"slotmap",
"tracing",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
"veloren-world",
]
@ -7175,7 +7154,7 @@ dependencies = [
"strum 0.24.1",
"tokio",
"tracing",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
"veloren-common-base",
"veloren-common-ecs",
@ -7198,7 +7177,7 @@ dependencies = [
"rand 0.8.5",
"specs",
"tracing",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
"veloren-common-base",
"veloren-common-dynlib",
@ -7296,7 +7275,7 @@ dependencies = [
"tokio",
"tracing",
"treeculler",
"vek 0.16.1",
"vek 0.17.0",
"veloren-client",
"veloren-client-i18n",
"veloren-common",
@ -7324,7 +7303,7 @@ version = "0.10.0"
dependencies = [
"bytemuck",
"lazy_static",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
"veloren-common-dynlib",
]
@ -7380,7 +7359,6 @@ dependencies = [
"num 0.4.1",
"num-traits",
"ordered-float 3.9.2",
"packed_simd",
"rand 0.8.5",
"rand_chacha 0.3.1",
"rayon",
@ -7393,7 +7371,7 @@ dependencies = [
"svg_fmt",
"tracing",
"tracing-subscriber",
"vek 0.16.1",
"vek 0.17.0",
"veloren-common",
"veloren-common-base",
"veloren-common-dynlib",

View File

@ -1,5 +1,3 @@
cargo-features = ["named-profiles", "profile-overrides"]
[workspace]
resolver = "2"
members = [
@ -147,7 +145,7 @@ crossbeam-channel = { version = "0.5" }
ordered-float = { version = "3", default-features = true }
num = { version = "0.4" }
num-traits = { version = "0.2" }
vek = { version = "0.16.1", features = ["serde"] }
vek = { version = "0.17.0", features = ["serde"] }
itertools = { version = "0.10" }
serde = { version = "1.0.118", features = ["derive"] }
@ -164,7 +162,8 @@ sha2 = "0.10"
hex = "0.4.3"
[patch.crates-io]
shred = { git = "https://github.com/amethyst/shred.git", rev = "5d52c6fc390dd04c12158633e77591f6523d1f85" }
# until next specs release
specs = { git = "https://github.com/amethyst/specs.git", rev = "4e2da1df29ee840baa9b936593c45592b7c9ae27" }
# This is needed because of:
# * an issue with spirv & naga in wgpu 0.18 (I assume this is fixed upstream but not in 0.18)
# * an issue with uint in uniforms for gl. (potentially fixed in 0.19?)

View File

@ -45,6 +45,7 @@ pub enum ResourceErr {
#[allow(dead_code)] // false-positive
err: String,
},
#[allow(dead_code)] // false-positive
BundleError(String),
}

View File

@ -1987,9 +1987,9 @@ impl Client {
self.state.terrain().get_key_arc(chunk_pos).cloned()
}
pub fn current<C: Component>(&self) -> Option<C>
pub fn current<C>(&self) -> Option<C>
where
C: Clone,
C: Component + Clone,
{
self.state.read_storage::<C>().get(self.entity()).cloned()
}

View File

@ -168,7 +168,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
.push((uid.into(), CompUpdateKind::Removed(PhantomData::<C>.into())));
}
pub fn add_component_updates<'a, C: Component + Clone + Send + Sync>(
pub fn add_component_updates<'a, C>(
&mut self,
uids: &ReadStorage<'a, Uid>,
tracker: &UpdateTracker<C>,
@ -176,7 +176,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
filter: impl Join + Copy,
) where
P: From<C>,
C: TryFrom<P>,
C: Component + Clone + Send + Sync + TryFrom<P>,
P::Phantom: From<PhantomData<C>>,
P::Phantom: TryInto<PhantomData<C>>,
C::Storage: specs::storage::Tracked,
@ -186,7 +186,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
/// If there was an update to the component `C` on the provided entity this
/// will add the update to this package.
pub fn add_component_update<C: Component + Clone + Send + Sync>(
pub fn add_component_update<C>(
&mut self,
tracker: &UpdateTracker<C>,
storage: &ReadStorage<'_, C>,
@ -194,7 +194,7 @@ impl<P: CompPacket> CompSyncPackage<P> {
entity: Entity,
) where
P: From<C>,
C: TryFrom<P>,
C: Component + Clone + Send + Sync + TryFrom<P>,
P::Phantom: From<PhantomData<C>>,
P::Phantom: TryInto<PhantomData<C>>,
C::Storage: specs::storage::Tracked,

View File

@ -1,3 +1,4 @@
#![allow(non_local_definitions)] // necessary because of the Protocol derive macro
use protocol::Protocol;
pub(crate) const VERSION: u16 = 0;

View File

@ -24,6 +24,7 @@ impl core::str::FromStr for AdminRole {
}
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for AdminRole {
fn to_string(&self) -> String {
match self {

View File

@ -139,12 +139,10 @@ impl Body {
))
.unwrap_or_default(),
),
Body::Armor(kind) => match kind {
ItemDropArmorKind::Neck | ItemDropArmorKind::Back | ItemDropArmorKind::Tabard => {
default.yawed_left(random).pitched_down(PI / 2.0)
},
_ => default.yawed_left(random),
},
Body::Armor(
ItemDropArmorKind::Neck | ItemDropArmorKind::Back | ItemDropArmorKind::Tabard,
) => default.yawed_left(random).pitched_down(PI / 2.0),
_ => default.yawed_left(random),
}
}

View File

@ -578,7 +578,7 @@ impl Serialize for ItemBase {
// Custom serialization for ItemDef, we only want to send the item_definition_id
// over the network, the client will use deserialize_item_def to fetch the
// ItemDef from assets.
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{

View File

@ -87,6 +87,7 @@ pub enum AliasError {
TooLong,
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for AliasError {
fn to_string(&self) -> String {
match *self {

View File

@ -482,14 +482,14 @@ impl SkillSet {
///
/// NOTE: Please don't use pathological or clever implementations of to_mut
/// here.
pub fn unlock_skill_cow<'a, B, C: 'a>(
pub fn unlock_skill_cow<'a, B, C>(
this_: &'a mut B,
skill: Skill,
to_mut: impl FnOnce(&'a mut B) -> &'a mut C,
) -> Result<(), SkillUnlockError>
where
B: Borrow<SkillSet>,
C: BorrowMut<SkillSet>,
C: BorrowMut<SkillSet> + 'a,
{
if let Some(skill_group_kind) = skill.skill_group_kind() {
let this = (*this_).borrow();

View File

@ -101,20 +101,14 @@ impl CharacterBehavior for Data {
timer: tick_attack_or_default(data, self.timer, None),
..*self
});
if let Body::Object(object) = data.body {
match object {
&Flamethrower | &Lavathrower => {
// Send local event used for frontend shenanigans
output_events.emit_local(LocalEvent::CreateOutcome(
Outcome::FlamethrowerCharge {
pos: data.pos.0
+ *data.ori.look_dir() * (data.body.max_radius()),
},
));
if matches!(data.body, Body::Object(Flamethrower | Lavathrower)) {
// Send local event used for frontend shenanigans
output_events.emit_local(LocalEvent::CreateOutcome(
Outcome::FlamethrowerCharge {
pos: data.pos.0 + *data.ori.look_dir() * (data.body.max_radius()),
},
_ => {},
}
};
));
}
} else {
let attack = {
let energy = AttackEffect::new(

View File

@ -32,7 +32,6 @@ pub struct StaticData {
pub vertical_leap_strength: f32,
/// What key is used to press ability
pub ability_info: AbilityInfo,
///
pub damage_effect: Option<CombatEffect>,
}

View File

@ -84,9 +84,6 @@ impl<Context, Target> SynthTyped<Context, Target> for WeakHead<Pure<Target>, Tar
/// [make_case_elim!], as follows:
///
/// ```
/// # #![feature(arbitrary_enum_discriminant)]
/// # #[macro_use] extern crate veloren_common;
///
/// veloren_common::make_case_elim!(
/// my_type_module,
/// #[repr(u32)]
@ -97,6 +94,10 @@ impl<Context, Target> SynthTyped<Context, Target> for WeakHead<Pure<Target>, Tar
/// /* ..., */
/// }
/// );
///
/// # fn main() {
/// # println!("some_dummy_main");
/// # }
/// ```
///
/// This macro automatically does a few things. First, it creates the `enum`
@ -105,9 +106,6 @@ impl<Context, Target> SynthTyped<Context, Target> for WeakHead<Pure<Target>, Tar
/// few things. In this case:
///
/// ```
/// # #![feature(arbitrary_enum_discriminant)]
/// # #[macro_use] extern crate veloren_common;
///
/// #[repr(u32)]
/// #[derive(Clone, Copy)]
/// pub enum MyType {

View File

@ -3,7 +3,7 @@ use core::hash::Hash;
use hashbrown::HashMap;
use serde::{Deserialize, Serialize};
use specs::{Component, Entity, FlaggedStorage, VecStorage};
use std::{fmt, u64};
use std::fmt;
use tracing::error;
// TODO: could we switch this to `NonZeroU64`?

View File

@ -1,4 +1,4 @@
#![feature(async_closure, exclusive_range_pattern)]
#![feature(async_closure)]
//!run with
//! (cd network/examples/fileshare && RUST_BACKTRACE=1 cargo run
//! --profile=release -Z unstable-options -- --trace=info --port 15006)

View File

@ -123,7 +123,7 @@ impl Shared {
async fn connect_manager(&self, network: Network) {
trace!("Start connect_manager");
let iter = futures_util::stream::unfold(network, async move |mut network| {
let iter = futures_util::stream::unfold(network, async move |mut network: Network| {
network.connected().await.ok().map(|v| (v, network))
});

View File

@ -7,7 +7,8 @@
binary_heap_drain_sorted,
fn_traits,
unboxed_closures,
tuple_trait
tuple_trait,
trait_upcasting
)]
pub mod ai;

View File

@ -1 +1 @@
nightly-2024-01-17
nightly-2024-05-14

View File

@ -1,4 +1,4 @@
#![feature(exclusive_range_pattern, let_chains)]
#![feature(let_chains)]
#![allow(
clippy::needless_pass_by_ref_mut //until we find a better way for specs
)]

View File

@ -115,7 +115,6 @@ use specs::{
shred::SendDispatcher, Builder, Entity as EcsEntity, Entity, Join, LendJoin, WorldExt,
};
use std::{
i32,
ops::{Deref, DerefMut},
sync::{Arc, Mutex},
time::{Duration, Instant},

View File

@ -263,7 +263,7 @@ impl CharacterUpdater {
}
pub fn has_pending_database_action(&self, character_id: CharacterId) -> bool {
self.pending_database_actions.get(&character_id).is_some()
self.pending_database_actions.contains_key(&character_id)
}
pub fn process_batch_completion(&mut self, completed_batch_id: u64) {

View File

@ -146,6 +146,7 @@ impl core::str::FromStr for SqlLogMode {
}
}
#[allow(clippy::to_string_trait_impl)]
impl ToString for SqlLogMode {
fn to_string(&self) -> String {
match self {

View File

@ -1,5 +1,6 @@
pub struct Character {
pub character_id: i64,
#[allow(dead_code)]
pub player_uuid: String,
pub alias: String,
pub waypoint: Option<String>,
@ -16,6 +17,7 @@ pub struct Item {
}
pub struct Body {
#[allow(dead_code)]
pub body_id: i64,
pub variant: String,
pub body_data: String,
@ -38,6 +40,7 @@ pub struct Pet {
}
pub struct AbilitySets {
#[allow(dead_code)]
pub entity_id: i64,
pub ability_sets: String,
}

View File

@ -7,6 +7,7 @@ use std::path::PathBuf;
// See best practices for attribution: https://wiki.creativecommons.org/wiki/Best_practices_for_attribution
#[allow(dead_code)]
#[derive(Clone, Deserialize)]
pub struct Art {
/// Name of the art.

View File

@ -92,14 +92,13 @@ impl<'a> System<'a> for Sys {
fn base_ori_interp(body: &Body) -> f32 {
match body {
Body::Object(object) => match object {
Body::Object(
object::Body::Crossbow
| object::Body::Flamethrower
| object::Body::Lavathrower
| object::Body::HaniwaSentry
| object::Body::TerracottaStatue => 100.0,
_ => 10.0,
},
| object::Body::TerracottaStatue,
) => 100.0,
_ => 10.0,
}
}

View File

@ -318,7 +318,7 @@ impl<'a> Widget for Chat<'a> {
}
if let Some(comps) = &self.force_completions {
state.update(|s| s.completions = comps.clone());
state.update(|s| s.completions.clone_from(comps));
}
let mut force_cursor = self.force_cursor;
@ -394,8 +394,8 @@ impl<'a> Widget for Chat<'a> {
} else if s.history_pos > 0 {
s.history_pos -= 1;
}
if s.history_pos > 0 {
s.input.message = s.history.get(s.history_pos - 1).unwrap().to_owned();
if let Some(before) = s.history.iter().nth_back(s.history.len() - s.history_pos) {
s.input.message.clone_from(before);
force_cursor = cursor_offset_to_index(
s.input.message.len(),
&s.input.message,

View File

@ -1,3 +1,4 @@
#![allow(non_local_definitions)] // because of WidgetCommon derive
mod animation;
mod bag;
mod buffs;

View File

@ -746,7 +746,7 @@ impl<'a> Trade<'a> {
.set(state.ids.amount_input, ui)
{
if new_input != key.input {
key.input = new_input.trim().to_owned();
new_input.trim().clone_into(&mut key.input);
if !key.input.is_empty() {
// trade amount can change with (shift||ctrl)-click
let amount = *trade.offers[key.who].get(&key.slot).unwrap_or(&0);

View File

@ -182,7 +182,7 @@ fn main() {
?selected_language,
"Impossible to load language: change to the default language (English) instead.",
);
settings.language.selected_language = i18n::REFERENCE_LANG.to_owned();
i18n::REFERENCE_LANG.clone_into(&mut settings.language.selected_language);
LocalizationHandle::load_expect(&settings.language.selected_language)
});
i18n.set_english_fallback(settings.language.use_english_fallback);

View File

@ -376,8 +376,8 @@ impl PlayState for MainMenuState {
let use_srv = net_settings.use_srv;
let use_quic = net_settings.use_quic;
let validate_tls = net_settings.validate_tls;
net_settings.username = username.clone();
net_settings.default_server = server_address.clone();
net_settings.username.clone_from(&username);
net_settings.default_server.clone_from(&server_address);
if !net_settings.servers.contains(&server_address) {
net_settings.servers.push(server_address.clone());
}

View File

@ -549,7 +549,7 @@ impl Controls {
},
Message::ServerChanged(new_value) => {
self.selected_server_index = Some(new_value);
self.login_info.server = servers[new_value].clone();
self.login_info.server.clone_from(&servers[new_value]);
},
Message::FocusPassword => {
if let Screen::Login { screen, .. } = &mut self.screen {

View File

@ -18,7 +18,7 @@ use vek::*;
// /// NOTE: bone_idx must be in [0, 15] (may be bumped to [0, 31] at some
// /// point).
// TODO: this function name...
pub fn generate_mesh_base_vol_figure<'a: 'b, 'b, V: 'a>(
pub fn generate_mesh_base_vol_figure<'a: 'b, 'b, V>(
vol: V,
(greedy, opaque_mesh, offs, scale, bone_idx): (
&'b mut GreedyMesh<'a, FigureSpriteAtlasData>,
@ -29,7 +29,7 @@ pub fn generate_mesh_base_vol_figure<'a: 'b, 'b, V: 'a>(
),
) -> MeshGen<TerrainVertex, TerrainVertex, TerrainVertex, math::Aabb<f32>>
where
V: BaseVol<Vox = Cell> + ReadVol + SizedVol,
V: BaseVol<Vox = Cell> + ReadVol + SizedVol + 'a,
{
assert!(bone_idx <= 15, "Bone index for figures must be in [0, 15]");
let max_size = greedy.max_size();
@ -115,7 +115,7 @@ where
// /// NOTE: bone_idx must be in [0, 15] (may be bumped to [0, 31] at some
// /// point).
// TODO: this function name...
pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V: 'a>(
pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V>(
vol: V,
(greedy, opaque_mesh, offs, scale, bone_idx): (
&'b mut GreedyMesh<'a, FigureSpriteAtlasData>,
@ -126,7 +126,7 @@ pub fn generate_mesh_base_vol_terrain<'a: 'b, 'b, V: 'a>(
),
) -> MeshGen<TerrainVertex, TerrainVertex, TerrainVertex, math::Aabb<f32>>
where
V: BaseVol<Vox = Block> + ReadVol + SizedVol,
V: BaseVol<Vox = Block> + ReadVol + SizedVol + 'a,
{
assert!(bone_idx <= 15, "Bone index for figures must be in [0, 15]");
let max_size = greedy.max_size();
@ -218,7 +218,7 @@ where
(Mesh::new(), Mesh::new(), Mesh::new(), bounds)
}
pub fn generate_mesh_base_vol_sprite<'a: 'b, 'b, V: 'a>(
pub fn generate_mesh_base_vol_sprite<'a: 'b, 'b, V>(
vol: V,
(greedy, opaque_mesh, vertical_stripes): (
&'b mut GreedyMesh<'a, FigureSpriteAtlasData, greedy::SpriteAtlasAllocator>,
@ -228,7 +228,7 @@ pub fn generate_mesh_base_vol_sprite<'a: 'b, 'b, V: 'a>(
offset: Vec3<f32>,
) -> MeshGen<SpriteVertex, SpriteVertex, TerrainVertex, ()>
where
V: BaseVol<Vox = Cell> + ReadVol + SizedVol,
V: BaseVol<Vox = Cell> + ReadVol + SizedVol + 'a,
{
let max_size = greedy.max_size();
// NOTE: Required because we steal two bits from the normal in the shadow uint
@ -345,12 +345,12 @@ where
(Mesh::new(), Mesh::new(), Mesh::new(), ())
}
pub fn generate_mesh_base_vol_particle<'a: 'b, 'b, V: 'a>(
pub fn generate_mesh_base_vol_particle<'a: 'b, 'b, V>(
vol: V,
greedy: &'b mut GreedyMesh<'a, FigureSpriteAtlasData>,
) -> MeshGen<ParticleVertex, ParticleVertex, TerrainVertex, ()>
where
V: BaseVol<Vox = Cell> + ReadVol + SizedVol,
V: BaseVol<Vox = Cell> + ReadVol + SizedVol + 'a,
{
let max_size = greedy.max_size();
// NOTE: Required because we steal two bits from the normal in the shadow uint
@ -437,7 +437,7 @@ fn should_draw_greedy(
let from = flat_get(pos - delta);
let to = flat_get(pos);
let from_opaque = from.is_filled();
if from_opaque != !to.is_filled() {
if from_opaque == to.is_filled() {
None
} else {
// If going from transparent to opaque, backward facing; otherwise, forward
@ -456,7 +456,7 @@ fn should_draw_greedy_ao(
let from = flat_get(pos - delta);
let to = flat_get(pos);
let from_opaque = from.is_filled();
if from_opaque != !to.is_filled() {
if from_opaque == to.is_filled() {
None
} else {
let faces_forward = from_opaque;

View File

@ -11,7 +11,6 @@ pub struct RainOcclusionMapRenderer {
pub terrain_pipeline: rain_occlusion::RainOcclusionPipeline,
pub figure_pipeline: rain_occlusion::RainOcclusionFigurePipeline,
pub layout: rain_occlusion::RainOcclusionLayout,
}
pub enum RainOcclusionMap {
@ -31,13 +30,10 @@ impl RainOcclusionMap {
if let (Some(terrain_pipeline), Some(figure_pipeline), Some(depth)) =
(directed, figure, view)
{
let layout = rain_occlusion::RainOcclusionLayout::new(device);
Self::Enabled(RainOcclusionMapRenderer {
depth,
terrain_pipeline,
figure_pipeline,
layout,
})
} else {
Self::Disabled(Self::create_dummy_tex(device, queue))

View File

@ -12,7 +12,6 @@ pub struct ShadowMapRenderer {
pub terrain_directed_pipeline: shadow::ShadowPipeline,
pub figure_directed_pipeline: shadow::ShadowFigurePipeline,
pub debug_directed_pipeline: shadow::ShadowDebugPipeline,
pub layout: shadow::ShadowLayout,
}
pub enum ShadowMap {
@ -43,8 +42,6 @@ impl ShadowMap {
{
let (point_depth, directed_depth) = shadow_views;
let layout = shadow::ShadowLayout::new(device);
Self::Enabled(ShadowMapRenderer {
directed_depth,
point_depth,
@ -53,8 +50,6 @@ impl ShadowMap {
terrain_directed_pipeline,
figure_directed_pipeline,
debug_directed_pipeline,
layout,
})
} else {
let (dummy_point, dummy_directed) = Self::create_dummy_shadow_tex(device, queue);

View File

@ -5665,14 +5665,11 @@ impl ItemDropCentralSpec {
(segment, match item_drop {
// TODO: apply non-random rotations to items here
item_drop::Body::Tool(_) => Vec3::new(offset.x - 2.0, offset.y, offset.z),
item_drop::Body::Armor(kind) => match kind {
item_drop::Body::Armor(
item_drop::ItemDropArmorKind::Neck
| item_drop::ItemDropArmorKind::Back
| item_drop::ItemDropArmorKind::Tabard => {
Vec3::new(offset.x, offset.y - 2.0, offset.z)
},
_ => offset * Vec3::new(1.0, 1.0, 0.0),
},
| item_drop::ItemDropArmorKind::Tabard,
) => Vec3::new(offset.x, offset.y - 2.0, offset.z),
_ => offset * Vec3::new(1.0, 1.0, 0.0),
})
} else {

View File

@ -241,14 +241,10 @@ impl FigureMgrStates {
}
}
fn get_mut<'a, Q: ?Sized>(
&'a mut self,
body: &Body,
entity: &Q,
) -> Option<&'a mut FigureStateMeta>
fn get_mut<'a, Q>(&'a mut self, body: &Body, entity: &Q) -> Option<&'a mut FigureStateMeta>
where
EcsEntity: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match body {
Body::Humanoid(_) => self
@ -320,10 +316,10 @@ impl FigureMgrStates {
}
}
fn remove<Q: ?Sized>(&mut self, body: &Body, entity: &Q) -> Option<FigureStateMeta>
fn remove<Q>(&mut self, body: &Body, entity: &Q) -> Option<FigureStateMeta>
where
EcsEntity: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match body {
Body::Humanoid(_) => self.character_states.remove(entity).map(|e| e.meta),
@ -494,14 +490,14 @@ impl FigureMgrStates {
.count()
}
fn get_terrain_locals<'a, Q: ?Sized>(
fn get_terrain_locals<'a, Q>(
&'a self,
body: &Body,
entity: &Q,
) -> Option<&'a BoundTerrainLocals>
where
EcsEntity: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
match body {
Body::Ship(body) => {

View File

@ -153,22 +153,6 @@ struct MeshWorkerResponse {
blocks_of_interest: BlocksOfInterest,
}
/// Conversion of SpriteSpec from a hashmap failed because some sprites were
/// missing.
struct SpritesMissing(Vec<SpriteKind>);
use core::fmt;
impl fmt::Display for SpritesMissing {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
writeln!(
f,
"Missing entries in the sprite manifest for these sprites: {:?}",
&self.0,
)
}
}
pub fn get_sprite_instances<'a, I: 'a>(
lod_levels: &'a mut [I; SPRITE_LOD_LEVELS],
set_instance: impl Fn(&mut I, SpriteInstance, Vec3<i32>),

View File

@ -214,7 +214,7 @@ impl SingleplayerWorlds {
'fail: loop {
for world in self.worlds.iter() {
if world.path.ends_with(&test_name) {
test_name = name.clone();
test_name.clone_from(&name);
test_name.push('_');
test_name.push_str(&i.to_string());
i += 1;

View File

@ -1,3 +1,4 @@
#![allow(non_local_definitions)] // because of WidgetCommon derive
pub mod ghost_image;
pub mod image_frame;
pub mod image_slider;

View File

@ -7,7 +7,7 @@ edition = "2021"
[features]
use-dyn-lib = ["common-dynlib"]
be-dyn-lib = []
simd = ["vek/platform_intrinsics", "packed_simd"]
simd = ["vek/platform_intrinsics"]
bin_compression = [
"lz-fear",
"deflate",
@ -45,7 +45,6 @@ tracing = { workspace = true }
rand = { workspace = true }
rand_chacha = { workspace = true }
arr_macro = "0.2.1"
packed_simd = { version = "0.3.9", optional = true }
rayon = { workspace = true }
serde = { workspace = true }
ron = { workspace = true }

View File

@ -23,7 +23,7 @@ use common::{
generation::{ChunkSupplement, EntityInfo},
lottery::Lottery,
terrain::{Block, BlockKind, SpriteKind},
vol::{BaseVol, ReadVol, RectSizedVol, WriteVol},
vol::{ReadVol, RectSizedVol, WriteVol},
};
use hashbrown::HashMap;
use noise::NoiseFn;
@ -576,7 +576,7 @@ pub fn apply_caves_supplement<'a>(
dynamic_rng: &mut impl Rng,
wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &(impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol),
vol: &(impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
index: IndexRef,
supplement: &mut ChunkSupplement,
) {

View File

@ -6,7 +6,7 @@ use common::{
resources::TimeOfDay,
terrain::{BiomeKind, Block},
time::DayPeriod,
vol::{BaseVol, ReadVol, RectSizedVol, WriteVol},
vol::{ReadVol, RectSizedVol, WriteVol},
};
use rand::prelude::*;
use serde::Deserialize;
@ -554,7 +554,7 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
dynamic_rng: &mut R,
wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &(impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol),
vol: &(impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
index: IndexRef,
chunk: &SimChunk,
supplement: &mut ChunkSupplement,
@ -587,8 +587,7 @@ pub fn apply_wildlife_supplement<'a, R: Rng>(
let entity_group = scatter
.iter()
.enumerate()
.filter_map(|(_i, (entry, get_density))| {
.filter_map(|(entry, get_density)| {
let density = get_density(chunk, col_sample) * wildlife_density_modifier;
(density > 0.0)
.then(|| {

View File

@ -8,6 +8,7 @@
#![allow(clippy::branches_sharing_code)] // TODO: evaluate
#![deny(clippy::clone_on_ref_ptr)]
#![feature(option_zip, let_chains)]
#![cfg_attr(feature = "simd", feature(portable_simd))]
mod all;
mod block;

View File

@ -13,14 +13,12 @@ use itertools::izip;
use noise::NoiseFn;
use num::{Float, Zero};
use ordered_float::NotNan;
#[cfg(feature = "simd")] use packed_simd::m32;
use rayon::prelude::*;
use std::{
cmp::{Ordering, Reverse},
collections::BinaryHeap,
f32, fmt, mem,
fmt, mem,
time::Instant,
u32,
};
use vek::*;
@ -608,16 +606,17 @@ fn get_max_slope(
// simd alternative
#[cfg(not(feature = "simd"))]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
struct m32(u32);
struct M32(u32);
#[cfg(not(feature = "simd"))]
impl m32 {
impl M32 {
#[inline]
fn new(x: bool) -> Self { if x { Self(u32::MAX) } else { Self(u32::MIN) } }
fn splat(x: bool) -> Self { if x { Self(u32::MAX) } else { Self(u32::MIN) } }
#[inline]
fn test(&self) -> bool { self.0 != 0 }
fn any(&self) -> bool { self.0 != 0 }
}
#[cfg(feature = "simd")]
type M32 = std::simd::Mask<i32, 1>;
/// Erode all chunks by amount.
///
@ -862,7 +861,7 @@ fn erode(
let mid_slope = (30.0 / 360.0 * 2.0 * std::f64::consts::PI).tan();
type SimdType = f32;
type MaskType = m32;
type MaskType = M32;
// Precompute factors for Stream Power Law.
let czero = <SimdType as Zero>::zero();
@ -1316,7 +1315,7 @@ fn erode(
let tolp = 1.0e-3;
let mut errp = 2.0 * tolp;
let mut rec_heights = [0.0; 8];
let mut mask = [MaskType::new(false); 8];
let mut mask = [MaskType::splat(false); 8];
mrec_downhill(map_size_lg, &mrec, posi).for_each(|(kk, posj)| {
let posj_stack = mstack_inv[posj];
let h_j = h_stack[posj_stack];
@ -1324,7 +1323,7 @@ fn erode(
// + uplift(posj) as f64
// NOTE: We also considered using old_elev_i > wh[posj] here.
if old_elev_i > h_j {
mask[kk] = MaskType::new(true);
mask[kk] = MaskType::splat(true);
rec_heights[kk] = h_j as SimdType;
}
});
@ -1333,7 +1332,7 @@ fn erode(
let mut df = 1.0;
izip!(&mask, &rec_heights, k_fs_fact, k_df_fact).for_each(
|(&mask_kk, &rec_heights_kk, &k_fs_fact_kk, &k_df_fact_kk)| {
if mask_kk.test() {
if mask_kk.any() {
let h_j = rec_heights_kk;
let elev_j = h_j;
let dh = 0.0.max(new_h_i as SimdType - elev_j);

View File

@ -858,8 +858,7 @@ impl WorldSim {
(gen_ctx
.alt_nz
.get((wposf.div(10_000.0)).into_array())
.min(1.0)
.max(-1.0))
.clamp(-1.0, 1.0))
.sub(0.05)
.mul(0.35),
)
@ -871,8 +870,7 @@ impl WorldSim {
(gen_ctx
.alt_nz
.get((wposf.div(5_000.0 * gen_opts.scale)).into_array())
.min(1.0)
.max(-1.0))
.clamp(-1.0, 1.0))
.add(
0.2 - ((wposf / world_sizef) * 2.0 - 1.0)
.magnitude_squared()

View File

@ -7,7 +7,7 @@ use common_base::prof_span;
use noise::{MultiFractal, NoiseFn, Perlin, Seedable};
use num::Float;
use rayon::prelude::*;
use std::{f32, f64, ops::Mul, u32};
use std::ops::Mul;
use vek::*;
/// Calculates the smallest distance along an axis (x, y) from an edge of

View File

@ -14,7 +14,7 @@ use crate::{
use common::{
generation::ChunkSupplement,
terrain::{Block, BlockKind, SpriteKind},
vol::{BaseVol, ReadVol, RectSizedVol, WriteVol},
vol::{ReadVol, RectSizedVol, WriteVol},
};
use core::f32;
use rand::prelude::*;
@ -190,7 +190,7 @@ impl Castle {
index: IndexRef,
wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &mut (impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol),
vol: &mut (impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
) {
for y in 0..vol.size_xy().y as i32 {
for x in 0..vol.size_xy().x as i32 {

View File

@ -30,7 +30,7 @@ use common::{
store::{Id, Store},
terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize},
trade::{Good, SiteInformation},
vol::{BaseVol, ReadVol, RectSizedVol, RectVolSize, WriteVol},
vol::{ReadVol, RectSizedVol, RectVolSize, WriteVol},
};
use fxhash::FxHasher64;
@ -560,7 +560,7 @@ impl Settlement {
index: IndexRef,
wpos2d: Vec2<i32>,
mut get_column: impl FnMut(Vec2<i32>) -> Option<&'a ColumnSample<'a>>,
vol: &mut (impl BaseVol<Vox = Block> + RectSizedVol + ReadVol + WriteVol),
vol: &mut (impl RectSizedVol<Vox = Block> + ReadVol + WriteVol),
) {
let colors = &index.colors.site.settlement;

View File

@ -1415,18 +1415,6 @@ impl<'a, const N: usize> PrimitiveTransform for [PrimitiveRef<'a>; N] {
}
}
pub trait PrimitiveGroupFill<const N: usize> {
fn fill_many(self, fills: [Fill; N]);
}
impl<const N: usize> PrimitiveGroupFill<N> for [PrimitiveRef<'_>; N] {
fn fill_many(self, fills: [Fill; N]) {
for i in 0..N {
self[i].fill(fills[i].clone());
}
}
}
pub trait Structure {
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8];