#ifndef _OpenGl_Layer_Header
#define _OpenGl_Layer_Header
-#include <NCollection_Sequence.hxx>
-#include <NCollection_Array1.hxx>
+#include <Graphic3d_Layer.hxx>
-#include <InterfaceGraphic_telem.hxx>
-
-#include <OpenGl_BVHClipPrimitiveSet.hxx>
-#include <OpenGl_BVHClipPrimitiveTrsfPersSet.hxx>
-#include <OpenGl_BVHTreeSelector.hxx>
-
-#include <Graphic3d_ZLayerSettings.hxx>
-#include <Graphic3d_Camera.hxx>
-#include <OpenGl_GlCore11.hxx>
-
-
-struct OpenGl_GlobalLayerSettings
-{
- GLint DepthFunc;
- GLboolean DepthMask;
-};
-
-//! Defines index map of OpenGL structures.
-typedef NCollection_IndexedMap<const OpenGl_Structure*> OpenGl_IndexedMapOfStructure;
-
-//! Defines array of indexed maps of OpenGL structures.
-typedef NCollection_Array1<OpenGl_IndexedMapOfStructure> OpenGl_ArrayOfIndexedMapOfStructure;
-
-//! Presentations list sorted within priorities.
-class OpenGl_Layer
-{
-public:
-
- //! Initializes associated priority list and layer properties
- OpenGl_Layer (const Standard_Integer theNbPriorities = 11);
-
- //! Destructor.
- virtual ~OpenGl_Layer();
-
- //! Returns settings of the layer object.
- const Graphic3d_ZLayerSettings& LayerSettings() const { return myLayerSettings; };
-
- //! Sets settings of the layer object.
- void SetLayerSettings (const Graphic3d_ZLayerSettings& theSettings)
- {
- myLayerSettings = theSettings;
- }
-
- //! Returns true if theSetting is enabled for the layer.
- Standard_Boolean IsSettingEnabled (const Graphic3d_ZLayerSetting theSetting) const
- {
- return myLayerSettings.IsSettingEnabled (theSetting);
- }
-
- void Add (const OpenGl_Structure* theStruct,
- const Standard_Integer thePriority,
- Standard_Boolean isForChangePriority = Standard_False);
-
- //! Remove structure and returns its priority, if the structure is not found, method returns negative value
- bool Remove (const OpenGl_Structure* theStruct,
- Standard_Integer& thePriority,
- Standard_Boolean isForChangePriority = Standard_False);
-
- //! @return the number of structures
- Standard_Integer NbStructures() const { return myNbStructures; }
-
- //! Returns the number of available priority levels
- Standard_Integer NbPriorities() const { return myArray.Length(); }
-
- //! Append layer of acceptable type (with similar number of priorities or less).
- //! Returns Standard_False if the list can not be accepted.
- Standard_Boolean Append (const OpenGl_Layer& theOther);
-
- //! Returns array of OpenGL structures.
- const OpenGl_ArrayOfIndexedMapOfStructure& ArrayOfStructures() const { return myArray; }
-
- //! Marks BVH tree for given priority list as dirty and
- //! marks primitive set for rebuild.
- void InvalidateBVHData();
-
- // Render all structures.
- void Render (const Handle(OpenGl_Workspace)& theWorkspace,
- const OpenGl_GlobalLayerSettings& theDefaultSettings) const;
-
-protected:
-
- //! Traverses through BVH tree to determine which structures are in view volume.
- void traverse (OpenGl_BVHTreeSelector& theSelector) const;
-
- //! Iterates through the hierarchical list of existing structures and renders them all.
- void renderAll (const Handle(OpenGl_Workspace)& theWorkspace) const;
-
- //! Iterates through the hierarchical list of existing structures and renders only overlapping ones.
- void renderTraverse (const Handle(OpenGl_Workspace)& theWorkspace) const;
-
-private:
-
- //! Array of OpenGl_Structures by priority rendered in layer.
- OpenGl_ArrayOfIndexedMapOfStructure myArray;
-
- //! Overall number of structures rendered in the layer.
- Standard_Integer myNbStructures;
-
- //! Layer setting flags.
- Graphic3d_ZLayerSettings myLayerSettings;
-
- //! Set of OpenGl_Structures structures for building BVH tree.
- mutable OpenGl_BVHClipPrimitiveSet myBVHPrimitives;
-
- //! Set of transform persistent OpenGl_Structures for building BVH tree.
- mutable OpenGl_BVHClipPrimitiveTrsfPersSet myBVHPrimitivesTrsfPers;
-
- //! Is needed for implementation of stochastic order of BVH traverse.
- mutable Standard_Boolean myBVHIsLeftChildQueuedFirst;
-
- //! Defines if the primitive set for BVH is outdated.
- mutable Standard_Boolean myIsBVHPrimitivesNeedsReset;
-
-public:
-
- DEFINE_STANDARD_ALLOC
-
-};
+typedef Graphic3d_Layer OpenGl_Layer;
#endif //_OpenGl_Layer_Header