Skip to content

Commit 3880567

Browse files
committed
Main: HardwareOcclusionQuery - add more descriptive API
and improve docs formatting
1 parent 74e35d7 commit 3880567

File tree

1 file changed

+27
-48
lines changed

1 file changed

+27
-48
lines changed

OgreMain/include/OgreHardwareOcclusionQuery.h

Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -42,85 +42,64 @@ namespace Ogre {
4242
* @{
4343
*/
4444
/**
45-
* This is a abstract class that that provides the interface for the query class for
46-
* hardware occlusion.
45+
* Query how many pixels have passed the per-fragment tests.
4746
*
48-
* @author Lee Sandberg
49-
* Updated on 13/8/2005 by Tuan Kuranes email: [email protected]
47+
* Create one OcclusionQuery per outstanding query or one per tested object
48+
*
49+
* Then, in the rendering loop:
50+
* 1. Draw all occluders
51+
* 2. @ref begin()
52+
* 3. Draw the polygons to be tested
53+
* 4. @ref end()
54+
*
55+
* Results must be pulled using @ref waitForResult()
5056
*/
51-
class _OgreExport HardwareOcclusionQuery : public RenderSysAlloc
57+
class _OgreExport HardwareOcclusionQuery : public RenderSysAlloc
5258
{
53-
//----------------------------------------------------------------------
54-
// Public methods
55-
//--
5659
public:
57-
/**
58-
* Object public member functions
59-
*/
60-
61-
/**
62-
* Default object constructor
63-
*
64-
*/
6560
HardwareOcclusionQuery();
6661

67-
/**
68-
* Object destructor
69-
*/
7062
virtual ~HardwareOcclusionQuery();
7163

7264
/**
7365
* Starts the hardware occlusion query
74-
* @remarks Simple usage: Create one or more OcclusionQuery object one per outstanding query or one per tested object
75-
* OcclusionQuery* mOcclusionQuery;
76-
* createOcclusionQuery( &mOcclusionQuery );
77-
* In the rendering loop:
78-
* Draw all occluders
79-
* mOcclusionQuery->startOcclusionQuery();
80-
* Draw the polygons to be tested
81-
* mOcclusionQuery->endOcclusionQuery();
82-
*
83-
* Results must be pulled using:
84-
* UINT mNumberOfPixelsVisable;
85-
* pullOcclusionQuery( &mNumberOfPixelsVisable );
86-
*
8766
*/
67+
void begin() { beginOcclusionQuery(); }
8868
virtual void beginOcclusionQuery() = 0;
8969

9070
/**
9171
* Ends the hardware occlusion test
9272
*/
73+
void end() { endOcclusionQuery(); }
9374
virtual void endOcclusionQuery() = 0;
9475

9576
/**
96-
* Pulls the hardware occlusion query.
97-
* @note Waits until the query result is available; use isStillOutstanding
98-
* if just want to test if the result is available.
99-
* @retval NumOfFragments will get the resulting number of fragments.
77+
* Waits until the query result is available.
78+
* use @ref resultReady() if just want to test if the result is available.
79+
* @retval result will get the resulting number of fragments.
10080
* @return True if success or false if not.
10181
*/
102-
virtual bool pullOcclusionQuery(unsigned int* NumOfFragments) = 0;
82+
bool waitForResult(unsigned int* result) { return pullOcclusionQuery(result); }
83+
virtual bool pullOcclusionQuery(unsigned int* result) = 0;
10384

10485
/**
105-
* Let's you get the last pixel count with out doing the hardware occlusion test
86+
* Let's you get the last pixel count with out doing the hardware occlusion test.
87+
* This function won't give you new values, just the old value.
10688
* @return The last fragment count from the last test.
107-
* Remarks This function won't give you new values, just the old value.
10889
*/
109-
unsigned int getLastQuerysPixelcount() const { return mPixelCount; }
90+
uint32 getLastResult() const { return mPixelCount; }
91+
OGRE_DEPRECATED uint32 getLastQuerysPixelcount() const { return getLastResult(); }
11092

11193
/**
11294
* Lets you know when query is done, or still be processed by the Hardware
113-
* @return true if query isn't finished.
95+
* @return true if query is finished.
11496
*/
115-
virtual bool isStillOutstanding(void) = 0;
116-
97+
bool resultReady() { return !isStillOutstanding(); }
98+
virtual bool isStillOutstanding(void) = 0;
11799

118-
//----------------------------------------------------------------------
119-
// protected members
120-
//--
121-
protected :
100+
protected:
122101
/// Number of visible pixels determined by last query
123-
unsigned int mPixelCount;
102+
uint32 mPixelCount;
124103
/// Has the query returned a result yet?
125104
bool mIsQueryResultStillOutstanding;
126105
};

0 commit comments

Comments
 (0)