source: GTP/trunk/Lib/Geom/OgreStuff/include/OgreHardwareOcclusionQuery.h @ 1809

Revision 1809, 3.8 KB checked in by gumbau, 18 years ago (diff)
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://ogre.sourceforge.net/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#ifndef _HardwareOcclusionQuery__
26#define _HardwareOcclusionQuery__
27
28// Precompiler options
29#include "OgrePrerequisites.h"
30
31namespace Ogre {
32
33
34
35/**
36  * This is a abstract class that that provides the interface for the query class for
37  * hardware occlusion.
38  *
39  * @author Lee Sandberg
40  * Updated on 13/8/2005 by Tuan Kuranes email: tuan.kuranes@free.fr
41  */
42class _OgreExport HardwareOcclusionQuery
43{
44//----------------------------------------------------------------------
45// Public methods
46//--
47public:
48        /**
49          * Object public member functions
50          */
51
52        /**
53          * Default object constructor
54          *
55          */
56        HardwareOcclusionQuery();
57
58        /**
59          * Object destructor
60          */
61        virtual ~HardwareOcclusionQuery();
62
63        /**
64          * Starts the hardware occlusion query
65          * @Remarks    Simple usage: Create one or more OcclusionQuery object one per outstanding query or one per tested object
66          *                             OcclusionQuery* m_pOcclusionQuery;
67          *                             createOcclusionQuery( &m_pOcclusionQuery );
68          *                             In the rendering loop:
69          *                             Draw all occluders
70          *                             m_pOcclusionQuery->startOcclusionQuery();
71          *                             Draw the polygons to be tested
72          *                             m_pOcclusionQuery->endOcclusionQuery();
73          *
74          *                             Results must be pulled using:
75          *                             UINT    m_uintNumberOfPixelsVisable;
76          *                             pullOcclusionQuery( &m_dwNumberOfPixelsVisable );
77          *                     
78          */
79        virtual void beginOcclusionQuery() = 0;
80
81        /**
82          * Ends the hardware occlusion test
83          */
84        virtual void endOcclusionQuery() = 0;
85
86        /**
87      * Pulls the hardware occlusion query.
88          * @note Waits until the query result is available; use isStillOutstanding
89          *             if just want to test if the result is available.
90      * @retval NumOfFragments will get the resulting number of fragments.
91      * @return True if success or false if not.
92      */
93        virtual bool pullOcclusionQuery(unsigned int* NumOfFragments) = 0;
94
95        /**
96          * Let's you get the last pixel count with out doing the hardware occlusion test
97          * @return The last fragment count from the last test.
98          * Remarks This function won't give you new values, just the old value.
99          */
100        unsigned int getLastQuerysPixelcount() const { return mPixelCount; }
101
102        /**
103          * Lets you know when query is done, or still be processed by the Hardware
104          * @return true if query isn't finished.
105          */
106         virtual bool isStillOutstanding(void) = 0;
107
108
109    //----------------------------------------------------------------------
110    // protected members
111    //--
112    protected :
113        // numbers of visible pixels determined by last query
114        unsigned int mPixelCount;
115        // is query hasn't yet returned a result.
116                bool             mIsQueryResultStillOutstanding;
117};
118
119}
120#endif
121
Note: See TracBrowser for help on using the repository browser.