My Project
|
This is a bank of occlusion queries. More...
#include <OcclusionQueryBank.h>
Public Member Functions | |
LatentOcclusionQueryBank (IDirect3DDevice9 *pD3DDev) | |
HRESULT | GetLatestResults (DWORD *count) |
HRESULT | BeginNextQuery () |
HRESULT | EndNextQuery () |
uint32 | GetNumActiveQueries () |
HRESULT | BeginNewQuery (void *pUserData=NULL) |
start a new query | |
HRESULT | EndNewQuery () |
end a new query | |
HRESULT | WaitForFirstResult (DWORD *count, void **pUserData=NULL) |
wait until the first query result is available. More... | |
HRESULT | CheckForFirstResult (DWORD *count, void **pUserData=NULL) |
check the first query result is available. More... | |
bool | HasUnusedQuery () |
return true if there is unused query in the bank | |
void | Cleanup () |
bool | IsValid () |
Protected Attributes | |
bool | m_bIsValid |
QueryVector | m_Queries |
int | m_head |
int | m_nFirstUnusedIndex |
the index of the first unused query in the bank | |
int | m_nFirstQueryIndex |
the index of the oldest query in the bank | |
This is a bank of occlusion queries.
It is meant to allow multiple occlusion queries to be used in conjunction with a rendering strategy that culls based on the results. All calls into this class return immediately, so, it is possible for the call to GetLatestResults to return S_FALSE, indicating that there are no new results.
(Background: An occlusion query returns the number of pixels that pass z-testing; if greater than zero, you know an object is visible. For more information, look up D3DQUERYTYPE or D3DQUERYTYPE_OCCLUSION in MSDN.)
Usage:
Use just like a regular D3DQuery, replacing the following calls:
LPDIRECT3DQUERY9 -> LatentOcclusionQueryBank GetData() -> GetLatestResults() Issue(D3DISSUE_BEGIN) -> BeginNextQuery() Issue(D3DISSUE_BEGIN) -> EndNextQuery() Release() -> Free()
Remember to call Free()!
HRESULT LatentOcclusionQueryBank::CheckForFirstResult | ( | DWORD * | count, |
void ** | pUserData = NULL |
||
) |
check the first query result is available.
and return immediately.
pUserData | [out] user data when the query is issued. |
HRESULT LatentOcclusionQueryBank::WaitForFirstResult | ( | DWORD * | count, |
void ** | pUserData = NULL |
||
) |
wait until the first query result is available.
and return the pixel count in count
pUserData | [out] user data when the query is issued. |