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> |
938d4544 |
19 | |
20 | class gp_Ax2; |
21 | |
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 |
29 | { |
30 | public: |
31 | |
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); |
36 | |
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; } |
41 | |
42 | Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const; |
10b9c7df |
43 | Standard_EXPORT virtual void Release (OpenGl_Context* theCtx); |
938d4544 |
44 | |
45 | public: |
46 | |
47 | DEFINE_STANDARD_ALLOC |
48 | |
49 | protected: |
50 | |
51 | OpenGl_Vec4 myReferenceOrigin; |
52 | OpenGl_Vec4 myReferenceX; |
53 | OpenGl_Vec4 myReferenceY; |
54 | OpenGl_Vec4 myReferenceZ; |
55 | Standard_Boolean myIsEnabled; |
56 | |
57 | }; |
58 | |
59 | #endif // OpenGl_Flipper_Header |