mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix figure visible value not updating
This commit is contained in:
parent
31d18b3381
commit
0b67dad4a5
32
Cargo.lock
generated
32
Cargo.lock
generated
@ -864,15 +864,6 @@ dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs"
|
||||
version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys"
|
||||
version = "0.3.4"
|
||||
@ -2983,16 +2974,6 @@ name = "shrev"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "simplelog"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.2.3"
|
||||
@ -3245,15 +3226,6 @@ dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "term"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.0.5"
|
||||
@ -3549,7 +3521,7 @@ dependencies = [
|
||||
"dot_vox 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euc 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fern 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fern 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"frustum_culling 0.1.0 (git+https://gitlab.com/yusdacra/frustum_culling)",
|
||||
"gfx 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gfx_device_gl 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3957,7 +3929,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum derivative 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "942ca430eef7a3806595a6737bc388bf51adb888d3fc0dd1b50f1c170167ee3a"
|
||||
"checksum directories 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c"
|
||||
"checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901"
|
||||
"checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3"
|
||||
"checksum dirs-sys 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afa0b23de8fd801745c471deffa6e12d248f962c9fd4b4c33787b055599bde7b"
|
||||
"checksum discord-rpc-sdk 0.1.1 (git+https://github.com/Songtronix/rust-discord-rpc.git)" = "<none>"
|
||||
"checksum discord-rpc-sys 0.1.0 (git+https://github.com/Songtronix/rust-discord-rpc.git)" = "<none>"
|
||||
@ -4221,7 +4192,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
||||
"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1"
|
||||
"checksum term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42"
|
||||
"checksum term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5"
|
||||
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"
|
||||
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
|
@ -90,6 +90,84 @@ impl FigureMgr {
|
||||
)
|
||||
.join()
|
||||
{
|
||||
// Don't process figures outside the vd
|
||||
let vd_frac = Vec2::from(pos.0 - player_pos)
|
||||
.map2(TerrainChunk::RECT_SIZE, |d: f32, sz| {
|
||||
d.abs() as f32 / sz as f32
|
||||
})
|
||||
.magnitude()
|
||||
/ view_distance as f32;
|
||||
// Keep from re-adding/removing entities on the border of the vd
|
||||
if vd_frac > 1.2 {
|
||||
match body {
|
||||
Body::Humanoid(_) => {
|
||||
self.character_states.remove(&entity);
|
||||
}
|
||||
Body::QuadrupedSmall(_) => {
|
||||
self.quadruped_small_states.remove(&entity);
|
||||
}
|
||||
Body::QuadrupedMedium(_) => {
|
||||
self.quadruped_medium_states.remove(&entity);
|
||||
}
|
||||
Body::BirdMedium(_) => {
|
||||
self.bird_medium_states.remove(&entity);
|
||||
}
|
||||
Body::FishMedium(_) => {
|
||||
self.fish_medium_states.remove(&entity);
|
||||
}
|
||||
Body::Dragon(_) => {
|
||||
self.dragon_states.remove(&entity);
|
||||
}
|
||||
Body::BirdSmall(_) => {
|
||||
self.bird_small_states.remove(&entity);
|
||||
}
|
||||
Body::FishSmall(_) => {
|
||||
self.fish_small_states.remove(&entity);
|
||||
}
|
||||
Body::BipedLarge(_) => {
|
||||
self.biped_large_states.remove(&entity);
|
||||
}
|
||||
Body::Object(_) => {
|
||||
self.object_states.remove(&entity);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
} else if vd_frac > 1.0 {
|
||||
match body {
|
||||
Body::Humanoid(_) => {
|
||||
self.character_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::QuadrupedSmall(_) => {
|
||||
self.quadruped_small_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::QuadrupedMedium(_) => {
|
||||
self.quadruped_medium_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::BirdMedium(_) => {
|
||||
self.bird_medium_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::FishMedium(_) => {
|
||||
self.fish_medium_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::Dragon(_) => {
|
||||
self.dragon_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::BirdSmall(_) => {
|
||||
self.bird_small_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::FishSmall(_) => {
|
||||
self.fish_small_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::BipedLarge(_) => {
|
||||
self.biped_large_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
Body::Object(_) => {
|
||||
self.object_states.get_mut(&entity).map(|state| state.visible = false);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Don't process figures outside the frustum spectrum
|
||||
let frustum = camera.frustum(client);
|
||||
|
||||
@ -163,49 +241,7 @@ impl FigureMgr {
|
||||
}
|
||||
}
|
||||
|
||||
// Don't process figures outside the vd
|
||||
let vd_frac = Vec2::from(pos.0 - player_pos)
|
||||
.map2(TerrainChunk::RECT_SIZE, |d: f32, sz| {
|
||||
d.abs() as f32 / sz as f32
|
||||
})
|
||||
.magnitude()
|
||||
/ view_distance as f32;
|
||||
// Keep from re-adding/removing entities on the border of the vd
|
||||
if vd_frac > 1.2 {
|
||||
match body {
|
||||
Body::Humanoid(_) => {
|
||||
self.character_states.remove(&entity);
|
||||
}
|
||||
Body::QuadrupedSmall(_) => {
|
||||
self.quadruped_small_states.remove(&entity);
|
||||
}
|
||||
Body::QuadrupedMedium(_) => {
|
||||
self.quadruped_medium_states.remove(&entity);
|
||||
}
|
||||
Body::BirdMedium(_) => {
|
||||
self.bird_medium_states.remove(&entity);
|
||||
}
|
||||
Body::FishMedium(_) => {
|
||||
self.fish_medium_states.remove(&entity);
|
||||
}
|
||||
Body::Dragon(_) => {
|
||||
self.dragon_states.remove(&entity);
|
||||
}
|
||||
Body::BirdSmall(_) => {
|
||||
self.bird_small_states.remove(&entity);
|
||||
}
|
||||
Body::FishSmall(_) => {
|
||||
self.fish_small_states.remove(&entity);
|
||||
}
|
||||
Body::BipedLarge(_) => {
|
||||
self.biped_large_states.remove(&entity);
|
||||
}
|
||||
Body::Object(_) => {
|
||||
self.object_states.remove(&entity);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
} else if vd_frac > 1.0 || !in_frustum {
|
||||
if !in_frustum {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user