From 1264caa0dac8d0958c43829ad97509a44ddc701e Mon Sep 17 00:00:00 2001 From: Pascal Grittmann Date: Thu, 8 Aug 2024 17:32:07 +0200 Subject: [PATCH] fix for many empty paths --- SeeSharp/Integrators/Common/PathCache.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SeeSharp/Integrators/Common/PathCache.cs b/SeeSharp/Integrators/Common/PathCache.cs index 9d98381..5f35842 100644 --- a/SeeSharp/Integrators/Common/PathCache.cs +++ b/SeeSharp/Integrators/Common/PathCache.cs @@ -32,7 +32,10 @@ public ref PathVertex GetVertex(int globalVertexIdx) { int offset = globalVertexIdx - (idx == 0 ? 0 : cumPathLen[idx - 1]); vertexMemoryIdx = pathIndices[idx] + offset; } else { - vertexMemoryIdx = pathIndices[idx + 1]; + // Skip empty paths in-between + do idx++; + while (pathIndices[idx] == -1); + vertexMemoryIdx = pathIndices[idx]; } return ref memory[vertexMemoryIdx]; }