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

Revision 925, 1.5 KB checked in by mattausch, 18 years ago (diff)

update for ogre 1.2
OcclusionCullingSceneManager? is the only scenemanager in the solution now

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        //delete mHardwareOcclusionQuery;
15}
16//-----------------------------------------------------------------------
17void PlatformOcclusionQuery::BeginQuery()
18{
19        mHardwareOcclusionQuery->beginOcclusionQuery();
20}
21//-----------------------------------------------------------------------
22void PlatformOcclusionQuery::EndQuery()
23{
24        mHardwareOcclusionQuery->endOcclusionQuery();
25}
26//-----------------------------------------------------------------------
27bool PlatformOcclusionQuery::GetQueryResult(unsigned int &visiblePixels,
28                                                                                        const bool waitForResult) const
29{
30        // return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels, waitForResult);
31
32        bool isAvailable = true;
33
34        if (!waitForResult)
35        {
36                isAvailable = !mHardwareOcclusionQuery->isStillOutstanding();
37                //std::stringstream d; d << "available: " << isAvailable;
38                //Ogre::LogManager::getSingleton().logMessage(d.str());
39        }
40
41        if (isAvailable)
42                return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels);
43       
44        return false;
45}
46
47} // namespace Ogre
Note: See TracBrowser for help on using the repository browser.