Merge branch 'neura/update-crates' into 'master'

Update various crates

See merge request veloren/veloren!4513
This commit is contained in:
Marcel 2024-06-24 04:58:20 +00:00
commit 5e41b34dc2
10 changed files with 144 additions and 143 deletions

167
Cargo.lock generated
View File

@ -860,9 +860,9 @@ dependencies = [
[[package]] [[package]]
name = "chrono-tz" name = "chrono-tz"
version = "0.8.6" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d59ae0466b83e838b81a54256c39d5d7c20b9d7daa10510a242d9b75abd5936e" checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb"
dependencies = [ dependencies = [
"chrono", "chrono",
"chrono-tz-build", "chrono-tz-build",
@ -872,9 +872,9 @@ dependencies = [
[[package]] [[package]]
name = "chrono-tz-build" name = "chrono-tz-build"
version = "0.2.1" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "433e39f13c9a060046954e0592a8d0a4bcb1040125cbf91cb8ee58964cfb350f" checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1"
dependencies = [ dependencies = [
"parse-zoneinfo", "parse-zoneinfo",
"phf", "phf",
@ -1078,12 +1078,6 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "color_quant"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]] [[package]]
name = "colorchoice" name = "colorchoice"
version = "1.0.1" version = "1.0.1"
@ -1834,12 +1828,6 @@ dependencies = [
"winreg 0.52.0", "winreg 0.52.0",
] ]
[[package]]
name = "dispatch"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04e93ca78226c51902d7aa8c12c988338aadd9e85ed9c6be8aaac39192ff3605"
[[package]] [[package]]
name = "dispatch" name = "dispatch"
version = "0.2.0" version = "0.2.0"
@ -2802,8 +2790,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [ dependencies = [
"ahash 0.8.11", "ahash 0.8.11",
"rayon",
"serde",
] ]
[[package]] [[package]]
@ -2814,6 +2800,8 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [ dependencies = [
"ahash 0.8.11", "ahash 0.8.11",
"allocator-api2", "allocator-api2",
"rayon",
"serde",
] ]
[[package]] [[package]]
@ -3184,16 +3172,16 @@ dependencies = [
[[package]] [[package]]
name = "image" name = "image"
version = "0.24.9" version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" checksum = "fd54d660e773627692c524beaad361aca785a4f9f5730ce91f42aabe5bce3d11"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"byteorder", "byteorder",
"color_quant",
"jpeg-decoder",
"num-traits", "num-traits",
"png", "png",
"zune-core",
"zune-jpeg",
] ]
[[package]] [[package]]
@ -3392,6 +3380,15 @@ dependencies = [
"either", "either",
] ]
[[package]]
name = "itertools"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
dependencies = [
"either",
]
[[package]] [[package]]
name = "itoa" name = "itoa"
version = "1.0.11" version = "1.0.11"
@ -3463,12 +3460,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "jpeg-decoder"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.69" version = "0.3.69"
@ -4585,15 +4576,6 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "ordered-float"
version = "3.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc"
dependencies = [
"num-traits",
]
[[package]] [[package]]
name = "ordered-float" name = "ordered-float"
version = "4.2.0" version = "4.2.0"
@ -5206,7 +5188,7 @@ dependencies = [
"lru", "lru",
"paste", "paste",
"stability", "stability",
"strum 0.26.2", "strum",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width",
] ]
@ -6304,42 +6286,20 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]] [[package]]
name = "strum" name = "strum"
version = "0.24.1" version = "0.26.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06"
dependencies = [ dependencies = [
"strum_macros 0.24.3", "strum_macros",
]
[[package]]
name = "strum"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d8cec3501a5194c432b2b7976db6b7d10ec95c253208b45f83f7136aa985e29"
dependencies = [
"strum_macros 0.26.2",
] ]
[[package]] [[package]]
name = "strum_macros" name = "strum_macros"
version = "0.24.3" version = "0.26.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
dependencies = [ dependencies = [
"heck 0.4.1", "heck 0.5.0",
"proc-macro2 1.0.83",
"quote 1.0.36",
"rustversion",
"syn 1.0.109",
]
[[package]]
name = "strum_macros"
version = "0.26.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6cf59daf282c0a494ba14fd21610a0325f9f90ec9d1231dea26bcb1d696c946"
dependencies = [
"heck 0.4.1",
"proc-macro2 1.0.83", "proc-macro2 1.0.83",
"quote 1.0.36", "quote 1.0.36",
"rustversion", "rustversion",
@ -7075,7 +7035,7 @@ dependencies = [
"authc", "authc",
"byteorder", "byteorder",
"clap", "clap",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"hickory-resolver", "hickory-resolver",
"image", "image",
"num 0.4.3", "num 0.4.3",
@ -7109,7 +7069,7 @@ dependencies = [
"fluent", "fluent",
"fluent-bundle", "fluent-bundle",
"fluent-syntax", "fluent-syntax",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"intl-memoizer", "intl-memoizer",
"serde", "serde",
"tracing", "tracing",
@ -7133,14 +7093,14 @@ dependencies = [
"dot_vox", "dot_vox",
"enum-map", "enum-map",
"fxhash", "fxhash",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"indexmap", "indexmap",
"itertools 0.10.5", "itertools 0.13.0",
"kiddo", "kiddo",
"lazy_static", "lazy_static",
"num-derive", "num-derive",
"num-traits", "num-traits",
"ordered-float 3.9.2", "ordered-float 4.2.0",
"petgraph 0.6.5", "petgraph 0.6.5",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
@ -7155,7 +7115,7 @@ dependencies = [
"slotmap", "slotmap",
"specs", "specs",
"spin_sleep", "spin_sleep",
"strum 0.24.1", "strum",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
"uuid", "uuid",
@ -7171,7 +7131,7 @@ version = "0.10.0"
dependencies = [ dependencies = [
"assets_manager", "assets_manager",
"dot_vox", "dot_vox",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"image", "image",
"lazy_static", "lazy_static",
"ron", "ron",
@ -7226,7 +7186,7 @@ dependencies = [
name = "veloren-common-i18n" name = "veloren-common-i18n"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"hashbrown 0.13.2", "hashbrown 0.14.5",
"rand 0.8.5", "rand 0.8.5",
"serde", "serde",
] ]
@ -7237,7 +7197,7 @@ version = "0.10.0"
dependencies = [ dependencies = [
"bincode", "bincode",
"flate2", "flate2",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"image", "image",
"num-traits", "num-traits",
"serde", "serde",
@ -7256,7 +7216,7 @@ dependencies = [
"bincode", "bincode",
"bytes", "bytes",
"futures", "futures",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"hex", "hex",
"num_cpus", "num_cpus",
"rayon", "rayon",
@ -7282,8 +7242,8 @@ dependencies = [
name = "veloren-common-systems" name = "veloren-common-systems"
version = "0.10.0" version = "0.10.0"
dependencies = [ dependencies = [
"itertools 0.10.5", "itertools 0.13.0",
"ordered-float 3.9.2", "ordered-float 4.2.0",
"rand 0.8.5", "rand 0.8.5",
"rayon", "rayon",
"specs", "specs",
@ -7308,7 +7268,7 @@ dependencies = [
"criterion", "criterion",
"crossbeam-channel", "crossbeam-channel",
"futures-util", "futures-util",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"lazy_static", "lazy_static",
"lz-fear", "lz-fear",
"prometheus", "prometheus",
@ -7336,7 +7296,7 @@ dependencies = [
"bitflags 2.5.0", "bitflags 2.5.0",
"bytes", "bytes",
"criterion", "criterion",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"prometheus", "prometheus",
"rand 0.8.5", "rand 0.8.5",
"tokio", "tokio",
@ -7363,8 +7323,8 @@ dependencies = [
"atomic_refcell", "atomic_refcell",
"enum-map", "enum-map",
"fxhash", "fxhash",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"itertools 0.10.5", "itertools 0.13.0",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
"rayon", "rayon",
@ -7391,9 +7351,9 @@ dependencies = [
"drop_guard", "drop_guard",
"enum-map", "enum-map",
"futures-util", "futures-util",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"humantime", "humantime",
"itertools 0.10.5", "itertools 0.13.0",
"lazy_static", "lazy_static",
"noise", "noise",
"num_cpus", "num_cpus",
@ -7412,7 +7372,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"specs", "specs",
"strum 0.24.1", "strum",
"tokio", "tokio",
"tracing", "tracing",
"vek 0.17.0", "vek 0.17.0",
@ -7433,7 +7393,7 @@ dependencies = [
name = "veloren-server-agent" name = "veloren-server-agent"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"itertools 0.10.5", "itertools 0.13.0",
"lazy_static", "lazy_static",
"rand 0.8.5", "rand 0.8.5",
"specs", "specs",
@ -7497,7 +7457,7 @@ dependencies = [
"crossbeam-utils 0.8.20", "crossbeam-utils 0.8.20",
"directories-next", "directories-next",
"discord-sdk", "discord-sdk",
"dispatch 0.1.4", "dispatch",
"dot_vox", "dot_vox",
"egui", "egui",
"egui_wgpu_backend", "egui_wgpu_backend",
@ -7507,12 +7467,12 @@ dependencies = [
"gilrs", "gilrs",
"glyph_brush", "glyph_brush",
"guillotiere", "guillotiere",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"iced_native", "iced_native",
"iced_winit", "iced_winit",
"image", "image",
"inline_tweak", "inline_tweak",
"itertools 0.10.5", "itertools 0.13.0",
"keyboard-keynames", "keyboard-keynames",
"lazy_static", "lazy_static",
"levenshtein", "levenshtein",
@ -7521,7 +7481,7 @@ dependencies = [
"native-dialog", "native-dialog",
"num 0.4.3", "num 0.4.3",
"num_cpus", "num_cpus",
"ordered-float 3.9.2", "ordered-float 4.2.0",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
"rayon", "rayon",
@ -7532,7 +7492,7 @@ dependencies = [
"shaderc", "shaderc",
"slab", "slab",
"specs", "specs",
"strum 0.24.1", "strum",
"tokio", "tokio",
"tracing", "tracing",
"treeculler", "treeculler",
@ -7609,10 +7569,10 @@ dependencies = [
"fixed", "fixed",
"flate2", "flate2",
"fxhash", "fxhash",
"hashbrown 0.13.2", "hashbrown 0.14.5",
"image", "image",
"indicatif", "indicatif",
"itertools 0.10.5", "itertools 0.13.0",
"kiddo", "kiddo",
"lazy_static", "lazy_static",
"lz-fear", "lz-fear",
@ -7620,7 +7580,7 @@ dependencies = [
"noise", "noise",
"num 0.4.3", "num 0.4.3",
"num-traits", "num-traits",
"ordered-float 3.9.2", "ordered-float 4.2.0",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
"rayon", "rayon",
@ -7629,7 +7589,7 @@ dependencies = [
"rusqlite", "rusqlite",
"serde", "serde",
"signal-hook", "signal-hook",
"strum 0.24.1", "strum",
"svg_fmt", "svg_fmt",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
@ -8857,7 +8817,7 @@ dependencies = [
"cfg_aliases", "cfg_aliases",
"core-foundation", "core-foundation",
"core-graphics 0.22.3", "core-graphics 0.22.3",
"dispatch 0.2.0", "dispatch",
"instant", "instant",
"libc", "libc",
"log", "log",
@ -9169,3 +9129,18 @@ dependencies = [
"cc", "cc",
"pkg-config", "pkg-config",
] ]
[[package]]
name = "zune-core"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f423a2c17029964870cfaabb1f13dfab7d092a62a29a89264f4d36990ca414a"
[[package]]
name = "zune-jpeg"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec866b44a2a1fd6133d363f073ca1b179f438f99e7e5bfb1e33f7181facfe448"
dependencies = [
"zune-core",
]

View File

@ -131,7 +131,7 @@ chrono = { version = "0.4.24", default-features = false, features = [
"wasmbind", "wasmbind",
"serde", "serde",
] } ] }
chrono-tz = { version = "0.8", features = ["serde"] } chrono-tz = { version = "0.9", features = ["serde"] }
inline_tweak = { version = "1.0.8" } inline_tweak = { version = "1.0.8" }
tokio = { version = "1.28", default-features = false, features = ["rt"] } tokio = { version = "1.28", default-features = false, features = ["rt"] }
@ -140,24 +140,24 @@ futures-util = { version = "0.3.7", default-features = false }
prometheus = { version = "0.13", default-features = false } prometheus = { version = "0.13", default-features = false }
prometheus-hyper = "0.2" prometheus-hyper = "0.2"
strum = { version = "0.24", features = ["derive"] } strum = { version = "0.26.3", features = ["derive"] }
enum-map = { version = "2.4" } enum-map = { version = "2.4" }
hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.14", features = ["rayon", "serde", "nightly"] }
fxhash = { version = "0.2.1" } fxhash = { version = "0.2.1" }
crossbeam-utils = { version = "0.8.1" } crossbeam-utils = { version = "0.8.1" }
crossbeam-channel = { version = "0.5" } crossbeam-channel = { version = "0.5" }
ordered-float = { version = "3", default-features = true } ordered-float = { version = "4.2", default-features = true }
num = { version = "0.4" } num = { version = "0.4" }
num-traits = { version = "0.2" } num-traits = { version = "0.2" }
vek = { version = "0.17.0", features = ["serde"] } vek = { version = "0.17.0", features = ["serde"] }
itertools = { version = "0.10" } itertools = { version = "0.13" }
serde = { version = "1.0.118", features = ["derive"] } serde = { version = "1.0.118", features = ["derive"] }
serde_json = { version = "1.0.50" } serde_json = { version = "1.0.50" }
ron = { version = "0.8", default-features = false } ron = { version = "0.8", default-features = false }
specs = { version = "0.20", features = ["nightly"] } specs = { version = "0.20", features = ["nightly"] }
image = { version = "0.24", default-features = false, features = ["png"] } image = { version = "0.25", default-features = false, features = ["png"] }
rayon = { version = "1.5" } rayon = { version = "1.5" }
clap = { version = "4.2", features = ["derive"] } clap = { version = "4.2", features = ["derive"] }

View File

@ -9,7 +9,7 @@ use num_traits::cast::FromPrimitive;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{ use std::{
fmt::Debug, fmt::Debug,
io::{Read, Write}, io::{Cursor, Read, Write},
marker::PhantomData, marker::PhantomData,
}; };
use tracing::warn; use tracing::warn;
@ -142,7 +142,7 @@ pub trait VoxelImageDecoding: VoxelImageEncoding {
fn get_block(ws: &Self::Workspace, x: u32, y: u32, is_border: bool) -> Block; fn get_block(ws: &Self::Workspace, x: u32, y: u32, is_border: bool) -> Block;
} }
pub fn image_from_bytes<'a, I: ImageDecoder<'a>, P: 'static + Pixel<Subpixel = u8>>( pub fn image_from_bytes<I: ImageDecoder, P: 'static + Pixel<Subpixel = u8>>(
decoder: I, decoder: I,
) -> Option<ImageBuffer<P, Vec<u8>>> { ) -> Option<ImageBuffer<P, Vec<u8>>> {
let (w, h) = decoder.dimensions(); let (w, h) = decoder.dimensions();
@ -249,8 +249,13 @@ impl<const N: u32> VoxelImageEncoding for QuadPngEncoding<N> {
CompressionType::Fast, CompressionType::Fast,
FilterType::Up, FilterType::Up,
); );
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8) png.write_image(
.ok()?; x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len(); indices[i] = buf.len();
Some(()) Some(())
}; };
@ -268,7 +273,7 @@ impl<const N: u32> VoxelImageEncoding for QuadPngEncoding<N> {
ws.3.as_raw(), ws.3.as_raw(),
ws.3.width(), ws.3.width(),
ws.3.height(), ws.3.height(),
image::ColorType::Rgb8, image::ExtendedColorType::Rgb8,
) )
.ok()?; .ok()?;
} }
@ -339,10 +344,10 @@ impl<const N: u32> VoxelImageDecoding for QuadPngEncoding<N> {
indices[1]..indices[2], indices[1]..indices[2],
indices[2]..quad.len(), indices[2]..quad.len(),
]; ];
let a = image_from_bytes(PngDecoder::new(&quad[ranges[0].clone()]).ok()?)?; let a = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[0].clone()])).ok()?)?;
let b = image_from_bytes(PngDecoder::new(&quad[ranges[1].clone()]).ok()?)?; let b = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[1].clone()])).ok()?)?;
let c = image_from_bytes(PngDecoder::new(&quad[ranges[2].clone()]).ok()?)?; let c = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[2].clone()])).ok()?)?;
let d = image_from_bytes(PngDecoder::new(&quad[ranges[3].clone()]).ok()?)?; let d = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[3].clone()])).ok()?)?;
Some((a, b, c, d, sprite_data, HashMap::new())) Some((a, b, c, d, sprite_data, HashMap::new()))
} }
@ -533,8 +538,13 @@ impl<const AVERAGE_PALETTE: bool> VoxelImageEncoding for TriPngEncoding<AVERAGE_
CompressionType::Fast, CompressionType::Fast,
FilterType::Up, FilterType::Up,
); );
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8) png.write_image(
.ok()?; x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len(); indices[i] = buf.len();
Some(()) Some(())
}; };
@ -581,9 +591,9 @@ impl<const AVERAGE_PALETTE: bool> VoxelImageDecoding for TriPngEncoding<AVERAGE_
indices[0]..indices[1], indices[0]..indices[1],
indices[1]..indices[2], indices[1]..indices[2],
]; ];
let a = image_from_bytes(PngDecoder::new(&quad[ranges[0].clone()]).ok()?)?; let a = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[0].clone()])).ok()?)?;
let b = image_from_bytes(PngDecoder::new(&quad[ranges[1].clone()]).ok()?)?; let b = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[1].clone()])).ok()?)?;
let c = image_from_bytes(PngDecoder::new(&quad[ranges[2].clone()]).ok()?)?; let c = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[2].clone()])).ok()?)?;
let mut d: HashMap<_, HashMap<_, _>> = HashMap::new(); let mut d: HashMap<_, HashMap<_, _>> = HashMap::new();
if AVERAGE_PALETTE { if AVERAGE_PALETTE {
for i in 0..=255 { for i in 0..=255 {

View File

@ -1,11 +1,11 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use specs::{Component, DerefFlaggedStorage, VecStorage}; use specs::{Component, DerefFlaggedStorage, VecStorage};
use strum::EnumVariantNames; use strum::VariantNames;
// EnumVariantNames is used by bins for clap only, but using strum here gets rid // VariantNames is used by bins for clap only, but using strum here gets rid
// of the clap dependency // of the clap dependency
#[derive( #[derive(
Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize, EnumVariantNames, Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize, VariantNames,
)] )]
pub enum AdminRole { pub enum AdminRole {
Moderator = 0, Moderator = 0,

View File

@ -147,7 +147,7 @@ discord-sdk = { version = "0.3.0", optional = true }
enum-map = { workspace = true } enum-map = { workspace = true }
[target.'cfg(target_os = "macos")'.dependencies] [target.'cfg(target_os = "macos")'.dependencies]
dispatch = "0.1.4" dispatch = "0.2"
[target.'cfg(target_family = "windows")'.build-dependencies] [target.'cfg(target_family = "windows")'.build-dependencies]
winres = "0.1" winres = "0.1"

View File

@ -322,7 +322,7 @@ impl GraphicCache {
} }
}); });
} else { } else {
self.cache_map.drain_filter(|key, details| { let _ = self.cache_map.extract_if(|key, details| {
if key.graphic_id == id { if key.graphic_id == id {
match details { match details {
// NOTE: if replace_graphic is used continously for small images (i.e. // NOTE: if replace_graphic is used continously for small images (i.e.

View File

@ -17,7 +17,7 @@ use common::{
uniform_idx_as_vec2, uniform_idx_as_vec2,
}, },
}; };
use image::{codecs::png::PngEncoder, ColorType, DynamicImage, GenericImage, ImageEncoder}; use image::{codecs::png::PngEncoder, DynamicImage, GenericImage, ImageEncoder};
use indicatif::{MultiProgress, ProgressBar, ProgressStyle}; use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use rand::{thread_rng, Rng}; use rand::{thread_rng, Rng};
use rayon::ThreadPool; use rayon::ThreadPool;
@ -222,7 +222,7 @@ fn generate_one(
image.as_bytes(), image.as_bytes(),
map_size_lg.chunks().x as u32, map_size_lg.chunks().x as u32,
map_size_lg.chunks().y as u32, map_size_lg.chunks().y as u32,
ColorType::Rgba8, image::ExtendedColorType::Rgba8,
) { ) {
error!(?error, "Could not write image data"); error!(?error, "Could not write image data");
} }

View File

@ -20,7 +20,7 @@ use rayon::ThreadPoolBuilder;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{ use std::{
collections::BTreeMap, collections::BTreeMap,
io::{Read, Write}, io::{Cursor, Read, Write},
mem, mem,
sync::Arc, sync::Arc,
time::Instant, time::Instant,
@ -205,7 +205,7 @@ impl VoxelImageEncoding for PngEncoding {
ws.0.as_raw(), ws.0.as_raw(),
ws.0.width(), ws.0.width(),
ws.0.height(), ws.0.height(),
image::ColorType::Rgba8, image::ExtendedColorType::Rgba8,
) )
.ok()?; .ok()?;
Some((buf, ws.1.clone())) Some((buf, ws.1.clone()))
@ -308,8 +308,13 @@ impl VoxelImageEncoding for MixedEncoding {
CompressionType::Fast, CompressionType::Fast,
FilterType::Up, FilterType::Up,
); );
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8) png.write_image(
.ok()?; x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len(); indices[i] = buf.len();
Some(()) Some(())
}; };
@ -337,14 +342,14 @@ impl VoxelImageDecoding for MixedEncoding {
indices[2]..indices[3], indices[2]..indices[3],
indices[3]..quad.len(), indices[3]..quad.len(),
]; ];
let a = image_from_bytes(PngDecoder::new(&quad[ranges[0].clone()]).ok()?)?; let a = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[0].clone()])).ok()?)?;
let b = image_from_bytes(PngDecoder::new(&quad[ranges[1].clone()]).ok()?)?; let b = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[1].clone()])).ok()?)?;
let c = image_from_bytes(PngDecoder::new(&quad[ranges[2].clone()]).ok()?)?; let c = image_from_bytes(PngDecoder::new(Cursor::new(&quad[ranges[2].clone()])).ok()?)?;
let sprite_data = let sprite_data =
bincode::deserialize::<CompressedData<Vec<[u8; 3]>>>(&quad[ranges[4].clone()]) bincode::deserialize::<CompressedData<Vec<[u8; 3]>>>(&quad[ranges[4].clone()])
.ok()? .ok()?
.decompress()?; .decompress()?;
let d = image_from_bytes(JpegDecoder::new(&quad[ranges[3].clone()]).ok()?)?; let d = image_from_bytes(JpegDecoder::new(Cursor::new(&quad[ranges[3].clone()])).ok()?)?;
Some((a, b, c, d, sprite_data)) Some((a, b, c, d, sprite_data))
} }
@ -417,7 +422,7 @@ impl VoxelImageEncoding for MixedEncodingSparseSprites {
ws.0.as_raw(), ws.0.as_raw(),
ws.0.width(), ws.0.width(),
ws.0.height(), ws.0.height(),
image::ColorType::L8, image::ExtendedColorType::L8,
) )
.ok()?; .ok()?;
let index = buf.len(); let index = buf.len();
@ -474,8 +479,13 @@ impl VoxelImageEncoding for MixedEncodingDenseSprites {
CompressionType::Fast, CompressionType::Fast,
FilterType::Up, FilterType::Up,
); );
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8) png.write_image(
.ok()?; x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len(); indices[i] = buf.len();
Some(()) Some(())
}; };
@ -650,8 +660,13 @@ impl<'a, NN: NearestNeighbor, const N: u32> VoxelImageEncoding for PaletteEncodi
CompressionType::Fast, CompressionType::Fast,
FilterType::Up, FilterType::Up,
); );
png.write_image(x.as_raw(), x.width(), x.height(), image::ColorType::L8) png.write_image(
.ok()?; x.as_raw(),
x.width(),
x.height(),
image::ExtendedColorType::L8,
)
.ok()?;
indices[i] = buf.len(); indices[i] = buf.len();
Some(()) Some(())
}; };

