fix(render): figures without vel don't render

This commit is contained in:
timokoesters 2019-09-28 22:23:54 +02:00
parent fc97c27b65
commit 469349a426
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097

View File

@ -62,10 +62,9 @@ impl FigureMgr {
.get(client.entity()) .get(client.entity())
.map_or(Vec3::zero(), |pos| pos.0); .map_or(Vec3::zero(), |pos| pos.0);
for (entity, pos, vel, ori, scale, body, character, last_character, stats) in ( for (entity, pos, ori, scale, body, character, last_character, stats) in (
&ecs.entities(), &ecs.entities(),
&ecs.read_storage::<Pos>(), &ecs.read_storage::<Pos>(),
&ecs.read_storage::<Vel>(),
&ecs.read_storage::<Ori>(), &ecs.read_storage::<Ori>(),
ecs.read_storage::<Scale>().maybe(), ecs.read_storage::<Scale>().maybe(),
&ecs.read_storage::<Body>(), &ecs.read_storage::<Body>(),
@ -130,6 +129,12 @@ impl FigureMgr {
let mut movement_animation_rate = 1.0; let mut movement_animation_rate = 1.0;
let mut action_animation_rate = 1.0; let mut action_animation_rate = 1.0;
let vel = ecs
.read_storage::<Vel>()
.get(entity)
.cloned()
.unwrap_or_default();
match body { match body {
Body::Humanoid(_) => { Body::Humanoid(_) => {
let state = self let state = self
@ -421,10 +426,9 @@ impl FigureMgr {
.read_storage::<common::comp::CharacterState>(); .read_storage::<common::comp::CharacterState>();
let character_state = character_state_storage.get(client.entity()); let character_state = character_state_storage.get(client.entity());
for (entity, _, _, _, body, stats, _) in ( for (entity, _, _, body, stats, _) in (
&ecs.entities(), &ecs.entities(),
&ecs.read_storage::<Pos>(), &ecs.read_storage::<Pos>(),
&ecs.read_storage::<Vel>(),
&ecs.read_storage::<Ori>(), &ecs.read_storage::<Ori>(),
&ecs.read_storage::<Body>(), &ecs.read_storage::<Body>(),
ecs.read_storage::<Stats>().maybe(), ecs.read_storage::<Stats>().maybe(),
@ -432,7 +436,7 @@ impl FigureMgr {
) )
.join() .join()
// Don't render figures outside of frustum (camera viewport, max draw distance is farplane) // Don't render figures outside of frustum (camera viewport, max draw distance is farplane)
.filter(|(_, pos, _, _, _, _, scale)| { .filter(|(_, pos, _, _, _, scale)| {
frustum.sphere_intersecting( frustum.sphere_intersecting(
&pos.0.x, &pos.0.x,
&pos.0.y, &pos.0.y,
@ -441,7 +445,7 @@ impl FigureMgr {
) )
}) })
// Don't render dead entities // Don't render dead entities
.filter(|(_, _, _, _, _, stats, _)| stats.map_or(true, |s| !s.is_dead)) .filter(|(_, _, _, _, stats, _)| stats.map_or(true, |s| !s.is_dead))
{ {
if let Some((locals, bone_consts)) = match body { if let Some((locals, bone_consts)) = match body {
Body::Humanoid(_) => self Body::Humanoid(_) => self