1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://ogre.sourceforge.net/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 | #ifndef _HardwareOcclusionQuery__
|
---|
26 | #define _HardwareOcclusionQuery__
|
---|
27 |
|
---|
28 | // Precompiler options
|
---|
29 | #include "OgrePrerequisites.h"
|
---|
30 |
|
---|
31 | namespace 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 | */
|
---|
42 | class _OgreExport HardwareOcclusionQuery
|
---|
43 | {
|
---|
44 | //----------------------------------------------------------------------
|
---|
45 | // Public methods
|
---|
46 | //--
|
---|
47 | public:
|
---|
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 too see if there is a result.
|
---|
88 | * @retval NumOfFragments will get the resulting number of fragments.
|
---|
89 | * @return True if success or false if not.
|
---|
90 | */
|
---|
91 | virtual bool pullOcclusionQuery(unsigned int* NumOfFragments) = 0;
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Let's you get the last pixel count with out doing the hardware occlusion test
|
---|
95 | * @return The last fragment count from the last test.
|
---|
96 | * Remarks This function won't give you new values, just the old value.
|
---|
97 | */
|
---|
98 | unsigned int getLastQuerysPixelcount() const { return mPixelCount; }
|
---|
99 |
|
---|
100 | /**
|
---|
101 | * Lets you know when query is done, or still be processed by the Hardware
|
---|
102 | * @return true if query isn't finished.
|
---|
103 | */
|
---|
104 | virtual bool HardwareOcclusionQuery::isStillOutstanding(void) = 0;
|
---|
105 |
|
---|
106 |
|
---|
107 | //----------------------------------------------------------------------
|
---|
108 | // protected members
|
---|
109 | //--
|
---|
110 | protected :
|
---|
111 | // numbers of visible pixels determined by last query
|
---|
112 | unsigned int mPixelCount;
|
---|
113 | // is query hasn't yet returned a result.
|
---|
114 | bool mIsQueryResultStillOutstanding;
|
---|
115 | };
|
---|
116 |
|
---|
117 | }
|
---|
118 | #endif
|
---|
119 |
|
---|