Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ignore invisible #1

Open
wants to merge 1 commit into
base: needle/feature/wasm-improvements
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions pxr/usdImaging/usdImaging/indexProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ UsdImagingIndexProxy::AddDependency(SdfPath const& cachePath,
usdPath.GetText(), cachePath.GetText());
}

bool IsVisible(const UsdPrim& prim) {
if (prim.IsA<UsdGeomImageable>()) {
UsdGeomImageable imageable(prim);
TfToken visibility = imageable.ComputeVisibility();
return visibility != UsdGeomTokens->invisible;
}
return true;
}

void
UsdImagingIndexProxy::InsertRprim(
TfToken const& primType,
Expand All @@ -189,19 +198,23 @@ UsdImagingIndexProxy::InsertRprim(
if (primInfo) {
HdRenderIndex &renderIndex = _delegate->GetRenderIndex();
SdfPath indexPath = _delegate->ConvertCachePathToIndexPath(cachePath);
renderIndex.InsertRprim(primType, _delegate, indexPath);

// NOTE: Starting from AllDirty doesn't necessarily match what the
// render delegate's concrete implementation of a given Rprim
// might return but will be fully inclusive of it. Not querying it
// directly from the change tracker immediately provides
// flexibility as to when insertions will be processed. This is
// relevant to downstream consumption patterns when emulated via
// a scene index.
primInfo->dirtyBits = HdChangeTracker::AllDirty;
_delegate->_dirtyCachePaths.insert(cachePath);
if (IsVisible(usdPrim)){
renderIndex.InsertRprim(primType, _delegate, indexPath);

// NOTE: Starting from AllDirty doesn't necessarily match what the
// render delegate's concrete implementation of a given Rprim
// might return but will be fully inclusive of it. Not querying it
// directly from the change tracker immediately provides
// flexibility as to when insertions will be processed. This is
// relevant to downstream consumption patterns when emulated via
// a scene index.
primInfo->dirtyBits = HdChangeTracker::AllDirty;
_delegate->_dirtyCachePaths.insert(cachePath);

_AddTask(cachePath);
}

_AddTask(cachePath);
}
}

Expand Down