0027750: Visualization, V3d_View - remove unused functionality ZClipping and ZCueing
[occt.git] / src / OpenGl / OpenGl_Clipping.hxx
index ab747e2..6588ffa 100755 (executable)
@@ -23,7 +23,9 @@
 #include <NCollection_Handle.hxx>
 #include <Standard_TypeDef.hxx>
 #include <OpenGl_Matrix.hxx>
-#include <Handle_OpenGl_Workspace.hxx>
+
+class OpenGl_Context;
+class OpenGl_Workspace;
 
 //! This class contains logics related to tracking and modification of clipping plane
 //! state for particular OpenGl context. It contains information about enabled
 //! class.
 class OpenGl_Clipping
 {
-public:
-
-  //! Enumerates supported equation coordinate spaces.
-  enum EquationCoords
-  {
-    EquationCoords_View,
-    EquationCoords_World
-  };
-
 public: //! @name general methods
 
   //! Default constructor.
@@ -67,12 +60,6 @@ public: //! @name non-modifying getters
     return myPlanes;
   }
 
-  //! @return kind of equation coordinate space used for the clip plane.
-  inline EquationCoords GetEquationSpace (const Handle(Graphic3d_ClipPlane)& thePlane) const
-  {
-    return myPlaneStates.Find (thePlane).CoordSpace;
-  }
-
   //! Check whether the clipping plane has been set and enabled for the current context state.
   //! @param thePlane [in] the plane to check.
   //! @return True if plane is enabled.
@@ -106,14 +93,16 @@ public: //! @name clipping state modification commands
   //! to transform equation coordinates. The planes become enabled in the context.
   //! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
   //! are simply ignored.
-  //! @param thePlanes [in/out] the list of planes to be added.
+  //!
+  //! Within FFP, method also temporarily resets ModelView matrix before calling glClipPlane().
+  //! Otherwise the method just redirects to addLazy().
+  //!
+  //! @param theGlCtx [in] context to access the matrices
+  //! @param thePlanes [in/out] the list of planes to be added
   //! The list then provides information on which planes were really added to clipping state.
   //! This list then can be used to fall back to previous state.
-  //! @param theCoordSpace [in] the equation definition space.
-  //! @param theWS [in] the workspace to access the matrices.
-  Standard_EXPORT void Add (Graphic3d_SequenceOfHClipPlane& thePlanes,
-                            const EquationCoords& theCoordSpace,
-                            const Handle(OpenGl_Workspace)& theWS);
+  Standard_EXPORT void add (const Handle(OpenGl_Context)&   theGlCtx,
+                            Graphic3d_SequenceOfHClipPlane& thePlanes);
 
   //! Add planes to the context clipping at the specified system of coordinates.
   //! This method assumes that appropriate matrix is already set in context state.
@@ -122,72 +111,40 @@ public: //! @name clipping state modification commands
   //! @param thePlanes [in/out] the list of planes to be added.
   //! The list then provides information on which planes were really added to clipping state.
   //! This list then can be used to fall back to previous state.
-  //! @param theCoordSpace [in] the equation definition space.
-  Standard_EXPORT void Add (Graphic3d_SequenceOfHClipPlane& thePlanes,
-                            const EquationCoords& theCoordSpace);
+  Standard_EXPORT void addLazy (const Handle(OpenGl_Context)&   theGlCtx,
+                                Graphic3d_SequenceOfHClipPlane& thePlanes);
 
   //! Remove the passed set of clipping planes from the context state.
   //! @param thePlanes [in] the planes to remove from list.
-  Standard_EXPORT void Remove (const Graphic3d_SequenceOfHClipPlane& thePlanes);
+  Standard_EXPORT void Remove (const Handle(OpenGl_Context)&         theGlCtx,
+                               const Graphic3d_SequenceOfHClipPlane& thePlanes);
 
   //! Enable or disable clipping plane in the OpenGl context.
   //! @param thePlane [in] the plane to affect.
   //! @param theIsEnabled [in] the state of the plane.
