0027810: Compilation error on NCollection_UBTree::Kill()
[occt.git] / src / Graphic3d / Graphic3d_GraphicDriver.hxx
CommitLineData
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>
42cf5bc1 24#include <Standard_Boolean.hxx>
25#include <MMgt_TShared.hxx>
26#include <Graphic3d_CView.hxx>
27#include <Graphic3d_CStructure.hxx>
28#include <Aspect_GradientFillMethod.hxx>
29#include <Standard_CString.hxx>
30#include <Aspect_FillMethod.hxx>
42cf5bc1 31#include <Standard_Size.hxx>
32#include <Quantity_NameOfColor.hxx>
33#include <Standard_Real.hxx>
34#include <Aspect_TypeOfTriedronPosition.hxx>
35#include <Aspect_TypeOfTriedronEcho.hxx>
36#include <Graphic3d_GraduatedTrihedron.hxx>
37#include <Graphic3d_Vec3.hxx>
38#include <Standard_ShortReal.hxx>
39#include <Standard_Address.hxx>
42cf5bc1 40#include <Image_PixMap.hxx>
41#include <Graphic3d_BufferType.hxx>
016e5959 42#include <Aspect_GenId.hxx>
42cf5bc1 43#include <Aspect_Handle.hxx>
42cf5bc1 44#include <Graphic3d_ExportFormat.hxx>
45#include <Graphic3d_SortType.hxx>
46#include <Graphic3d_ZLayerId.hxx>
47#include <Graphic3d_ZLayerSettings.hxx>
48#include <Graphic3d_CLight.hxx>
49#include <TColStd_Array2OfReal.hxx>
c357e426 50#include <TColStd_SequenceOfInteger.hxx>
51
5950d781 52class Aspect_DisplayConnection;
c357e426 53class Graphic3d_CView;
54class Graphic3d_GraphicDriver;
42cf5bc1 55class Graphic3d_TransformError;
56class Graphic3d_Structure;
57class Graphic3d_StructureManager;
c357e426 58class Graphic3d_ViewManager;
42cf5bc1 59class Quantity_Color;
60class TCollection_AsciiString;
61
42cf5bc1 62DEFINE_STANDARD_HANDLE(Graphic3d_GraphicDriver, MMgt_TShared)
63
64//! This class allows the definition of a graphic driver
65//! for 3d interface (currently only OpenGl driver is used).
66class Graphic3d_GraphicDriver : public MMgt_TShared
67{
68
69public:
70
71
72 //! call_togl_inquirelight
c357e426 73 virtual Standard_Integer InquireLightLimit() = 0;
42cf5bc1 74
75 //! call_togl_inquireplane
c357e426 76 virtual Standard_Integer InquirePlaneLimit() = 0;
42cf5bc1 77
78 //! call_togl_inquireview
c357e426 79 virtual Standard_Integer InquireViewLimit() = 0;
42cf5bc1 80
81 //! Creates new empty graphic structure
c357e426 82 virtual Handle(Graphic3d_CStructure) CreateStructure (const Handle(Graphic3d_StructureManager)& theManager) = 0;
42cf5bc1 83
c357e426 84 //! Removes structure from graphic driver and releases its resources.
85 virtual void RemoveStructure (Handle(Graphic3d_CStructure)& theCStructure) = 0;
42cf5bc1 86
c357e426 87 //! Creates new view for this graphic driver.
88 virtual Handle(Graphic3d_CView) CreateView (const Handle(Graphic3d_StructureManager)& theMgr) = 0;
42cf5bc1 89
c357e426 90 //! Removes view from graphic driver and releases its resources.
91 virtual void RemoveView (const Handle(Graphic3d_CView)& theView) = 0;
62e1beed 92
42cf5bc1 93 //! enables/disables usage of OpenGL vertex buffer arrays while drawing primitiev arrays
c357e426 94 virtual void EnableVBO (const Standard_Boolean status) = 0;
42cf5bc1 95
96 //! Returns information about GPU memory usage.
c357e426 97 virtual Standard_Boolean MemoryInfo (Standard_Size& theFreeBytes, TCollection_AsciiString& theInfo) const = 0;
42cf5bc1 98
c357e426 99 virtual Standard_ShortReal DefaultTextHeight() const = 0;
42cf5bc1 100
4b1c8733 101 //! Computes text width.
102 virtual void TextSize (const Handle(Graphic3d_CView)& theView,
103 const Standard_CString theText,
104 const Standard_ShortReal theHeight,
105 Standard_ShortReal& theWidth,
106 Standard_ShortReal& theAscent,
107 Standard_ShortReal& theDescent) const = 0;
42cf5bc1 108
42cf5bc1 109 //! Add a new top-level z layer with ID <theLayerId> for
110 //! the view. Z layers allow drawing structures in higher layers
111 //! in foreground of structures in lower layers. To add a structure
112 //! to desired layer on display it is necessary to set the layer
113 //! ID for the structure.
c357e426 114 virtual void AddZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
42cf5bc1 115
c357e426 116 //! Removes Z layer. All structures displayed at the moment in layer will be displayed in
117 //! default layer (the bottom-level z layer). By default, there are always default
118 //! bottom-level layer that can't be removed. The passed theLayerId should be not less than 0
119 //! (reserved for default layers that can not be removed).
120 virtual void RemoveZLayer (const Graphic3d_ZLayerId theLayerId) = 0;
121
122 //! Returns list of Z layers defined for the graphical driver.
123 virtual void ZLayers (TColStd_SequenceOfInteger& theLayerSeq) const = 0;
124
125 //! Sets the settings for a single Z layer.
126 virtual void SetZLayerSettings (const Graphic3d_ZLayerId theLayerId, const Graphic3d_ZLayerSettings& theSettings) = 0;
127
128 //! Returns the settings of a single Z layer.
129 virtual Graphic3d_ZLayerSettings ZLayerSettings (const Graphic3d_ZLayerId theLayerId) = 0;
130
131 //! Returns view associated with the window if it is exists and is activated.
132 //! Returns Standard_True if the view associated to the window exists.
133 virtual Standard_Boolean ViewExists (const Handle(Aspect_Window)& theWindow, Handle(Graphic3d_CView)& theView) = 0;
42cf5bc1 134
42cf5bc1 135 //! returns Handle to display connection
136 Standard_EXPORT const Handle(Aspect_DisplayConnection)& GetDisplayConnection() const;
137
138 Standard_EXPORT Standard_Boolean IsDeviceLost() const;
139
140 Standard_EXPORT void ResetDeviceLostFlag();
141
016e5959 142 //! Returns a new identification number for a new structure.
143 Standard_EXPORT Standard_Integer NewIdentification();
144
145 //! Frees the identifier of a structure.
146 Standard_EXPORT void RemoveIdentification(const Standard_Integer theId);
147
92efcf78 148 DEFINE_STANDARD_RTTIEXT(Graphic3d_GraphicDriver,MMgt_TShared)
42cf5bc1 149
150protected:
151
152
c357e426 153 //! Initializes the Driver
42cf5bc1 154 Standard_EXPORT Graphic3d_GraphicDriver(const Handle(Aspect_DisplayConnection)& theDisp);
155
42cf5bc1 156 Handle(Aspect_DisplayConnection) myDisplayConnection;
157 Standard_Boolean myDeviceLostFlag;
158
016e5959 159 Aspect_GenId myStructGenId;
160
42cf5bc1 161
162private:
163
164
165
166
167};
168
169
170
171
172
173
174
175#endif // _Graphic3d_GraphicDriver_HeaderFile