#include "OgrePlatformOcclusionQuery.h" #include namespace Ogre { //----------------------------------------------------------------------- PlatformOcclusionQuery::PlatformOcclusionQuery(RenderSystem *rsys) { mHardwareOcclusionQuery = rsys->createHardwareOcclusionQuery(); } //----------------------------------------------------------------------- PlatformOcclusionQuery::~PlatformOcclusionQuery() { // hardwareocclusion query is deleted by Ogre //delete mHardwareOcclusionQuery; } //----------------------------------------------------------------------- void PlatformOcclusionQuery::BeginQuery() { mHardwareOcclusionQuery->beginOcclusionQuery(); } //----------------------------------------------------------------------- void PlatformOcclusionQuery::EndQuery() { mHardwareOcclusionQuery->endOcclusionQuery(); } //----------------------------------------------------------------------- bool PlatformOcclusionQuery::GetQueryResult(unsigned int &visiblePixels, const bool waitForResult) const { // return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels, waitForResult); bool isAvailable = true; if (!waitForResult) { isAvailable = !mHardwareOcclusionQuery->isStillOutstanding(); } //std::stringstream d; d << mHardwareOcclusionQuery << ", available: " << isAvailable << ", waitforresult: " << waitForResult; // Ogre::LogManager::getSingleton().logMessage(d.str()); if (isAvailable) return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels); return false; } } // namespace Ogre