MCPcopy Create free account
hub / github.com/TheRealMJP/SHforHLSL / kdtreeBuildLeaf

Function kdtreeBuildLeaf

SHTest/Externals/meshoptimizer/clusterizer.cpp:394–416  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394static size_t kdtreeBuildLeaf(size_t offset, KDNode* nodes, size_t node_count, unsigned int* indices, size_t count)
395{
396 assert(offset + count <= node_count);
397 (void)node_count;
398
399 KDNode& result = nodes[offset];
400
401 result.index = indices[0];
402 result.axis = 3;
403 result.children = unsigned(count - 1);
404
405 // all remaining points are stored in nodes immediately following the leaf
406 for (size_t i = 1; i < count; ++i)
407 {
408 KDNode& tail = nodes[offset + i];
409
410 tail.index = indices[i];
411 tail.axis = 3;
412 tail.children = ~0u >> 2; // bogus value to prevent misuse
413 }
414
415 return offset + count;
416}
417
418static size_t kdtreeBuild(size_t offset, KDNode* nodes, size_t node_count, const float* points, size_t stride, unsigned int* indices, size_t count, size_t leaf_size)
419{

Callers 1

kdtreeBuildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected