1 // Created on: 2013-12-20
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _BVH_BinnedBuilder_Header
17 #define _BVH_BinnedBuilder_Header
19 #include <BVH_QueueBuilder.hxx>
23 //! Stores parameters of single node bin (slice of AABB).
24 template<class T, int N>
27 //! Creates new node bin.
28 BVH_Bin() : Count (0) {}
30 Standard_Integer Count; //!< Number of primitives in the bin
31 BVH_Box<T, N> Box; //!< AABB of primitives in the bin
34 //! Performs building of BVH tree using binned SAH algorithm.
35 //! Number of Bins controls tree's quality (greater - better) in cost of construction time.
36 template<class T, int N, int Bins = 32>
37 class BVH_BinnedBuilder : public BVH_QueueBuilder<T, N>
41 //! Type for the array of bins of BVH tree node.
42 typedef BVH_Bin<T, N> BVH_BinVector[Bins];
46 //! Creates binned SAH BVH builder.
47 BVH_BinnedBuilder (const Standard_Integer theLeafNodeSize = 5,
48 const Standard_Integer theMaxTreeDepth = 32);
50 //! Releases resources of binned SAH BVH builder.
51 virtual ~BVH_BinnedBuilder();
55 //! Builds BVH node for specified task info.
56 virtual void BuildNode (BVH_Set<T, N>* theSet,
57 BVH_Tree<T, N>* theBVH,
58 const Standard_Integer theNode);
60 //! Arranges node primitives into bins.
61 virtual void GetSubVolumes (BVH_Set<T, N>* theSet,
62 BVH_Tree<T, N>* theBVH,
63 const Standard_Integer theNode,
64 BVH_BinVector& theBins,
65 const Standard_Integer theAxis);
69 #include <BVH_BinnedBuilder.lxx>
71 #endif // _BVH_BinnedBuilder_Header