1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2013 Torus Knot Software Ltd |
---|
8 | |
---|
9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
10 | of this software and associated documentation files (the "Software"), to deal |
---|
11 | in the Software without restriction, including without limitation the rights |
---|
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
13 | copies of the Software, and to permit persons to whom the Software is |
---|
14 | furnished to do so, subject to the following conditions: |
---|
15 | |
---|
16 | The above copyright notice and this permission notice shall be included in |
---|
17 | all copies or substantial portions of the Software. |
---|
18 | |
---|
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
25 | THE SOFTWARE. |
---|
26 | ----------------------------------------------------------------------------- |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef __OverlayProfileSessionListener_H__ |
---|
30 | #define __OverlayProfileSessionListener_H__ |
---|
31 | |
---|
32 | #include "OgreOverlayPrerequisites.h" |
---|
33 | #include "OgreProfiler.h" |
---|
34 | #include "OgreOverlay.h" |
---|
35 | |
---|
36 | namespace Ogre { |
---|
37 | |
---|
38 | /** \addtogroup Core |
---|
39 | * @{ |
---|
40 | */ |
---|
41 | /** \addtogroup Overlays |
---|
42 | * @{ |
---|
43 | */ |
---|
44 | |
---|
45 | /** Concrete impl. of the ProfileSessionListener which visualizes |
---|
46 | the profling results using overlays. |
---|
47 | */ |
---|
48 | class _OgreOverlayExport OverlayProfileSessionListener : public ProfileSessionListener |
---|
49 | { |
---|
50 | public: |
---|
51 | OverlayProfileSessionListener(); |
---|
52 | virtual ~OverlayProfileSessionListener(); |
---|
53 | |
---|
54 | /// @see ProfileSessionListener::initializeSession |
---|
55 | virtual void initializeSession(); |
---|
56 | |
---|
57 | /// @see ProfileSessionListener::finializeSession |
---|
58 | virtual void finializeSession(); |
---|
59 | |
---|
60 | /// @see ProfileSessionListener::displayResults |
---|
61 | virtual void displayResults(const ProfileInstance& instance, ulong maxTotalFrameTime); |
---|
62 | |
---|
63 | /// @see ProfileSessionListener::changeEnableState |
---|
64 | virtual void changeEnableState(bool enabled); |
---|
65 | |
---|
66 | /** Set the size of the profiler overlay, in pixels. */ |
---|
67 | void setOverlayDimensions(Real width, Real height); |
---|
68 | |
---|
69 | /** Set the position of the profiler overlay, in pixels. */ |
---|
70 | void setOverlayPosition(Real left, Real top); |
---|
71 | |
---|
72 | Real getOverlayWidth() const; |
---|
73 | Real getOverlayHeight() const; |
---|
74 | Real getOverlayLeft() const; |
---|
75 | Real getOverlayTop() const; |
---|
76 | |
---|
77 | private: |
---|
78 | typedef list<OverlayElement*>::type ProfileBarList; |
---|
79 | |
---|
80 | /** Prints the profiling results of each frame |
---|
81 | @remarks Recursive, for all the little children. */ |
---|
82 | void displayResults(ProfileInstance* instance, ProfileBarList::const_iterator& bIter, Real& maxTimeMillisecs, Real& newGuiHeight, int& profileCount); |
---|
83 | |
---|
84 | /** An internal function to create the container which will hold our display elements*/ |
---|
85 | OverlayContainer* createContainer(); |
---|
86 | |
---|
87 | /** An internal function to create a text area */ |
---|
88 | OverlayElement* createTextArea(const String& name, Real width, Real height, Real top, Real left, |
---|
89 | uint fontSize, const String& caption, bool show = true); |
---|
90 | |
---|
91 | /** An internal function to create a panel */ |
---|
92 | OverlayElement* createPanel(const String& name, Real width, Real height, Real top, Real left, |
---|
93 | const String& materialName, bool show = true); |
---|
94 | |
---|
95 | /// Holds the display bars for each profile results |
---|
96 | ProfileBarList mProfileBars; |
---|
97 | |
---|
98 | /// The overlay which contains our profiler results display |
---|
99 | Overlay* mOverlay; |
---|
100 | |
---|
101 | /// The window that displays the profiler results |
---|
102 | OverlayContainer* mProfileGui; |
---|
103 | |
---|
104 | /// The height of each bar |
---|
105 | Real mBarHeight; |
---|
106 | |
---|
107 | /// The height of the stats window |
---|
108 | Real mGuiHeight; |
---|
109 | |
---|
110 | /// The width of the stats window |
---|
111 | Real mGuiWidth; |
---|
112 | |
---|
113 | /// The horz position of the stats window |
---|
114 | Real mGuiLeft; |
---|
115 | |
---|
116 | /// The vertical position of the stats window |
---|
117 | Real mGuiTop; |
---|
118 | |
---|
119 | /// The size of the indent for each profile display bar |
---|
120 | Real mBarIndent; |
---|
121 | |
---|
122 | /// The width of the border between the profile window and each bar |
---|
123 | Real mGuiBorderWidth; |
---|
124 | |
---|
125 | /// The width of the min, avg, and max lines in a profile display |
---|
126 | Real mBarLineWidth; |
---|
127 | |
---|
128 | /// The distance between bars |
---|
129 | Real mBarSpacing; |
---|
130 | |
---|
131 | /// The max number of profiles we can display |
---|
132 | uint mMaxDisplayProfiles; |
---|
133 | }; |
---|
134 | } |
---|
135 | #endif |
---|