mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
t merge Merge branch 'master' of gitlab.com:veloren/veloren into sharp/jungle
This commit is contained in:
commit
97eaeddd78
@ -1,3 +1,5 @@
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
use client::{Client, Event};
|
||||
use common::{clock::Clock, comp};
|
||||
use log::{error, info};
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(label_break_value, duration_float, euclidean_division)]
|
||||
|
||||
pub mod error;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![type_length_limit = "1664759"]
|
||||
#![feature(
|
||||
euclidean_division,
|
||||
|
@ -122,40 +122,6 @@ impl ReadVol for Chonk {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &Block {
|
||||
if pos.z < self.z_offset {
|
||||
// Below the terrain
|
||||
&self.below
|
||||
} else if pos.z >= self.z_offset + SUB_CHUNK_HEIGHT as i32 * self.sub_chunks.len() as i32 {
|
||||
// Above the terrain
|
||||
&self.above
|
||||
} else {
|
||||
// Within the terrain
|
||||
|
||||
let sub_chunk_idx = self.sub_chunk_idx(pos.z);
|
||||
|
||||
match &self.sub_chunks[sub_chunk_idx] {
|
||||
// Can't fail
|
||||
SubChunk::Homogeneous(block) => block,
|
||||
SubChunk::Hash(cblock, map) => {
|
||||
let rpos = pos
|
||||
- Vec3::unit_z()
|
||||
* (self.z_offset + sub_chunk_idx as i32 * SUB_CHUNK_HEIGHT as i32);
|
||||
|
||||
map.get(&rpos.map(|e| e as u8)).unwrap_or(cblock)
|
||||
}
|
||||
SubChunk::Heterogeneous(chunk) => {
|
||||
let rpos = pos
|
||||
- Vec3::unit_z()
|
||||
* (self.z_offset + sub_chunk_idx as i32 * SUB_CHUNK_HEIGHT as i32);
|
||||
|
||||
chunk.get_unchecked(rpos)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl WriteVol for Chonk {
|
||||
|
@ -72,10 +72,6 @@ pub trait ReadVol: BaseVol {
|
||||
/// Get a reference to the voxel at the provided position in the volume.
|
||||
fn get(&self, pos: Vec3<i32>) -> Result<&Self::Vox, Self::Err>;
|
||||
|
||||
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &Self::Vox {
|
||||
self.get(pos).unwrap()
|
||||
}
|
||||
|
||||
fn ray(
|
||||
&self,
|
||||
from: Vec3<f32>,
|
||||
|
@ -60,11 +60,6 @@ impl<V: Vox, S: VolSize, M> ReadVol for Chunk<V, S, M> {
|
||||
.and_then(|idx| self.vox.get(idx))
|
||||
.ok_or(ChunkErr::OutOfBounds)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &V {
|
||||
self.vox.get_unchecked(Self::idx_for_unchecked(pos))
|
||||
}
|
||||
}
|
||||
|
||||
impl<V: Vox, S: VolSize, M> WriteVol for Chunk<V, S, M> {
|
||||
|
@ -57,12 +57,6 @@ impl<V: Vox, M> ReadVol for Dyna<V, M> {
|
||||
.and_then(|idx| self.vox.get(idx))
|
||||
.ok_or(DynaErr::OutOfBounds)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &V {
|
||||
self.vox
|
||||
.get_unchecked(Self::idx_for_unchecked(self.sz, pos))
|
||||
}
|
||||
}
|
||||
|
||||
impl<V: Vox, M> WriteVol for Dyna<V, M> {
|
||||
|
@ -60,13 +60,6 @@ impl<V: BaseVol + ReadVol + Debug, S: VolSize> ReadVol for VolMap2d<V, S> {
|
||||
chunk.get(co).map_err(VolMap2dErr::ChunkErr)
|
||||
})
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn get_unchecked(&self, pos: Vec3<i32>) -> &V::Vox {
|
||||
let ck = Self::chunk_key(pos);
|
||||
let co = Self::chunk_offs(pos);
|
||||
self.chunks.get(&ck).unwrap().get_unchecked(co)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: This actually breaks the API: samples are supposed to have an offset of zero!
|
||||
|
@ -1,3 +1,5 @@
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
use common::clock::Clock;
|
||||
use heaptrack::track_mem;
|
||||
use log::info;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(drain_filter, bind_by_move_pattern_guards)]
|
||||
|
||||
pub mod auth_provider;
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(duration_float, drain_filter)]
|
||||
#![recursion_limit = "2048"]
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![deny(unsafe_code)]
|
||||
#![feature(euclidean_division, bind_by_move_pattern_guards, option_flattening)]
|
||||
|
||||
mod all;
|
||||
|
Loading…
Reference in New Issue
Block a user