d5f74e42 |
1 | // Copyright (c) 2013-2014 OPEN CASCADE SAS |
938d4544 |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
938d4544 |
4 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
938d4544 |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
938d4544 |
13 | |
14 | #ifndef OpenGl_Flipper_Header |
15 | #define OpenGl_Flipper_Header |
16 | |
17 | #include <OpenGl_Element.hxx> |
18 | #include <OpenGl_Vec.hxx> |
19 | #include <Handle_OpenGl_Workspace.hxx> |
20 | |
21 | class gp_Ax2; |
22 | |
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 |
30 | { |
31 | public: |
32 | |
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); |
37 | |
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; } |
42 | |
43 | Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; |
10b9c7df |
44 | Standard_EXPORT virtual void Release (OpenGl_Context* theCtx); |
938d4544 |
45 | |
46 | public: |
47 | |
48 | DEFINE_STANDARD_ALLOC |
49 | |
50 | protected: |
51 | |
52 | OpenGl_Vec4 myReferenceOrigin; |
53 | OpenGl_Vec4 myReferenceX; |
54 | OpenGl_Vec4 myReferenceY; |
55 | OpenGl_Vec4 myReferenceZ; |
56 | Standard_Boolean myIsEnabled; |
57 | |
58 | }; |
59 | |
60 | #endif // OpenGl_Flipper_Header |