Skip to content

Commit 2ddc284

Browse files
integrate batch AABBs by @PrzemoG into the pathtracer
1 parent c54b918 commit 2ddc284

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples_tests/22.RaytracedAO/Renderer.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
351351

352352
constexpr uint32_t kIndicesPerTriangle = 3u;
353353
core::vector<CPUMeshPacker::CombinedDataOffsetTable> cdot(mdiBoundMax);
354+
core::vector<core::aabbox3df> aabbs(mdiBoundMax);
354355
MDICall* mdiCall = nullptr;
355356
core::vector<int32_t> fatIndicesForRR(maxTrisBatch*kIndicesPerTriangle);
356357
for (const auto& asset : contents)
@@ -361,7 +362,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
361362
const auto& instanceAuxData = meta->m_instanceAuxData;
362363

363364
auto meshBuffers = cpumesh->getMeshBuffers();
364-
const uint32_t actualMdiCnt = cpump->commit(&*pmbdIt,cdot.data(),nullptr,&*allocDataIt,meshBuffers.begin(),meshBuffers.end());
365+
const uint32_t actualMdiCnt = cpump->commit(&*pmbdIt,cdot.data(),aabbs.data(),&*allocDataIt,meshBuffers.begin(),meshBuffers.end());
365366
allocDataIt += meshBuffers.size();
366367
if (actualMdiCnt==0u)
367368
{
@@ -374,6 +375,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
374375
const auto aabbMesh = cpumesh->getBoundingBox();
375376
// meshbuffers
376377
auto cdotIt = cdot.begin();
378+
auto aabbsIt = aabbs.begin();
377379
for (auto mb : meshBuffers)
378380
{
379381
assert(mb->getInstanceCount()==instanceData.size());
@@ -402,7 +404,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
402404
);
403405

404406
const auto thisShapeInstancesBeginIx = rrInstances.size();
405-
const auto& batchAABB = mb->getBoundingBox();// TODO: replace with batch AABB
407+
const auto& batchAABB = *aabbsIt;
406408
for (auto auxIt=instanceAuxData.begin(); auxIt!=instanceAuxData.end(); auxIt++)
407409
{
408410
const auto batchInstanceGUID = cullData.size();
@@ -460,6 +462,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
460462
for (auto j=thisShapeInstancesBeginIx; j!=rrInstances.size(); j++)
461463
rr->AttachShape(rrInstances[j]);
462464
cdotIt++;
465+
aabbsIt++;
463466
}
464467
//
465468
if (!mdiCall || pmbdIt->mdiParameterOffset!=mdiCall->mdiOffset+mdiCall->mdiCount)

0 commit comments

Comments
 (0)