From 0cb48d3c313b872cb71d43efe781b8a9bd19ad3e Mon Sep 17 00:00:00 2001 From: jbikker Date: Mon, 30 Dec 2024 19:52:57 +0100 Subject: [PATCH] Bug fix. --- tiny_bvh.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tiny_bvh.h b/tiny_bvh.h index d0b60dd..27b1789 100644 --- a/tiny_bvh.h +++ b/tiny_bvh.h @@ -1260,7 +1260,7 @@ void BVH::Build( const bvhvec4slice& vertices, const uint32_t* indices, uint32_t } void BVH::PrepareBuild( const bvhvec4slice& vertices, const uint32_t* indices, const uint32_t prims ) { - uint32_t primCount = prims > 0 ? prims : vertices.count; + uint32_t primCount = prims > 0 ? prims : vertices.count / 3; const uint32_t spaceNeeded = primCount * 2; // upper limit // allocate memory on first build if (allocatedNodes < spaceNeeded)