source: GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgrePlatformOcclusionQuery.cpp @ 944

Revision 944, 1.6 KB checked in by mattausch, 19 years ago (diff)
Line 
1#include "OgrePlatformOcclusionQuery.h"
2#include <OgreLogManager.h>
3
4namespace Ogre {
5
6//-----------------------------------------------------------------------
7PlatformOcclusionQuery::PlatformOcclusionQuery(RenderSystem *rsys)
8{
9        mHardwareOcclusionQuery = rsys->createHardwareOcclusionQuery();
10}
11//-----------------------------------------------------------------------
12PlatformOcclusionQuery::~PlatformOcclusionQuery()
13{
14        // hardwareocclusion query is deleted by Ogre
15        //delete mHardwareOcclusionQuery;
16}
17//-----------------------------------------------------------------------
18void PlatformOcclusionQuery::BeginQuery()
19{
20        mHardwareOcclusionQuery->beginOcclusionQuery();
21}
22//-----------------------------------------------------------------------
23void PlatformOcclusionQuery::EndQuery()
24{
25        mHardwareOcclusionQuery->endOcclusionQuery();
26}
27//-----------------------------------------------------------------------
28bool PlatformOcclusionQuery::GetQueryResult(unsigned int &visiblePixels,
29                                                                                        const bool waitForResult) const
30{
31        // return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels, waitForResult);
32
33        bool isAvailable = true;
34
35        if (!waitForResult)
36        {
37                isAvailable = !mHardwareOcclusionQuery->isStillOutstanding();
38        }
39
40//std::stringstream d; d << mHardwareOcclusionQuery << ", available: " << isAvailable << ", waitforresult: " << waitForResult;
41//              Ogre::LogManager::getSingleton().logMessage(d.str());
42
43        if (isAvailable)
44                return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels);
45       
46        return false;
47}
48
49} // namespace Ogre
Note: See TracBrowser for help on using the repository browser.