0025411: BVH package - eliminate warning about hidden overloaded method ::Box
[occt.git] / src / BVH / BVH_BinnedBuilder.hxx
CommitLineData
3c4e78f2 1// Created on: 2013-12-20
2// Created by: Denis BOGOLEPOV
d5f74e42 3// Copyright (c) 2013-2014 OPEN CASCADE SAS
3c4e78f2 4//
5// This file is part of Open CASCADE Technology software library.
6//
d5f74e42 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
3c4e78f2 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.
12//
13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
15
16#ifndef _BVH_BinnedBuilder_Header
17#define _BVH_BinnedBuilder_Header
18
0ef61b50 19#include <BVH_QueueBuilder.hxx>
3c4e78f2 20
a096a7a5 21#include <algorithm>
22
3c4e78f2 23//! Stores parameters of single node bin (slice of AABB).
24template<class T, int N>
25struct BVH_Bin
26{
27 //! Creates new node bin.
28 BVH_Bin() : Count (0) {}
29
30 Standard_Integer Count; //!< Number of primitives in the bin
228de226 31 BVH_Box<T, N> Box; //!< AABB of primitives in the bin
3c4e78f2 32};
33
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.
36template<class T, int N, int Bins = 32>
0ef61b50 37class BVH_BinnedBuilder : public BVH_QueueBuilder<T, N>
3c4e78f2 38{
39public:
40
41 //! Type for the array of bins of BVH tree node.
42 typedef BVH_Bin<T, N> BVH_BinVector[Bins];
43
44public:
45
46 //! Creates binned SAH BVH builder.
47 BVH_BinnedBuilder (const Standard_Integer theLeafNodeSize = 5,
48 const Standard_Integer theMaxTreeDepth = 32);
49
50 //! Releases resources of binned SAH BVH builder.
51 virtual ~BVH_BinnedBuilder();
52
53protected:
54
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);
59
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);
66
67};
68
69#include <BVH_BinnedBuilder.lxx>
70
71#endif // _BVH_BinnedBuilder_Header