SpiecsEngine
 
Loading...
Searching...
No Matches

◆ AddMaterialToHitGroup()

void Spices::Mesh::AddMaterialToHitGroup ( std::unordered_map< std::string, uint32_t > & hitGroup)

Add Mesh's material to hit group.

Parameters
[in,out]hitGroupRayTracingRenderer HitGroup.

Definition at line 16 of file Mesh.cpp.

17 {
19
20 m_Pack->for_each([&](const uint32_t& k, const std::shared_ptr<MeshPack>& v) {
21
22 auto& stages = v->GetMaterial()->GetShaderPath("rchit");
23 if (stages.empty())
24 {
25 std::stringstream ss;
26 ss << "Material: " << v->GetMaterial()->GetName() << " do not has valid rchit shader.";
27
28 SPICES_CORE_ERROR(ss.str())
29 }
30
31 if (hitGroup.find(stages[0]) == hitGroup.end())
32 {
33 hitGroup[stages[0]] = static_cast<uint32_t>(hitGroup.size());
34
35 v->SetHitShaderHandle(hitGroup[stages[0]]);
36 }
37 else
38 {
39 v->SetHitShaderHandle(hitGroup[stages[0]]);
40 }
41
42 return false;
43 });
44 }
#define SPICES_PROFILE_ZONE
std::shared_ptr< scl::linked_unordered_map< uint32_t, std::shared_ptr< MeshPack > > > m_Pack
All packs in this mesh.
Definition Mesh.h:115