[renderer] Check view_model entity is valid

It usually is in quake, but my test scene does not have a view model.
This commit is contained in:
Bill Currie 2022-10-27 12:53:01 +09:00
parent fa057cb121
commit c605e50d52
4 changed files with 12 additions and 0 deletions

View file

@ -160,6 +160,9 @@ static void
R_DrawViewModel (void)
{
entity_t ent = vr_data.view_model;
if (!Entity_Valid (ent)) {
return;
}
renderer_t *renderer = Ent_GetComponent (ent.id, scene_renderer, ent.reg);
if (vr_data.inhibit_viewmodel
|| !r_drawviewmodel

View file

@ -116,6 +116,9 @@ static void
R_DrawViewModel (void)
{
entity_t ent = vr_data.view_model;
if (!Entity_Valid (ent)) {
return;
}
renderer_t *renderer = Ent_GetComponent (ent.id, scene_renderer, ent.reg);
if (vr_data.inhibit_viewmodel
|| !r_drawviewmodel

View file

@ -377,6 +377,9 @@ R_DrawViewModel (void)
return;
viewent = vr_data.view_model;
if (!Entity_Valid (viewent)) {
return;
}
renderer_t *renderer = Ent_GetComponent (viewent.id, scene_renderer,
viewent.reg);

View file

@ -108,6 +108,9 @@ static void
Vulkan_DrawViewModel (vulkan_ctx_t *ctx)
{
entity_t ent = vr_data.view_model;
if (!Entity_Valid (ent)) {
return;
}
renderer_t *renderer = Ent_GetComponent (ent.id, scene_renderer, ent.reg);
if (vr_data.inhibit_viewmodel
|| !r_drawviewmodel