#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 { if (waitForResult || !mHardwareOcclusionQuery->isStillOutstanding()) { //return mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels); mHardwareOcclusionQuery->pullOcclusionQuery(&visiblePixels); return true; } return false; } } // namespace Ogre