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 Oct 3, 2023
1 parent 33be57f commit 79c875a
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 @@ -238,6 +238,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 79c875a

Please sign in to comment.