pub type TerrainGrid = VolGrid2d<TerrainChunk>;

Aliased Type§

struct TerrainGrid {
    map_size_lg: MapSizeLg,
    default: Arc<Chonk<Block, TerrainChunkSize, TerrainChunkMeta>>,
    chunks: HashMap<Vec2<i32>, Arc<Chonk<Block, TerrainChunkSize, TerrainChunkMeta>>, GridHasher>,
}

Fields§

§map_size_lg: MapSizeLg

Size of the entire (not just loaded) map.

§default: Arc<Chonk<Block, TerrainChunkSize, TerrainChunkMeta>>

Default voxel for use outside of max map bounds.

§chunks: HashMap<Vec2<i32>, Arc<Chonk<Block, TerrainChunkSize, TerrainChunkMeta>>, GridHasher>

Implementations§

source§

impl TerrainGrid

source

pub fn find_ground(&self, pos: Vec3<i32>) -> Vec3<i32>

Find a location suitable for spawning an entity near the given position (but in the same chunk).

source

pub fn is_space(&self, pos: Vec3<i32>) -> bool

source

pub fn try_find_space(&self, pos: Vec3<i32>) -> Option<Vec3<i32>>

source

pub fn try_find_ground(&self, pos: Vec3<i32>) -> Option<Vec3<i32>>

source

pub fn get_interpolated<T, F>(&self, pos: Vec2<i32>, f: F) -> Option<T>
where T: Copy + Default + Add<Output = T> + Mul<f32, Output = T>, F: FnMut(&TerrainChunk) -> T,