b7cd4ba7 |
1 | // Created on: 2013-12-25 |
2 | // Created by: Varvara POSKONINA |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _OpenGl_BVHClipPrimitiveSet_HeaderFile |
17 | #define _OpenGl_BVHClipPrimitiveSet_HeaderFile |
18 | |
f5b72419 |
19 | #include <BVH_PrimitiveSet3d.hxx> |
b7cd4ba7 |
20 | #include <NCollection_Array1.hxx> |
385c43e7 |
21 | #include <NCollection_IndexedMap.hxx> |
b7cd4ba7 |
22 | |
b7cd4ba7 |
23 | #include <OpenGl_Structure.hxx> |
24 | |
b7cd4ba7 |
25 | //! Set of OpenGl_Structures for building BVH tree. |
f5b72419 |
26 | class OpenGl_BVHClipPrimitiveSet : public BVH_PrimitiveSet3d |
b7cd4ba7 |
27 | { |
f5b72419 |
28 | DEFINE_STANDARD_RTTIEXT(OpenGl_BVHClipPrimitiveSet, BVH_PrimitiveSet3d) |
b7cd4ba7 |
29 | protected: |
30 | |
f5b72419 |
31 | using BVH_PrimitiveSet3d::Box; |
b7cd4ba7 |
32 | |
33 | public: |
34 | |
35 | //! Creates an empty primitive set for BVH clipping. |
36 | OpenGl_BVHClipPrimitiveSet(); |
37 | |
38 | //! Returns total number of structures. |
e28f12b3 |
39 | virtual Standard_Integer Size() const Standard_OVERRIDE; |
b7cd4ba7 |
40 | |
385c43e7 |
41 | //! Returns AABB of the structure. |
e28f12b3 |
42 | virtual Graphic3d_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE; |
b7cd4ba7 |
43 | |
385c43e7 |
44 | //! Calculates center of the AABB along given axis. |
7c3ef2f7 |
45 | virtual Standard_Real Center (const Standard_Integer theIdx, |
e28f12b3 |
46 | const Standard_Integer theAxis) const Standard_OVERRIDE; |
b7cd4ba7 |
47 | |
385c43e7 |
48 | //! Swaps structures with the given indices. |
b7cd4ba7 |
49 | virtual void Swap (const Standard_Integer theIdx1, |
e28f12b3 |
50 | const Standard_Integer theIdx2) Standard_OVERRIDE; |
b7cd4ba7 |
51 | |
385c43e7 |
52 | //! Adds structure to the set. |
825aa485 |
53 | //! @return true if structure added, otherwise returns false (structure already in the set). |
54 | Standard_Boolean Add (const OpenGl_Structure* theStruct); |
b7cd4ba7 |
55 | |
385c43e7 |
56 | //! Removes the given structure from the set. |
825aa485 |
57 | //! @return true if structure removed, otherwise returns false (structure is not in the set). |
58 | Standard_Boolean Remove (const OpenGl_Structure* theStruct); |
b7cd4ba7 |
59 | |
60 | //! Cleans the whole primitive set. |
61 | void Clear(); |
62 | |
385c43e7 |
63 | //! Returns the structure corresponding to the given ID. |
b7cd4ba7 |
64 | const OpenGl_Structure* GetStructureById (Standard_Integer theId); |
65 | |
66 | private: |
67 | |
385c43e7 |
68 | NCollection_IndexedMap<const OpenGl_Structure*> myStructs; //!< Indexed map of structures. |
b7cd4ba7 |
69 | |
70 | }; |
71 | |
72 | #endif // _OpenGl_BVHClipPrimitiveSet_HeaderFile |