Rev | Line | |
---|
[59] | 1 | #include "OgrePlatformOcclusionQuery.h"
|
---|
[115] | 2 | #include <OgreLogManager.h>
|
---|
[96] | 3 |
|
---|
[59] | 4 | namespace Ogre {
|
---|
| 5 |
|
---|
| 6 | //-----------------------------------------------------------------------
|
---|
| 7 | PlatformOcclusionQuery::PlatformOcclusionQuery(RenderSystem *rsys)
|
---|
| 8 | {
|
---|
| 9 | mHardwareOcclusionQuery = rsys->createHardwareOcclusionQuery();
|
---|
| 10 | }
|
---|
| 11 | //-----------------------------------------------------------------------
|
---|
| 12 | PlatformOcclusionQuery::~PlatformOcclusionQuery()
|
---|
| 13 | {
|
---|
[903] | 14 | //delete mHardwareOcclusionQuery;
|
---|
[59] | 15 | }
|
---|
| 16 | //-----------------------------------------------------------------------
|
---|
[87] | 17 | void PlatformOcclusionQuery::BeginQuery()
|
---|
[59] | 18 | {
|
---|
| 19 | mHardwareOcclusionQuery->beginOcclusionQuery();
|
---|
| 20 | }
|
---|
| 21 | //-----------------------------------------------------------------------
|
---|
[87] | 22 | void PlatformOcclusionQuery::EndQuery()
|
---|
[59] | 23 | {
|
---|
| 24 | mHardwareOcclusionQuery->endOcclusionQuery();
|
---|
| 25 | }
|
---|
| 26 | //-----------------------------------------------------------------------
|
---|
[86] | 27 | bool PlatformOcclusionQuery::GetQueryResult(unsigned int &visiblePixels,
|
---|
| 28 | const bool waitForResult) const
|
---|
[59] | 29 | {
|
---|
[897] | 30 | // return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels, waitForResult);
|
---|
| 31 |
|
---|
| 32 | bool isAvailable = true;
|
---|
| 33 |
|
---|
[925] | 34 | if (!waitForResult)
|
---|
| 35 | {
|
---|
[897] | 36 | isAvailable = !mHardwareOcclusionQuery->isStillOutstanding();
|
---|
[925] | 37 | //std::stringstream d; d << "available: " << isAvailable;
|
---|
| 38 | //Ogre::LogManager::getSingleton().logMessage(d.str());
|
---|
| 39 | }
|
---|
| 40 |
|
---|
[897] | 41 | if (isAvailable)
|
---|
| 42 | return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels);
|
---|
[925] | 43 |
|
---|
| 44 | return false;
|
---|
[59] | 45 | }
|
---|
| 46 |
|
---|
| 47 | } // namespace Ogre |
---|
Note: See
TracBrowser
for help on using the repository browser.