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