From 5b93fa763946bfb3fcbebc5a7ebb2f5956c62a58 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Mon, 30 Jan 2023 03:23:39 +0100 Subject: [PATCH] move more things --- kubi-shared/Cargo.toml | 2 ++ kubi-shared/src/chunk.rs | 4 ++++ kubi-shared/src/lib.rs | 3 +++ kubi-shared/src/networking.rs | 2 ++ kubi-shared/src/networking/client.rs | 0 kubi-shared/src/networking/server.rs | 0 {kubi/src/world => kubi-shared/src}/worldgen.rs | 4 ++-- kubi/Cargo.toml | 3 +-- kubi/src/world.rs | 3 ++- kubi/src/world/chunk.rs | 5 +---- 10 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 kubi-shared/src/chunk.rs create mode 100644 kubi-shared/src/networking.rs create mode 100644 kubi-shared/src/networking/client.rs create mode 100644 kubi-shared/src/networking/server.rs rename {kubi/src/world => kubi-shared/src}/worldgen.rs (98%) diff --git a/kubi-shared/Cargo.toml b/kubi-shared/Cargo.toml index d7a5ff3..565c545 100644 --- a/kubi-shared/Cargo.toml +++ b/kubi-shared/Cargo.toml @@ -6,4 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +glam = { version = "0.22", features = ["debug-glam-assert", "mint", "fast-math"] } strum = { version = "0.24", features = ["derive"] } +bracket-noise = "0.8" diff --git a/kubi-shared/src/chunk.rs b/kubi-shared/src/chunk.rs new file mode 100644 index 0000000..de1b357 --- /dev/null +++ b/kubi-shared/src/chunk.rs @@ -0,0 +1,4 @@ +use crate::blocks::Block; + +pub const CHUNK_SIZE: usize = 32; +pub type BlockData = Box<[[[Block; CHUNK_SIZE]; CHUNK_SIZE]; CHUNK_SIZE]>; diff --git a/kubi-shared/src/lib.rs b/kubi-shared/src/lib.rs index 049a8aa..dd0e7a5 100644 --- a/kubi-shared/src/lib.rs +++ b/kubi-shared/src/lib.rs @@ -1 +1,4 @@ pub mod blocks; +pub mod networking; +pub mod worldgen; +pub mod chunk; diff --git a/kubi-shared/src/networking.rs b/kubi-shared/src/networking.rs new file mode 100644 index 0000000..c07f47e --- /dev/null +++ b/kubi-shared/src/networking.rs @@ -0,0 +1,2 @@ +pub mod client; +pub mod server; diff --git a/kubi-shared/src/networking/client.rs b/kubi-shared/src/networking/client.rs new file mode 100644 index 0000000..e69de29 diff --git a/kubi-shared/src/networking/server.rs b/kubi-shared/src/networking/server.rs new file mode 100644 index 0000000..e69de29 diff --git a/kubi/src/world/worldgen.rs b/kubi-shared/src/worldgen.rs similarity index 98% rename from kubi/src/world/worldgen.rs rename to kubi-shared/src/worldgen.rs index 471055c..7e84845 100644 --- a/kubi/src/world/worldgen.rs +++ b/kubi-shared/src/worldgen.rs @@ -1,8 +1,8 @@ use glam::{IVec3, ivec3}; use bracket_noise::prelude::*; -use super::{ +use crate::{ chunk::{BlockData, CHUNK_SIZE}, - block::Block + blocks::Block }; pub fn generate_world(chunk_position: IVec3, seed: u64) -> BlockData { diff --git a/kubi/Cargo.toml b/kubi/Cargo.toml index ef8189e..6978a12 100644 --- a/kubi/Cargo.toml +++ b/kubi/Cargo.toml @@ -6,16 +6,15 @@ edition = "2021" [dependencies] kubi-shared = { path = "../kubi-shared" } glium = "0.32" +glam = { version = "0.22", features = ["debug-glam-assert", "mint", "fast-math"] } image = { version = "0.24", default_features = false, features = ["png"] } log = "0.4" env_logger = "0.10" strum = { version = "0.24", features = ["derive"] } -glam = { version = "0.22", features = ["debug-glam-assert", "mint", "fast-math"] } hashbrown = "0.13" rayon = "1.6" shipyard = { version = "0.6", features = ["thread_local"] } nohash-hasher = "0.2.0" anyhow = "1.0" flume = "0.10" -bracket-noise = "0.8" #rkyv = "0.7" diff --git a/kubi/src/world.rs b/kubi/src/world.rs index 2e5bdf2..518fee7 100644 --- a/kubi/src/world.rs +++ b/kubi/src/world.rs @@ -4,13 +4,14 @@ use glam::IVec3; use hashbrown::HashMap; use anyhow::{Result, Context}; +pub use kubi_shared::worldgen; + pub mod chunk; pub mod block; pub mod tasks; pub mod loading; pub mod mesh; pub mod neighbors; -pub mod worldgen; pub mod raycast; use chunk::{Chunk, ChunkMesh}; diff --git a/kubi/src/world/chunk.rs b/kubi/src/world/chunk.rs index 672d767..285ab44 100644 --- a/kubi/src/world/chunk.rs +++ b/kubi/src/world/chunk.rs @@ -1,11 +1,8 @@ use glam::IVec3; use glium::{VertexBuffer, IndexBuffer}; -use super::block::Block; use crate::rendering::world::ChunkVertex; -pub const CHUNK_SIZE: usize = 32; - -pub type BlockData = Box<[[[Block; CHUNK_SIZE]; CHUNK_SIZE]; CHUNK_SIZE]>; +pub use kubi_shared::chunk::{CHUNK_SIZE, BlockData}; pub struct ChunkData { pub blocks: BlockData,