HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RE_OcclusionQuery.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RE_OcclusionQuery.h ( RE Library, C++)
7  *
8  * COMMENTS:
9  *
10  * This class implements the GL_ARB_occlusion_query feature, which allows
11  * multi-pass rendering to determine how many pixels in a batch of drawing
12  * commands were accepted by Z-culling.
13  *
14  * Only one query can be active at a time.
15  *
16  * The body of this class is implemented in RE_OGLQuery.
17  *
18  * If 'boolean_result' is passed to RE_OcclusionQuery, then a zero/one
19  * result will be passed back from getNumDrawn(). This may have a
20  * performance benefit for some hardware.
21  */
22 #ifndef RE_OCCLUSION_QUERY_H
23 #define RE_OCCLUSION_QUERY_H
24 
25 #include "RE_OGLQuery.h"
26 
27 class RE_Render;
28 
30 {
31 public:
33  {
35  NUM_SAMPLES
36  };
37 
38  RE_OcclusionQuery(RE_OcclusionResult result = NUM_SAMPLES);
39  ~RE_OcclusionQuery() override {}
40 
41  bool begin(RE_Render *r) override;
42  void end(RE_Render *r) override;
43 
45  { return (bool)(getIntResult(r)!=0); }
46 
48  {
49  if(myBooleanQuery)
50  return (getIntResult(r)!=0) ? 1 : 0;
51  return getIntResult(r);
52  }
53 
54 private:
55  bool myBooleanQuery;
56 };
57 
58 #endif
#define RE_API
Definition: RE_API.h:10
int getNumDrawn(RE_Render *r)
**But if you need a result
Definition: thread.h:613
~RE_OcclusionQuery() override
int getIntResult(RE_Render *r)
virtual void end(RE_Render *r)
GLboolean r
Definition: glcorearb.h:1222
bool getAnySamplesDrawn(RE_Render *r)
virtual bool begin(RE_Render *r)