@@ -42,85 +42,64 @@ namespace Ogre {
42
42
* @{
43
43
*/
44
44
/* *
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.
47
46
*
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()
50
56
*/
51
- class _OgreExport HardwareOcclusionQuery : public RenderSysAlloc
57
+ class _OgreExport HardwareOcclusionQuery : public RenderSysAlloc
52
58
{
53
- // ----------------------------------------------------------------------
54
- // Public methods
55
- // --
56
59
public:
57
- /* *
58
- * Object public member functions
59
- */
60
-
61
- /* *
62
- * Default object constructor
63
- *
64
- */
65
60
HardwareOcclusionQuery ();
66
61
67
- /* *
68
- * Object destructor
69
- */
70
62
virtual ~HardwareOcclusionQuery ();
71
63
72
64
/* *
73
65
* 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
- *
87
66
*/
67
+ void begin () { beginOcclusionQuery (); }
88
68
virtual void beginOcclusionQuery () = 0;
89
69
90
70
/* *
91
71
* Ends the hardware occlusion test
92
72
*/
73
+ void end () { endOcclusionQuery (); }
93
74
virtual void endOcclusionQuery () = 0;
94
75
95
76
/* *
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.
100
80
* @return True if success or false if not.
101
81
*/
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;
103
84
104
85
/* *
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.
106
88
* @return The last fragment count from the last test.
107
- * Remarks This function won't give you new values, just the old value.
108
89
*/
109
- unsigned int getLastQuerysPixelcount () const { return mPixelCount ; }
90
+ uint32 getLastResult () const { return mPixelCount ; }
91
+ OGRE_DEPRECATED uint32 getLastQuerysPixelcount () const { return getLastResult (); }
110
92
111
93
/* *
112
94
* 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.
114
96
*/
115
- virtual bool isStillOutstanding ( void ) = 0;
116
-
97
+ bool resultReady () { return ! isStillOutstanding (); }
98
+ virtual bool isStillOutstanding ( void ) = 0;
117
99
118
- // ----------------------------------------------------------------------
119
- // protected members
120
- // --
121
- protected :
100
+ protected:
122
101
// / Number of visible pixels determined by last query
123
- unsigned int mPixelCount ;
102
+ uint32 mPixelCount ;
124
103
// / Has the query returned a result yet?
125
104
bool mIsQueryResultStillOutstanding ;
126
105
};
0 commit comments