-  Standard_EXPORT void SetEnabled (const Handle(Graphic3d_ClipPlane)& thePlane,
-                                   const Standard_Boolean theIsEnabled);
+  Standard_EXPORT void SetEnabled (const Handle(OpenGl_Context)&      theGlCtx,
+                                   const Handle(Graphic3d_ClipPlane)& thePlane,
+                                   const Standard_Boolean             theIsEnabled);
 
 public: //! @name Short-cuts
 
-  //! Add planes to the context clipping at the view system of coordinates.
-  //! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
-  //! are simply ignored.
-  //! @param thePlanes [in/out] the list of planes to be added.
-  //! The list then provides information on which planes were really added to clipping state.
-  //! This list then can be used to fall back to previous state.
-  //! @param theWS [in] the workspace to access the matrices.
-  inline void AddView (Graphic3d_SequenceOfHClipPlane& thePlanes, const Handle(OpenGl_Workspace)& theWS)
-  {
-    Add (thePlanes, EquationCoords_View, theWS);
-  }
-
-  //! Add planes to the context clipping at the view system of coordinates.
-  //! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
-  //! are simply ignored.
-  //! @param thePlanes [in/out] the list of planes to be added.
-  //! The list then provides information on which planes were really added to clipping state.
-  //! This list then can be used to fall back to previous state.
-  inline void AddView (Graphic3d_SequenceOfHClipPlane& thePlanes)
-  {
-    Add (thePlanes, EquationCoords_View);
-  }
-
   //! Add planes to the context clipping at the world system of coordinates.
   //! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
   //! are simply ignored.
-  //! @param thePlanes [in/out] the list of planes to be added.
-  //! The list then provides information on which planes were really added to clipping state.
-  //! This list then can be used to fall back to previous state.
-  //! @param theWS [in] the workspace to access the matrices.
-  inline void AddWorld (Graphic3d_SequenceOfHClipPlane& thePlanes, const Handle(OpenGl_Workspace)& theWS)
-  {
-    Add (thePlanes, EquationCoords_World, theWS);
-  }
-
-  //! Add planes to the context clipping at the world system of coordinates.
-  //! If the number of the passed planes exceeds capabilities of OpenGl, the last planes
-  //! are simply ignored.
-  //! @param thePlanes [in/out] the list of planes to be added.
+  //! @param theGlCtx [in] context to access the matrices
+  //! @param thePlanes [in/out] the list of planes to be added
   //! The list then provides information on which planes were really added to clipping state.
   //! This list then can be used to fall back to previous state.
-  inline void AddWorld (Graphic3d_SequenceOfHClipPlane& thePlanes)
+  inline void AddWorld (const Handle(OpenGl_Context)&   theGlCtx,
+                        Graphic3d_SequenceOfHClipPlane& thePlanes)
   {
-    Add (thePlanes, EquationCoords_World);
+    add (theGlCtx, thePlanes);
   }
 
   //! Remove all of the planes from context state.
-  inline void RemoveAll()
+  inline void RemoveAll (const Handle(OpenGl_Context)& theGlCtx)
   {
-    Remove (Planes());
+    Remove (theGlCtx, Planes());
   }
 
 private:
@@ -197,16 +154,13 @@ private:
     // declare default constructor
     // to allow compilation of template collections
     PlaneProps() {}
-    PlaneProps (const EquationCoords theCoords,
-                const Standard_Integer theID,
+    PlaneProps (const Standard_Integer theID,
                 const Standard_Boolean theIsEnabled)
     {
-      CoordSpace = theCoords;
       ContextID  = theID;
       IsEnabled  = theIsEnabled;
     }
 
-    EquationCoords   CoordSpace;
     Standard_Integer ContextID;
     Standard_Boolean IsEnabled;
   };