Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:47

0001 // Created on: 2013-12-25
0002 // Created by: Varvara POSKONINA
0003 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Graphic3d_BvhCStructureSet_HeaderFile
0017 #define _Graphic3d_BvhCStructureSet_HeaderFile
0018 
0019 #include <BVH_PrimitiveSet3d.hxx>
0020 #include <Graphic3d_BndBox3d.hxx>
0021 #include <NCollection_IndexedMap.hxx>
0022 
0023 class Graphic3d_CStructure;
0024 
0025 //! Set of OpenGl_Structures for building BVH tree.
0026 class Graphic3d_BvhCStructureSet : public BVH_PrimitiveSet3d
0027 {
0028   DEFINE_STANDARD_RTTIEXT(Graphic3d_BvhCStructureSet, BVH_PrimitiveSet3d)
0029 protected:
0030 
0031   using BVH_PrimitiveSet3d::Box;
0032 
0033 public:
0034 
0035   //! Creates an empty primitive set for BVH clipping.
0036   Standard_EXPORT Graphic3d_BvhCStructureSet();
0037 
0038   //! Returns total number of structures.
0039   Standard_EXPORT virtual Standard_Integer Size() const Standard_OVERRIDE;
0040 
0041   //! Returns AABB of the structure.
0042   Standard_EXPORT virtual Graphic3d_BndBox3d Box (const Standard_Integer theIdx) const Standard_OVERRIDE;
0043 
0044   //! Calculates center of the AABB along given axis.
0045   Standard_EXPORT virtual Standard_Real Center (const Standard_Integer theIdx,
0046                                                 const Standard_Integer theAxis) const Standard_OVERRIDE;
0047 
0048   //! Swaps structures with the given indices.
0049   Standard_EXPORT virtual void Swap (const Standard_Integer theIdx1,
0050                                      const Standard_Integer theIdx2) Standard_OVERRIDE;
0051 
0052   //! Adds structure to the set.
0053   //! @return true if structure added, otherwise returns false (structure already in the set).
0054   Standard_EXPORT Standard_Boolean Add (const Graphic3d_CStructure* theStruct);
0055 
0056   //! Removes the given structure from the set.
0057   //! @return true if structure removed, otherwise returns false (structure is not in the set).
0058   Standard_EXPORT Standard_Boolean Remove (const Graphic3d_CStructure* theStruct);
0059 
0060   //! Cleans the whole primitive set.
0061   Standard_EXPORT void Clear();
0062 
0063   //! Returns the structure corresponding to the given ID.
0064   Standard_EXPORT const Graphic3d_CStructure* GetStructureById (Standard_Integer theId);
0065 
0066   //! Access directly a collection of structures.
0067   const NCollection_IndexedMap<const Graphic3d_CStructure*>& Structures() const { return myStructs; }
0068 
0069 private:
0070 
0071   NCollection_IndexedMap<const Graphic3d_CStructure*> myStructs;    //!< Indexed map of structures.
0072 
0073 };
0074 
0075 #endif // _Graphic3d_BvhCStructureSet_HeaderFile