bvh_builder.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2009-2021 Intel Corporation
  2. // SPDX-License-Identifier: Apache-2.0
  3. #include "bvh_builder.h"
  4. namespace embree
  5. {
  6. namespace isa
  7. {
  8. template<int N>
  9. typename BVHN<N>::NodeRef BVHNBuilderVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings)
  10. {
  11. auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRef {
  12. return createLeaf(prims,set,alloc);
  13. };
  14. settings.branchingFactor = N;
  15. settings.maxDepth = BVH::maxBuildDepthLeaf;
  16. return BVHBuilderBinnedSAH::build<NodeRef>
  17. (FastAllocator::Create(allocator),typename BVH::AABBNode::Create2(),typename BVH::AABBNode::Set3(allocator,prims),createLeafFunc,progressFunc,prims,pinfo,settings);
  18. }
  19. template<int N>
  20. typename BVHN<N>::NodeRef BVHNBuilderQuantizedVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings)
  21. {
  22. auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRef {
  23. return createLeaf(prims,set,alloc);
  24. };
  25. settings.branchingFactor = N;
  26. settings.maxDepth = BVH::maxBuildDepthLeaf;
  27. return BVHBuilderBinnedSAH::build<NodeRef>
  28. (FastAllocator::Create(allocator),typename BVH::QuantizedNode::Create2(),typename BVH::QuantizedNode::Set2(),createLeafFunc,progressFunc,prims,pinfo,settings);
  29. }
  30. template<int N>
  31. typename BVHN<N>::NodeRecordMB BVHNBuilderMblurVirtual<N>::BVHNBuilderV::build(FastAllocator* allocator, BuildProgressMonitor& progressFunc, PrimRef* prims, const PrimInfo& pinfo, GeneralBVHBuilder::Settings settings, const BBox1f& timeRange)
  32. {
  33. auto createLeafFunc = [&] (const PrimRef* prims, const range<size_t>& set, const Allocator& alloc) -> NodeRecordMB {
  34. return createLeaf(prims,set,alloc);
  35. };
  36. settings.branchingFactor = N;
  37. settings.maxDepth = BVH::maxBuildDepthLeaf;
  38. return BVHBuilderBinnedSAH::build<NodeRecordMB>
  39. (FastAllocator::Create(allocator),typename BVH::AABBNodeMB::Create(),typename BVH::AABBNodeMB::SetTimeRange(timeRange),createLeafFunc,progressFunc,prims,pinfo,settings);
  40. }
  41. template struct BVHNBuilderVirtual<4>;
  42. template struct BVHNBuilderQuantizedVirtual<4>;
  43. template struct BVHNBuilderMblurVirtual<4>;
  44. #if defined(__AVX__)
  45. template struct BVHNBuilderVirtual<8>;
  46. template struct BVHNBuilderQuantizedVirtual<8>;
  47. template struct BVHNBuilderMblurVirtual<8>;
  48. #endif
  49. }
  50. }