HdRenderPassSharedPtr const & Hd_TestDriver::GetRenderPass(bool withGuides) { if (withGuides) { if (!_geomAndGuidePass) { TfTokenVector renderTags; renderTags.push_back(HdTokens->geometry); renderTags.push_back(HdTokens->guide); HdRprimCollection col = HdRprimCollection( HdTokens->geometry, _reprSelector); col.SetRenderTags(renderTags); _geomAndGuidePass = HdRenderPassSharedPtr( new Hd_UnitTestNullRenderPass(&_sceneDelegate->GetRenderIndex(), col)); } return _geomAndGuidePass; } else { if (!_geomPass) { TfTokenVector renderTags; renderTags.push_back(HdTokens->geometry); HdRprimCollection col = HdRprimCollection( HdTokens->geometry, _reprSelector); col.SetRenderTags(renderTags); _geomPass = HdRenderPassSharedPtr( new Hd_UnitTestNullRenderPass(&_sceneDelegate->GetRenderIndex(), col)); } return _geomPass; } }
void Hd_TestDriver::SetRepr(HdReprSelector const &reprSelector) { _reprSelector = reprSelector; if (_geomAndGuidePass) { TfTokenVector renderTags; renderTags.push_back(HdTokens->geometry); renderTags.push_back(HdTokens->guide); HdRprimCollection col = HdRprimCollection( HdTokens->geometry, _reprSelector); col.SetRenderTags(renderTags); _geomAndGuidePass->SetRprimCollection(col); } if (_geomPass) { TfTokenVector renderTags; renderTags.push_back(HdTokens->geometry); HdRprimCollection col = HdRprimCollection( HdTokens->geometry, _reprSelector); col.SetRenderTags(renderTags); _geomPass->SetRprimCollection(col); } }
// UsdImaging_TestDriver void UsdImaging_TestDriver::_Init(UsdStageRefPtr const& usdStage, TfToken const &collectionName, TfToken const &reprName, TfTokenVector const &renderTags) { _renderIndex = HdRenderIndex::New(&_renderDelegate); TF_VERIFY(_renderIndex != nullptr); _delegate = new UsdImagingDelegate(_renderIndex, SdfPath::AbsoluteRootPath()); _stage = usdStage; _delegate->Populate(_stage->GetPseudoRoot()); HdRprimCollection col = HdRprimCollection(collectionName, reprName); col.SetRenderTags(renderTags); _geometryPass = HdRenderPassSharedPtr(new HdSt_RenderPass(_renderIndex, col)); _renderPassState = HdRenderPassStateSharedPtr(new HdRenderPassState()); }