mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Use approximate byte count for the terrain recv graph.
This commit is contained in:
parent
6ba512efc8
commit
c2106e158f
@ -2123,7 +2123,9 @@ impl Client {
|
|||||||
cnt += 1;
|
cnt += 1;
|
||||||
#[cfg(feature = "tracy")]
|
#[cfg(feature = "tracy")]
|
||||||
{
|
{
|
||||||
terrain_cnt += 1;
|
if let ServerGeneral::TerrainChunkUpdate { chunk, .. } = &msg {
|
||||||
|
terrain_cnt += chunk.as_ref().map(|x| x.approx_len()).unwrap_or(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.handle_server_terrain_msg(msg)?;
|
self.handle_server_terrain_msg(msg)?;
|
||||||
}
|
}
|
||||||
|
@ -756,7 +756,7 @@ pub fn write_image_terrain<
|
|||||||
pub struct WireChonk<VIE: VoxelImageEncoding, P: PackingFormula, M: Clone, S: RectVolSize> {
|
pub struct WireChonk<VIE: VoxelImageEncoding, P: PackingFormula, M: Clone, S: RectVolSize> {
|
||||||
zmin: i32,
|
zmin: i32,
|
||||||
zmax: i32,
|
zmax: i32,
|
||||||
data: VIE::Output,
|
pub(crate) data: VIE::Output,
|
||||||
below: Block,
|
below: Block,
|
||||||
above: Block,
|
above: Block,
|
||||||
meta: M,
|
meta: M,
|
||||||
|
@ -74,6 +74,14 @@ pub enum SerializedTerrainChunk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SerializedTerrainChunk {
|
impl SerializedTerrainChunk {
|
||||||
|
pub fn approx_len(&self) -> usize {
|
||||||
|
match self {
|
||||||
|
SerializedTerrainChunk::DeflatedChonk(data) => data.data.len(),
|
||||||
|
SerializedTerrainChunk::QuadPng(data) => data.data.data.len(),
|
||||||
|
SerializedTerrainChunk::TriPng(data) => data.data.data.len(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn via_heuristic(chunk: &TerrainChunk, lossy_compression: bool) -> Self {
|
pub fn via_heuristic(chunk: &TerrainChunk, lossy_compression: bool) -> Self {
|
||||||
if lossy_compression && (chunk.get_max_z() - chunk.get_min_z() <= 128) {
|
if lossy_compression && (chunk.get_max_z() - chunk.get_min_z() <= 128) {
|
||||||
Self::quadpng(chunk)
|
Self::quadpng(chunk)
|
||||||
|
Loading…
Reference in New Issue
Block a user