diff --git a/client/src/plugins/environment/systems/voxels/chunk.rs b/client/src/plugins/environment/systems/voxels/chunk.rs index 23b7ef3..812809b 100644 --- a/client/src/plugins/environment/systems/voxels/chunk.rs +++ b/client/src/plugins/environment/systems/voxels/chunk.rs @@ -2,13 +2,6 @@ use bevy::prelude::*; use crate::plugins::environment::systems::voxels::structure::{ChunkKey, SparseVoxelOctree, Voxel, CHUNK_POW, CHUNK_SIZE}; /// Component attached to the entity that owns the mesh of one chunk. -#[derive(Component)] -pub struct Chunk { - pub key: ChunkKey, - pub voxels: Vec<(IVec3, Voxel)>, // local coords 0‥15 - pub dirty: bool, -} - impl SparseVoxelOctree { pub fn chunk_has_any_voxel(&self, key: ChunkKey) -> bool { diff --git a/client/src/plugins/environment/systems/voxels/culling.rs b/client/src/plugins/environment/systems/voxels/culling.rs index 1c908b0..6f98290 100644 --- a/client/src/plugins/environment/systems/voxels/culling.rs +++ b/client/src/plugins/environment/systems/voxels/culling.rs @@ -1,8 +1,7 @@ use std::collections::{HashMap, VecDeque}; use bevy::prelude::*; -use crate::plugins::environment::systems::voxels::chunk::Chunk; use crate::plugins::environment::systems::voxels::helper::world_to_chunk; -use crate::plugins::environment::systems::voxels::structure::{ChunkCullingCfg, ChunkKey, SparseVoxelOctree, SpawnedChunks, CHUNK_SIZE}; +use crate::plugins::environment::systems::voxels::structure::*; /// despawn (or hide) every chunk entity whose centre is farther away than the diff --git a/client/src/plugins/environment/systems/voxels/render_chunks.rs b/client/src/plugins/environment/systems/voxels/render_chunks.rs index 8fe45ac..9cedb11 100644 --- a/client/src/plugins/environment/systems/voxels/render_chunks.rs +++ b/client/src/plugins/environment/systems/voxels/render_chunks.rs @@ -5,7 +5,6 @@ use bevy::render::mesh::Mesh; use big_space::prelude::GridCell; use itertools::Itertools; use crate::plugins::big_space::big_space_plugin::RootGrid; -use crate::plugins::environment::systems::voxels::chunk::Chunk; use crate::plugins::environment::systems::voxels::meshing::mesh_chunk; use crate::plugins::environment::systems::voxels::structure::*; /// rebuilds meshes only for chunks flagged dirty by the octree diff --git a/client/src/plugins/environment/systems/voxels/structure.rs b/client/src/plugins/environment/systems/voxels/structure.rs index 618e902..731afff 100644 --- a/client/src/plugins/environment/systems/voxels/structure.rs +++ b/client/src/plugins/environment/systems/voxels/structure.rs @@ -88,6 +88,14 @@ pub struct AABB { pub const CHUNK_SIZE: i32 = 16; // 16×16×16 voxels pub const CHUNK_POW : u32 = 4; +#[derive(Component)] +pub struct Chunk { + pub key: ChunkKey, + pub voxels: Vec<(IVec3, Voxel)>, // local coords 0‥15 + pub dirty: bool, +} + + #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub struct ChunkKey(pub i32, pub i32, pub i32);