42cf5bc1 |
1 | // Created on: 1997-01-28 |
2 | // Created by: CAL |
3 | // Copyright (c) 1997-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _Graphic3d_GraphicDriver_HeaderFile |
18 | #define _Graphic3d_GraphicDriver_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Integer.hxx> |
24 | #include <Aspect_DisplayConnection.hxx> |
25 | #include <Standard_Boolean.hxx> |
26 | #include <MMgt_TShared.hxx> |
27 | #include <Graphic3d_CView.hxx> |
28 | #include <Graphic3d_CStructure.hxx> |
29 | #include <Aspect_GradientFillMethod.hxx> |
30 | #include <Standard_CString.hxx> |
31 | #include <Aspect_FillMethod.hxx> |
42cf5bc1 |
32 | #include <Standard_Size.hxx> |
33 | #include <Quantity_NameOfColor.hxx> |
34 | #include <Standard_Real.hxx> |
35 | #include <Aspect_TypeOfTriedronPosition.hxx> |
36 | #include <Aspect_TypeOfTriedronEcho.hxx> |
37 | #include <Graphic3d_GraduatedTrihedron.hxx> |
38 | #include <Graphic3d_Vec3.hxx> |
39 | #include <Standard_ShortReal.hxx> |
40 | #include <Standard_Address.hxx> |
41 | #include <Graphic3d_PtrFrameBuffer.hxx> |
42 | #include <Image_PixMap.hxx> |
43 | #include <Graphic3d_BufferType.hxx> |
44 | #include <Aspect_Handle.hxx> |
45 | #include <Aspect_PrintAlgo.hxx> |
46 | #include <Graphic3d_ExportFormat.hxx> |
47 | #include <Graphic3d_SortType.hxx> |
48 | #include <Graphic3d_ZLayerId.hxx> |
49 | #include <Graphic3d_ZLayerSettings.hxx> |
50 | #include <Graphic3d_CLight.hxx> |
51 | #include <TColStd_Array2OfReal.hxx> |
c357e426 |
52 | #include <TColStd_SequenceOfInteger.hxx> |
53 | |
54 | class Graphic3d_CView; |
55 | class Graphic3d_GraphicDriver; |
42cf5bc1 |
56 | class Graphic3d_TransformError; |
57 | class Graphic3d_Structure; |
58 | class Graphic3d_StructureManager; |
c357e426 |
59 | class Graphic3d_ViewManager; |
42cf5bc1 |
60 | class Quantity_Color; |
61 | class TCollection_AsciiString; |
62 | |
42cf5bc1 |
63 | DEFINE_STANDARD_HANDLE(Graphic3d_GraphicDriver, MMgt_TShared) |
64 | |
65 | //! This class allows the definition of a graphic driver |
66 | //! for 3d interface (currently only OpenGl driver is used). |
67 | class Graphic3d_GraphicDriver : public MMgt_TShared |
68 | { |
69 | |
70 | public: |
71 | |
72 | |
73 | //! call_togl_inquirelight |
c357e426 |
74 | virtual Standard_Integer InquireLightLimit() = 0; |
42cf5bc1 |
75 | |
76 | //! call_togl_inquireplane |
c357e426 |
77 | virtual Standard_Integer InquirePlaneLimit() = 0; |
42cf5bc1 |
78 | |
79 | //! call_togl_inquireview |
c357e426 |
80 | virtual Standard_Integer InquireViewLimit() = 0; |
42cf5bc1 |
81 | |
82 | //! Creates new empty graphic structure |
c357e426 |
83 | virtual Handle(Graphic3d_CStructure) CreateStructure (const Handle(Graphic3d_StructureManager)& theManager) = 0; |
42cf5bc1 |
84 | |
c357e426 |
85 | //! Removes structure from graphic driver and releases its resources. |
86 | virtual void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure) = 0; |
42cf5bc1 |
87 | |
c357e426 |
88 | //! Creates new view for this graphic driver. |
89 | virtual Handle(Graphic3d_CView) CreateView (const Handle(Graphic3d_StructureManager)& theMgr) = 0; |
42cf5bc1 |
90 | |
c357e426 |
91 | //! Removes view from graphic driver and releases its resources. |
92 | virtual void RemoveView (const Handle(Graphic3d_CView)& theView) = 0; |
62e1beed |
93 | |
42cf5bc1 |
94 | //! enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays |
c357e426 |
95 | virtual void EnableVBO (const Standard_Boolean status) = 0; |
42cf5bc1 |
96 | |
97 | //! Returns information about GPU memory usage. |
c357e426 |
98 | virtual Standard_Boolean MemoryInfo (Standard_Size& theFreeBytes, TCollection_AsciiString& theInfo) const = 0; |
42cf5bc1 |
99 | |
c357e426 |
100 | virtual Standard_ShortReal DefaultTextHeight() const = 0; |
42cf5bc1 |
101 | |
102 | //! call_togl_textsize2d |
c357e426 |
103 | virtual void TextSize (const Standard_CString AText, const Standard_ShortReal AHeight, Standard_ShortReal& AWidth, Standard_ShortReal& AnAscent, Standard_ShortReal& ADescent) const = 0; |
42cf5bc1 |
104 | |
42cf5bc1 |
105 | //! Add a new top-level z layer with ID <theLayerId> for |
106 | //! the view. Z layers allow drawing structures in higher layers |
107 | //! in foreground of structures in lower layers. To add a structure |
108 | //! to desired layer on display it is necessary to set the layer |
109 | //! ID for the structure. |
c357e426 |
110 | virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0; |
42cf5bc1 |
111 | |
c357e426 |
112 | //! Removes Z layer. All structures displayed at the moment in layer will be displayed in |
113 | //! default layer (the bottom-level z layer). By default, there are always default |
114 | //! bottom-level layer that can't be removed. The passed theLayerId should be not less than 0 |
115 | //! (reserved for default layers that can not be removed). |
116 | virtual void RemoveZLayer (const Graphic3d_ZLayerId theLayerId) = 0; |
117 | |
118 | //! Returns list of Z layers defined for the graphical driver. |
119 | virtual void ZLayers (TColStd_SequenceOfInteger& theLayerSeq) const = 0; |
120 | |
121 | //! Sets the settings for a single Z layer. |
122 | virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings) = 0; |
123 | |
124 | //! Returns the settings of a single Z layer. |
125 | virtual Graphic3d_ZLayerSettings ZLayerSettings (const Graphic3d_ZLayerId theLayerId) = 0; |
126 | |
127 | //! Returns view associated with the window if it is exists and is activated. |
128 | //! Returns Standard_True if the view associated to the window exists. |
129 | virtual Standard_Boolean ViewExists (const Handle(Aspect_Window)& theWindow, Handle(Graphic3d_CView)& theView) = 0; |
42cf5bc1 |
130 | |
42cf5bc1 |
131 | Standard_EXPORT void PrintBoolean (const Standard_CString AComment, const Standard_Boolean AValue) const; |
132 | |
133 | Standard_EXPORT void PrintCLight (const Graphic3d_CLight& ACLight, const Standard_Integer AField) const; |
134 | |
135 | Standard_EXPORT void PrintCStructure (const Graphic3d_CStructure& ACStructure, const Standard_Integer AField) const; |
136 | |
137 | Standard_EXPORT void PrintCView (const Graphic3d_CView& ACView, const Standard_Integer AField) const; |
138 | |
139 | Standard_EXPORT void PrintFunction (const Standard_CString AFunc) const; |
140 | |
141 | Standard_EXPORT void PrintInteger (const Standard_CString AComment, const Standard_Integer AValue) const; |
142 | |
143 | Standard_EXPORT void PrintIResult (const Standard_CString AFunc, const Standard_Integer AResult) const; |
144 | |
145 | Standard_EXPORT void PrintShortReal (const Standard_CString AComment, const Standard_ShortReal AValue) const; |
146 | |
147 | Standard_EXPORT void PrintMatrix (const Standard_CString AComment, const TColStd_Array2OfReal& AMatrix) const; |
148 | |
149 | Standard_EXPORT void PrintString (const Standard_CString AComment, const Standard_CString AString) const; |
150 | |
151 | Standard_EXPORT void SetTrace (const Standard_Integer ALevel); |
152 | |
153 | Standard_EXPORT Standard_Integer Trace() const; |
154 | |
155 | //! returns Handle to display connection |
156 | Standard_EXPORT const Handle(Aspect_DisplayConnection)& GetDisplayConnection() const; |
157 | |
158 | Standard_EXPORT Standard_Boolean IsDeviceLost() const; |
159 | |
160 | Standard_EXPORT void ResetDeviceLostFlag(); |
161 | |
42cf5bc1 |
162 | DEFINE_STANDARD_RTTI(Graphic3d_GraphicDriver,MMgt_TShared) |
163 | |
164 | protected: |
165 | |
166 | |
c357e426 |
167 | //! Initializes the Driver |
42cf5bc1 |
168 | Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp); |
169 | |
170 | Standard_Integer MyTraceLevel; |
171 | Handle(Aspect_DisplayConnection) myDisplayConnection; |
172 | Standard_Boolean myDeviceLostFlag; |
173 | |
174 | |
175 | private: |
176 | |
177 | |
178 | |
179 | |
180 | }; |
181 | |
182 | |
183 | |
184 | |
185 | |
186 | |
187 | |
188 | #endif // _Graphic3d_GraphicDriver_HeaderFile |