Skip to content

Commit

Permalink
Add visual check in CGameObject::OnRender method
Browse files Browse the repository at this point in the history
  • Loading branch information
Drombeys committed Sep 29, 2024
1 parent 8dc41be commit 21edf97
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/xrGame/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,20 +1107,25 @@ void render_box (IRenderVisual *visual, const Fmatrix &xform, const Fvector

void CGameObject::OnRender ()
{
if (Visual() == nullptr)
{
return;
}

if (!ai().get_level_graph())
return;

if (Visual()->getVisData().hom_frame != Device.dwFrame)
return;

CDebugRenderer &renderer = Level().debug_renderer();
if (/**bDebug && /**/Visual()) {
float half_cell_size = 1.f*ai().level_graph().header().cell_size()*.5f;
Fvector additional = Fvector().set(half_cell_size,half_cell_size,half_cell_size);

float half_cell_size = 1.f*ai().level_graph().header().cell_size()*.5f;
Fvector additional = Fvector().set(half_cell_size,half_cell_size,half_cell_size);

render_box (Visual(),XFORM(),Fvector().set(0.f,0.f,0.f),true,color_rgba(0,0,255,255));
render_box (Visual(),XFORM(),additional,false,color_rgba(0,255,0,255));
}
render_box (Visual(),XFORM(),Fvector().set(0.f,0.f,0.f),true,color_rgba(0,0,255,255));
render_box (Visual(),XFORM(),additional,false,color_rgba(0,255,0,255));


if (0) {
Fvector bc,bd;
Expand Down

0 comments on commit 21edf97

Please sign in to comment.