1 // Copyright (c) 2013-2014 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 under
6 // the terms of the GNU Lesser General Public License 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>
22 //! Being rendered, the elements modifies current model-view matrix such that the axes of
23 //! the specified reference system (in model space) become oriented in the following way:
24 //! - X - heads to the right side of view.
25 //! - Y - heads to the up side of view.
26 //! - N(Z) - heads towards the screen.
27 //! Originally, this element serves for need of flipping the 3D text of dimension presentations.
28 class OpenGl_Flipper : public OpenGl_Element
32 //! Construct rendering element to flip model-view matrix
33 //! along the reference system to ensure up-Y, right-X orientation.
34 //! @param theReferenceSystem [in] the reference coordinate system.
35 Standard_EXPORT OpenGl_Flipper (const gp_Ax2& theReferenceSystem);
37 //! Set options for the element.
38 //! @param theIsEnabled [in] flag indicates whether the flipper
39 //! matrix modification should be set up or restored back.
40 void SetOptions (const Standard_Boolean theIsEnabled) { myIsEnabled = theIsEnabled; }
42 Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const Standard_OVERRIDE;
43 Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
45 //! Dumps the content of me into the stream
46 Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
54 OpenGl_Vec4 myReferenceOrigin;
55 OpenGl_Vec4 myReferenceX;
56 OpenGl_Vec4 myReferenceY;
57 OpenGl_Vec4 myReferenceZ;
58 Standard_Boolean myIsEnabled;
62 #endif // OpenGl_Flipper_Header