Skip to content

Commit

Permalink
Skip render mesh when it's not visible
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve J. Cai committed Sep 23, 2023
1 parent 14fe1a1 commit 626c9b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Hydrogent/src/HnMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ void HnMesh::Sync(pxr::HdSceneDelegate* Delegate,
m_MaterialId = Delegate->GetMaterialId(Id);
}

_UpdateVisibility(Delegate, DirtyBits);

*DirtyBits &= ~pxr::HdChangeTracker::AllSceneDirtyBits;
}

Expand Down
2 changes: 2 additions & 0 deletions Hydrogent/src/HnRendererImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ void HnRendererImpl::Draw(IDeviceContext* pCtx, const HnDrawAttribs& Attribs)
continue;

auto& Mesh = *mesh_it.second;
if (!Mesh.IsVisible())
continue;

const auto& MaterialId = Mesh.GetMaterialId();
const auto* pMaterial = m_RenderDelegate->GetMaterial(MaterialId.GetText());
Expand Down

0 comments on commit 626c9b4

Please sign in to comment.