My Project
OcclusionQueryBank.h
1 #pragma once
2 
3 #include <vector>
4 namespace ParaEngine
5 {
6  // Little struct used to store queries and their outstanding state
8  {
9  LPDIRECT3DQUERY9 query;
10  enum
11  {
12  UNUSED = 0,
13  ISSUEDBEGIN = 1,
14  ISSUEDEND = 2,
15  } state;
16 
18  void* pUserData;
19  LatentQueryElement():query(NULL), state(UNUSED), pUserData(NULL){};
20  };
21 
22  typedef std::vector<LatentQueryElement> QueryVector;
23 
49  {
50  public:
51  LatentOcclusionQueryBank( IDirect3DDevice9 * pD3DDev);
53  HRESULT GetLatestResults(DWORD *count);
54  HRESULT BeginNextQuery();
55  HRESULT EndNextQuery();
56  uint32 GetNumActiveQueries();
57 
58 
60  HRESULT BeginNewQuery(void* pUserData = NULL);
62  HRESULT EndNewQuery();
66  HRESULT WaitForFirstResult(DWORD *count, void** pUserData=NULL);
70  HRESULT CheckForFirstResult(DWORD *count, void** pUserData=NULL);
72  bool HasUnusedQuery();
73 
74 
75  void Cleanup();
76  bool IsValid();
77 
78  protected:
79  bool m_bIsValid;
80  QueryVector m_Queries;
81  int m_head;
82 
87  };
88 }
89 
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: OcclusionQueryBank.h:7
This is a bank of occlusion queries.
Definition: OcclusionQueryBank.h:48
void * pUserData
user data associated with a specific query object.
Definition: OcclusionQueryBank.h:18
int m_nFirstUnusedIndex
the index of the first unused query in the bank
Definition: OcclusionQueryBank.h:84
int m_nFirstQueryIndex
the index of the oldest query in the bank
Definition: OcclusionQueryBank.h:86