Merge pull request #2 from Cryoforge-Nexus/chore/workspace-dep-and-error-hygiene
chore(workspace): centralize shared deps and align error handling
This commit is contained in:
commit
fa7ec0e380
29
Cargo.lock
generated
29
Cargo.lock
generated
|
|
@ -67,9 +67,9 @@ checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04"
|
|||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.102"
|
||||
version = "1.0.103"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
|
||||
checksum = "2a4385e2e34eb35d6b3efe798b9eb88096925d87726c0798709bf56d9ed84af3"
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
|
|
@ -444,7 +444,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"anyhow",
|
||||
"ash-window",
|
||||
"glam 0.29.3",
|
||||
"glam 0.33.2",
|
||||
"raw-window-handle",
|
||||
"renderer",
|
||||
"serde_json",
|
||||
|
|
@ -816,24 +816,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.27.0"
|
||||
version = "0.32.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9e05e7e6723e3455f4818c7b26e855439f7546cf617ef669d1adedb8669e5cb9"
|
||||
checksum = "f70749695b063ecbf6b62949ccccde2e733ec3ecbbd71d467dca4e5c6c97cca0"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.29.3"
|
||||
version = "0.33.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8babf46d4c1c9d92deac9f7be466f76dfc4482b6452fc5024b5e8daf6ffeb3ee"
|
||||
|
||||
[[package]]
|
||||
name = "glam"
|
||||
version = "0.32.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f70749695b063ecbf6b62949ccccde2e733ec3ecbbd71d467dca4e5c6c97cca0"
|
||||
checksum = "7f22fb22f065b308be0d8724e3706c7fa3fc2a6c7d6899df4cad7860e7a75436"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
|
@ -1649,7 +1643,7 @@ dependencies = [
|
|||
"ash",
|
||||
"ash-window",
|
||||
"bytemuck",
|
||||
"glam 0.29.3",
|
||||
"glam 0.33.2",
|
||||
"gpu-allocator",
|
||||
"raw-window-handle",
|
||||
"thiserror 2.0.18",
|
||||
|
|
@ -1782,9 +1776,10 @@ dependencies = [
|
|||
name = "server"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bevy_ecs",
|
||||
"crossbeam-channel",
|
||||
"glam 0.27.0",
|
||||
"glam 0.33.2",
|
||||
"serde_json",
|
||||
"shared",
|
||||
"tracing",
|
||||
|
|
@ -1806,7 +1801,7 @@ version = "0.1.0"
|
|||
dependencies = [
|
||||
"bytemuck",
|
||||
"fastrand",
|
||||
"glam 0.27.0",
|
||||
"glam 0.33.2",
|
||||
"noise",
|
||||
"serde",
|
||||
]
|
||||
|
|
|
|||
11
Cargo.toml
11
Cargo.toml
|
|
@ -9,6 +9,17 @@ authors = ["Cryoforge Nexus"]
|
|||
edition = "2024"
|
||||
version = "0.1.0"
|
||||
|
||||
# Dependencies used by more than one crate are pinned once here so a version can never drift between crates.
|
||||
[workspace.dependencies]
|
||||
anyhow = "1.0.103"
|
||||
glam = { version = "0.33", features = ["serde"] }
|
||||
bytemuck = { version = "1.21", features = ["derive"] }
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
serde_json = "1.0.149"
|
||||
ash-window = "0.13.0"
|
||||
raw-window-handle = "0.6.2"
|
||||
|
||||
[workspace.lints.rust]
|
||||
unsafe_code = "warn"
|
||||
missing_docs = "warn"
|
||||
|
|
|
|||
|
|
@ -9,13 +9,13 @@ authors.workspace = true
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.102"
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
anyhow = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
winit = "0.30.13"
|
||||
renderer = { path = "../renderer" }
|
||||
glam = "0.29"
|
||||
raw-window-handle = "0.6.2"
|
||||
ash-window = "0.13.0"
|
||||
serde_json = "1.0.149"
|
||||
glam = { workspace = true }
|
||||
raw-window-handle = { workspace = true }
|
||||
ash-window = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
shared = { version = "0.1.0", path = "../shared" }
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ impl Camera {
|
|||
/// Builds the right-handed view matrix for the current position and orientation.
|
||||
#[must_use]
|
||||
pub fn view_matrix(&self) -> Mat4 {
|
||||
Mat4::look_at_rh(self.position, self.position + self.forward(), Vec3::Y)
|
||||
glam::camera::rh::view::look_at_mat4(self.position, self.position + self.forward(), Vec3::Y)
|
||||
}
|
||||
|
||||
/// Advances the camera by a single frame, applying `input` accumulated over `dt` seconds.
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
ash = "0.38.0"
|
||||
ash-window = "0.13.0"
|
||||
raw-window-handle = "0.6.2"
|
||||
ash-window = { workspace = true }
|
||||
raw-window-handle = { workspace = true }
|
||||
thiserror = "2.0.18"
|
||||
tracing = "0.1.44"
|
||||
tracing = { workspace = true }
|
||||
gpu-allocator = "0.28.0"
|
||||
bytemuck = { version = "1.21", features = ["derive"] }
|
||||
glam = "0.29"
|
||||
bytemuck = { workspace = true }
|
||||
glam = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -286,11 +286,14 @@ impl Renderer {
|
|||
|
||||
let aspect =
|
||||
f64::from(self.swapchain_extent.width) / f64::from(self.swapchain_extent.height);
|
||||
|
||||
#[expect(clippy::cast_possible_truncation)]
|
||||
let mut projection =
|
||||
glam::Mat4::perspective_rh(45.0_f32.to_radians(), aspect as f32, 0.1, 500.0);
|
||||
// Vulkan clip space inverts the Y axis relative to the OpenGL convention glam targets.
|
||||
projection.col_mut(1).y *= -1.0;
|
||||
let projection = glam::camera::rh::proj::vulkan::perspective(
|
||||
45.0_f32.to_radians(),
|
||||
aspect as f32,
|
||||
0.1,
|
||||
500.0,
|
||||
);
|
||||
|
||||
// The view matrix is supplied by the caller (the client's camera); the renderer owns only the projection, which depends on the swapchain aspect ratio it manages.
|
||||
let mvp = projection * camera_view;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,11 @@ authors.workspace = true
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
anyhow = { workspace = true }
|
||||
bevy_ecs = "0.19"
|
||||
crossbeam-channel = "0.5.16"
|
||||
glam = "0.27"
|
||||
serde_json = "1.0.149"
|
||||
glam = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
shared = { version = "0.1.0", path = "../shared" }
|
||||
tracing = "0.1.44"
|
||||
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
|
||||
tracing = { workspace = true }
|
||||
tracing-subscriber = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ pub mod world_server;
|
|||
use std::collections::HashSet;
|
||||
use std::fs;
|
||||
|
||||
use anyhow::Context;
|
||||
use bevy_ecs::prelude::{Query, ResMut, Schedule, With, World};
|
||||
use glam::Vec3;
|
||||
use shared::generator::{VoxelGenerator, WorldGenConfig};
|
||||
|
|
@ -43,7 +44,7 @@ fn stream_chunks(
|
|||
);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn main() -> anyhow::Result<()> {
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(
|
||||
tracing_subscriber::EnvFilter::try_from_default_env()
|
||||
|
|
@ -53,13 +54,11 @@ fn main() {
|
|||
|
||||
info!("Starting Synvael server");
|
||||
|
||||
#[expect(clippy::expect_used)]
|
||||
let config_str = fs::read_to_string("assets/data/worldgen/default.json")
|
||||
.expect("Failed to read worldgen config");
|
||||
.context("reading worldgen config assets/data/worldgen/default.json")?;
|
||||
|
||||
#[expect(clippy::expect_used)]
|
||||
let worldgen_config: WorldGenConfig =
|
||||
serde_json::from_str(&config_str).expect("Failed to parse worldgen config");
|
||||
serde_json::from_str(&config_str).context("parsing worldgen config as JSON")?;
|
||||
|
||||
info!("Successfully loaded world configuration");
|
||||
debug!("Base height: {}", worldgen_config.base_height);
|
||||
|
|
@ -115,4 +114,6 @@ fn main() {
|
|||
position.0.chunk.x += 1;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ authors.workspace = true
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
bytemuck = { version = "1.15", features = ["derive"] }
|
||||
bytemuck = { workspace = true }
|
||||
fastrand = "2.4.1"
|
||||
glam = { version = "0.27", features = ["serde"] }
|
||||
glam = { workspace = true }
|
||||
noise = "0.9"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
|
|
|||
Loading…
Reference in a new issue