0026292: Visualization - Parallelize queue-based BVH builders (subclasses of BVH_Queu...
[occt.git] / src / BVH / BVH_PrimitiveSet.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_PrimitiveSet_Header
17#define _BVH_PrimitiveSet_Header
18
19#include <BVH_Object.hxx>
20#include <BVH_Builder.hxx>
21
679d3878 22//! Set of abstract geometric primitives organized with bounding
23//! volume hierarchy (BVH). Unlike an object set, this collection
24//! is designed for storing structural elements of a single object
25//! (such as triangles in the object triangulation). Because there
26//! may be a large number of such elements, the implementations of
27//! this interface should be sufficiently optimized.
28//! \tparam T Numeric data type
29//! \tparam N Vector dimension
3c4e78f2 30template<class T, int N>
31class BVH_PrimitiveSet : public BVH_Object<T, N>, public BVH_Set<T, N>
32{
b7cd4ba7 33protected:
34
3c4e78f2 35 using BVH_Set<T, N>::Box;
36
37public:
38
39 //! Creates set of abstract primitives.
40 BVH_PrimitiveSet();
41
42 //! Releases resources of set of abstract primitives.
43 virtual ~BVH_PrimitiveSet();
44
45public:
46
47 //! Returns AABB of primitive set.
48 virtual BVH_Box<T, N> Box() const;
49
679d3878 50 //! Returns BVH tree (and builds it if necessary).
3c4e78f2 51 virtual const NCollection_Handle<BVH_Tree<T, N> >& BVH();
52
679d3878 53 //! Returns the method (builder) used to construct BVH.
3c4e78f2 54 virtual const NCollection_Handle<BVH_Builder<T, N> >& Builder() const;
55
679d3878 56 //! Sets the method (builder) used to construct BVH.
3c4e78f2 57 virtual void SetBuilder (NCollection_Handle<BVH_Builder<T, N> >& theBuilder);
58
59protected:
60
61 //! Updates BVH of primitive set.
62 virtual void Update();
63
64protected:
65
66 NCollection_Handle<BVH_Tree<T, N> > myBVH; //!< Constructed bottom-level BVH
67 NCollection_Handle<BVH_Builder<T, N> > myBuilder; //!< Builder for bottom-level BVH
68
69 mutable BVH_Box<T, N> myBox; //!< Cached bounding box of geometric primitives
70
71};
72
73#include <BVH_PrimitiveSet.lxx>
74
75#endif // _BVH_PrimitiveSet_Header