1 // Copyright (c) 2013 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and / or modify it
6 // under the terms of the GNU Lesser General Public version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef OpenGl_Flipper_Header
15 #define OpenGl_Flipper_Header
17 #include <OpenGl_Element.hxx>
18 #include <OpenGl_Vec.hxx>
19 #include <Handle_OpenGl_Workspace.hxx>
23 //! Being rendered, the elements modifies current model-view matrix such that the axes of
24 //! the specified reference system (in model space) become oriented in the following way:
25 //! - X - heads to the right side of view.
26 //! - Y - heads to the up side of view.
27 //! - N(Z) - heads towards the screen.
28 //! Originally, this element serves for need of flipping the 3D text of dimension presentations.
29 class OpenGl_Flipper : public OpenGl_Element
33 //! Construct rendering element to flip model-view matrix
34 //! along the reference system to ensure up-Y, right-X orientation.
35 //! @param theReferenceSystem [in] the reference coordinate system.
36 Standard_EXPORT OpenGl_Flipper (const gp_Ax2& theReferenceSystem);
38 //! Set options for the element.
39 //! @param theIsEnabled [in] flag indicates whether the flipper
40 //! matrix modification should be set up or restored back.
41 void SetOptions (const Standard_Boolean theIsEnabled) { myIsEnabled = theIsEnabled; }
43 Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const;
44 Standard_EXPORT virtual void Release (const Handle(OpenGl_Context)& theCtx);
52 OpenGl_Vec4 myReferenceOrigin;
53 OpenGl_Vec4 myReferenceX;
54 OpenGl_Vec4 myReferenceY;
55 OpenGl_Vec4 myReferenceZ;
56 Standard_Boolean myIsEnabled;
60 #endif // OpenGl_Flipper_Header