MCPcopy Create free account
hub / github.com/DiligentGraphics/DiligentFX / UpdateVertexAndVaryingPrimvars

Method UpdateVertexAndVaryingPrimvars

Hydrogent/src/HnMesh.cpp:502–546  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500}
501
502void HnMesh::UpdateVertexAndVaryingPrimvars(pxr::HdSceneDelegate& SceneDelegate,
503 pxr::HdRenderParam* RenderParam,
504 pxr::HdDirtyBits& DirtyBits,
505 const pxr::TfToken& ReprToken)
506{
507 VERIFY_EXPR(m_StagingVertexData);
508 const pxr::SdfPath& Id = GetId();
509
510 const int NumPoints = m_Topology.GetNumPoints();
511
512 const HnRenderPass::SupportedVertexInputsSetType SupportedPrimvars = GetSupportedPrimvars(SceneDelegate.GetRenderIndex(), GetMaterialId(), m_Topology);
513
514 auto AddPrimvarSource = [&](const pxr::HdPrimvarDescriptor& PrimDesc) {
515 if (!pxr::HdChangeTracker::IsPrimvarDirty(DirtyBits, Id, PrimDesc.name))
516 return;
517
518 // Skip unsupported primvars
519 if (SupportedPrimvars.find(PrimDesc.name) == SupportedPrimvars.end())
520 return;
521
522 pxr::VtValue PrimValue = GetPrimvar(&SceneDelegate, PrimDesc.name);
523 if (PrimValue.IsEmpty())
524 return;
525
526 if (auto BufferSource = CreateBufferSource(PrimDesc.name, PrimValue, NumPoints, Id))
527 {
528 m_StagingVertexData->Sources.emplace(PrimDesc.name, std::move(BufferSource));
529 }
530 };
531
532 for (pxr::HdInterpolation Interpolation : {pxr::HdInterpolationVertex, pxr::HdInterpolationVarying})
533 {
534 pxr::HdPrimvarDescriptorVector PrimVarDescs = GetPrimvarDescriptors(&SceneDelegate, Interpolation);
535 for (const pxr::HdPrimvarDescriptor& PrimDesc : PrimVarDescs)
536 {
537 AddPrimvarSource(PrimDesc);
538 }
539
540 pxr::HdExtComputationPrimvarDescriptorVector CompPrimvarsDescs = SceneDelegate.GetExtComputationPrimvarDescriptors(Id, Interpolation);
541 for (const pxr::HdExtComputationPrimvarDescriptor& ExtCompPrimDesc : CompPrimvarsDescs)
542 {
543 AddPrimvarSource(ExtCompPrimDesc);
544 }
545 }
546}
547
548void HnMesh::UpdateFaceVaryingPrimvars(pxr::HdSceneDelegate& SceneDelegate,
549 pxr::HdRenderParam* RenderParam,

Callers

nothing calls this directly

Calls 2

GetSupportedPrimvarsFunction · 0.85
CreateBufferSourceFunction · 0.85

Tested by

no test coverage detected