mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix lpindex
not being updated for culled objects, and don't
recalculate frustum for every entity
This commit is contained in:
parent
4e7c955490
commit
127f8fb72b
@ -73,6 +73,7 @@ impl FigureMgr {
|
|||||||
let ecs = client.state().ecs();
|
let ecs = client.state().ecs();
|
||||||
let view_distance = client.view_distance().unwrap_or(1);
|
let view_distance = client.view_distance().unwrap_or(1);
|
||||||
let dt = client.state().get_delta_time();
|
let dt = client.state().get_delta_time();
|
||||||
|
let frustum = camera.frustum(client);
|
||||||
// Get player position.
|
// Get player position.
|
||||||
let player_pos = ecs
|
let player_pos = ecs
|
||||||
.read_storage::<Pos>()
|
.read_storage::<Pos>()
|
||||||
@ -190,8 +191,6 @@ impl FigureMgr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't process figures outside the frustum spectrum
|
// Don't process figures outside the frustum spectrum
|
||||||
let frustum = camera.frustum(client);
|
|
||||||
|
|
||||||
let (in_frustum, lpindex) =
|
let (in_frustum, lpindex) =
|
||||||
BoundingSphere::new(pos.0.into_array(), scale.unwrap_or(&Scale(1.0)).0 * 2.0)
|
BoundingSphere::new(pos.0.into_array(), scale.unwrap_or(&Scale(1.0)).0 * 2.0)
|
||||||
.coherent_test_against_frustum(
|
.coherent_test_against_frustum(
|
||||||
@ -242,54 +241,64 @@ impl FigureMgr {
|
|||||||
if !in_frustum {
|
if !in_frustum {
|
||||||
match body {
|
match body {
|
||||||
Body::Humanoid(_) => {
|
Body::Humanoid(_) => {
|
||||||
self.character_states
|
self.character_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::QuadrupedSmall(_) => {
|
Body::QuadrupedSmall(_) => {
|
||||||
self.quadruped_small_states
|
self.quadruped_small_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::QuadrupedMedium(_) => {
|
Body::QuadrupedMedium(_) => {
|
||||||
self.quadruped_medium_states
|
self.quadruped_medium_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::BirdMedium(_) => {
|
Body::BirdMedium(_) => {
|
||||||
self.bird_medium_states
|
self.bird_medium_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::FishMedium(_) => {
|
Body::FishMedium(_) => {
|
||||||
self.fish_medium_states
|
self.fish_medium_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::Dragon(_) => {
|
Body::Dragon(_) => {
|
||||||
self.dragon_states
|
self.dragon_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::BirdSmall(_) => {
|
Body::BirdSmall(_) => {
|
||||||
self.bird_small_states
|
self.bird_small_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::FishSmall(_) => {
|
Body::FishSmall(_) => {
|
||||||
self.fish_small_states
|
self.fish_small_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::BipedLarge(_) => {
|
Body::BipedLarge(_) => {
|
||||||
self.biped_large_states
|
self.biped_large_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Body::Object(_) => {
|
Body::Object(_) => {
|
||||||
self.object_states
|
self.object_states.get_mut(&entity).map(|state| {
|
||||||
.get_mut(&entity)
|
state.lpindex = lpindex;
|
||||||
.map(|state| state.visible = false);
|
state.visible = false
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user