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

Method UpdateDrawItemGpuGeometry

Hydrogent/src/HnMesh.cpp:1239–1276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237}
1238
1239void HnMesh::UpdateDrawItemGpuGeometry(HnRenderDelegate& RenderDelegate)
1240{
1241 for (auto& it : _reprs)
1242 {
1243 pxr::HdRepr& Repr = *it.second;
1244 const size_t DrawItemCount = Repr.GetDrawItems().size();
1245 for (size_t item = 0; item < DrawItemCount; ++item)
1246 {
1247 HnDrawItem& DrawItem = *static_cast<HnDrawItem*>(Repr.GetDrawItem(item));
1248
1249 HnDrawItem::GeometryData Geo;
1250 Geo.Positions = GetVertexBuffer(pxr::HdTokens->points);
1251 Geo.Normals = GetVertexBuffer(pxr::HdTokens->normals);
1252 Geo.VertexColors = GetVertexBuffer(pxr::HdTokens->displayColor);
1253
1254 // Our shader currently supports two texture coordinate sets.
1255 // Gather vertex buffers for both sets.
1256 if (const HnMaterial* pMaterial = DrawItem.GetMaterial())
1257 {
1258 const auto& TexCoordSets = pMaterial->GetTextureCoordinateSets();
1259 for (size_t i = 0; i < TexCoordSets.size(); ++i)
1260 {
1261 const auto& TexCoordSet = TexCoordSets[i];
1262 if (!TexCoordSet.PrimVarName.IsEmpty())
1263 {
1264 Geo.TexCoords[i] = GetVertexBuffer(TexCoordSet.PrimVarName);
1265 if (!Geo.TexCoords[i])
1266 {
1267 LOG_ERROR_MESSAGE("Failed to find texture coordinates vertex buffer '", TexCoordSet.PrimVarName.GetText(), "' in mesh '", GetId().GetText(), "'");
1268 }
1269 }
1270 }
1271 }
1272
1273 DrawItem.SetGeometryData(std::move(Geo));
1274 }
1275 }
1276}
1277
1278void HnMesh::UpdateDrawItemGpuTopology()
1279{

Callers

nothing calls this directly

Calls 2

GetMaterialMethod · 0.80
SetGeometryDataMethod · 0.80

Tested by

no test coverage detected