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

MAYA-112073 Build a proper index buffer for the default material render item when #1522

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
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
14 changes: 8 additions & 6 deletions lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ void HdVP2Mesh::_UpdateRepr(HdSceneDelegate* sceneDelegate, const TfToken& reprT
}

for (auto& renderItemData : drawItem->GetRenderItems()) {
_UpdateDrawItem(sceneDelegate, drawItem, renderItemData, desc);
_UpdateDrawItem(sceneDelegate, drawItem, renderItemData, desc, reprToken);
}
}
}
Expand All @@ -1609,7 +1609,8 @@ void HdVP2Mesh::_UpdateDrawItem(
HdSceneDelegate* sceneDelegate,
HdVP2DrawItem* drawItem,
HdVP2DrawItem::RenderItemData& renderItemData,
const HdMeshReprDesc& desc)
const HdMeshReprDesc& desc,
const TfToken& reprToken)
{
HdDirtyBits itemDirtyBits = renderItemData.GetDirtyBits();

Expand Down Expand Up @@ -1666,10 +1667,11 @@ void HdVP2Mesh::_UpdateDrawItem(
// geom subset and add those triangles to the index buffer for renderItem.

VtVec3iArray trianglesFaceVertexIndices; // for this item only!
if (_meshSharedData->_faceIdToRenderItem.size() == 0) {
// If there is no mapping from face to render item, then all the faces are on this
// render item.
// VtArray has copy-on-write semantics so this is fast
if (_meshSharedData->_faceIdToRenderItem.size() == 0
|| reprToken == HdVP2ReprTokens->defaultMaterial) {
// If there is no mapping from face to render item or if this is the default
// material item then all the faces are on this render item. VtArray has
// copy-on-write semantics so this is fast
trianglesFaceVertexIndices = _meshSharedData->_trianglesFaceVertexIndices;
} else {
for (size_t triangleId = 0; triangleId < _meshSharedData->_primitiveParam.size();
Expand Down
3 changes: 2 additions & 1 deletion lib/mayaUsd/render/vp2RenderDelegate/mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ class HdVP2Mesh final : public HdMesh
HdSceneDelegate*,
HdVP2DrawItem*,
HdVP2DrawItem::RenderItemData&,
const HdMeshReprDesc& desc);
const HdMeshReprDesc& desc,
const TfToken& reprToken);

void _HideAllDrawItems(const TfToken& reprToken);

Expand Down