View File

@ -87,7 +87,7 @@ fn image_from_function<F: FnMut(u32, u32) -> [u8; 3]>(
heightmap.as_raw(), heightmap.as_raw(),
heightmap.width(), heightmap.width(),
heightmap.height(), heightmap.height(),
image::ColorType::Rgb8, image::ExtendedColorType::Rgb8,
) )
.unwrap(); .unwrap();
let mut f = File::create(name).unwrap(); let mut f = File::create(name).unwrap();

View File

@ -12,7 +12,7 @@ use tracing::{debug, error, info, warn};
use itertools::izip; use itertools::izip;
use noise::NoiseFn; use noise::NoiseFn;
use num::{Float, Zero}; use num::{Float, Zero};
use ordered_float::NotNan; use ordered_float::{FloatCore, NotNan};
use rayon::prelude::*; use rayon::prelude::*;
use std::{ use std::{
cmp::{Ordering, Reverse}, cmp::{Ordering, Reverse},
@ -1253,7 +1253,7 @@ fn erode(
// Egress with no outgoing flows. // Egress with no outgoing flows.
// wh for oceans is always at least min_erosion_height. // wh for oceans is always at least min_erosion_height.
let uplift_i = uplift(posi) as Alt; let uplift_i = uplift(posi) as Alt;
wh[posi] = min_erosion_height.max(h_t_i + uplift_i); wh[posi] = FloatCore::max(min_erosion_height, h_t_i + uplift_i);
lake_sill[stacki] = posi as isize; lake_sill[stacki] = posi as isize;
lake_water_volume[stacki] = 0.0; lake_water_volume[stacki] = 0.0;
} else { } else {
@ -1335,7 +1335,8 @@ fn erode(
if mask_kk.any() { if mask_kk.any() {
let h_j = rec_heights_kk; let h_j = rec_heights_kk;
let elev_j = h_j; let elev_j = h_j;
let dh = 0.0.max(new_h_i as SimdType - elev_j); let dh =
FloatCore::max(0.0, new_h_i as SimdType - elev_j);
let powf = |a: SimdType, b| a.powf(b); let powf = |a: SimdType, b| a.powf(b);
let dh_fs_sample = k_fs_fact_kk as SimdType let dh_fs_sample = k_fs_fact_kk as SimdType
* powf(dh, n as SimdType - 1.0); * powf(dh, n as SimdType - 1.0);
@ -1543,7 +1544,7 @@ fn erode(
// +max(0.d0,min(lake_sediment(lake_sill(ij)), // +max(0.d0,min(lake_sediment(lake_sill(ij)),
// lake_water_volume(lake_sill(ij))))/ // lake_water_volume(lake_sill(ij))))/
// lake_water_volume(lake_sill(ij))*(water(ij)-h(ij)) // lake_water_volume(lake_sill(ij))*(water(ij)-h(ij))
*h += (0.0.max(lake_silt[stacki].min(lake_water_volume[lposi])) *h += (FloatCore::max(0.0, lake_silt[stacki].min(lake_water_volume[lposi]))
/ lake_water_volume[lposi] / lake_water_volume[lposi]
* (wh[posi] - *h) as Compute) as Alt; * (wh[posi] - *h) as Compute) as Alt;
} }
@ -1613,7 +1614,7 @@ fn erode(
panic!("Disconnected lake!"); panic!("Disconnected lake!");
} }
// wh for oceans is always at least min_erosion_height. // wh for oceans is always at least min_erosion_height.
wh[posi] = min_erosion_height.max(old_h_i as Alt); wh[posi] = FloatCore::max(min_erosion_height, old_h_i as Alt);
} else { } else {
let posj = posj as usize; let posj = posj as usize;
// Find the water height for this chunk's receiver; we only apply thermal // Find the water height for this chunk's receiver; we only apply thermal
@ -1818,7 +1819,7 @@ pub(crate) fn fill_sinks<F: Float + Send + Sync>(
/// adjacency list). /// adjacency list).
/// - The adjacency list (stored in a single vector), indexed by the second /// - The adjacency list (stored in a single vector), indexed by the second
/// indirection vector. /// indirection vector.
pub fn get_lakes<F: Float>( pub fn get_lakes<F: FloatCore>(
map_size_lg: MapSizeLg, map_size_lg: MapSizeLg,
h: impl Fn(usize) -> F, h: impl Fn(usize) -> F,
downhill: &mut [isize], downhill: &mut [isize],