0030144: Visualization, TKOpenGl - extend OpenGl_FrameStats with frame timers
[occt.git] / src / OpenGl / OpenGl_FrameStatsPrs.hxx
1 // Copyright (c) 2017 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #ifndef _OpenGl_FrameStatsPrs_HeaderFile
15 #define _OpenGl_FrameStatsPrs_HeaderFile
16
17 #include <OpenGl_FrameStats.hxx>
18 #include <OpenGl_Text.hxx>
19
20 class Graphic3d_ArrayOfTriangles;
21 class Graphic3d_TransformPers;
22 class OpenGl_IndexBuffer;
23 class OpenGl_VertexBuffer;
24
25 //! Element rendering frame statistics.
26 class OpenGl_FrameStatsPrs : public OpenGl_Element
27 {
28 public:
29
30   //! Default constructor.
31   Standard_EXPORT OpenGl_FrameStatsPrs();
32
33   //! Destructor
34   Standard_EXPORT virtual ~OpenGl_FrameStatsPrs();
35
36   //! Render element.
37   Standard_EXPORT virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const Standard_OVERRIDE;
38
39   //! Release OpenGL resources.
40   Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
41
42   //! Update text.
43   Standard_EXPORT void Update (const Handle(OpenGl_Workspace)& theWorkspace);
44
45   //! Assign text aspect.
46   void SetTextAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect.SetAspect (theAspect); }
47
48 protected:
49
50   //! Update chart presentation.
51   Standard_EXPORT void updateChart (const Handle(OpenGl_Workspace)& theWorkspace);
52
53 protected:
54
55   Handle(OpenGl_FrameStats)          myStatsPrev;         //!< currently displayed stats
56   Handle(Graphic3d_TransformPers)    myCountersTrsfPers;  //!< transformation persistence for counters presentation
57   OpenGl_Text                        myCountersText;      //!< counters presentation
58   OpenGl_AspectText                  myTextAspect;        //!< text aspect
59   Handle(Graphic3d_TransformPers)    myChartTrsfPers;     //!< transformation persistence for chart presentation
60   Handle(Graphic3d_ArrayOfTriangles) myChartArray;        //!< array of chart triangles
61   Handle(OpenGl_VertexBuffer)        myChartVertices;     //!< VBO with chart triangles
62   Handle(OpenGl_IndexBuffer)         myChartIndices;      //!< VBO with chart triangle indexes
63   Handle(OpenGl_VertexBuffer)        myChartLines;        //!< array of chart lines
64   OpenGl_Text                        myChartLabels[3];    //!< chart labels
65
66 };
67
68 #endif // _OpenGl_FrameStatsPrs_HeaderFile