2012-03-24 12:06:01 +00:00
|
|
|
#ifndef _GAME_OCCLUSION_QUERY_H
|
|
|
|
#define _GAME_OCCLUSION_QUERY_H
|
|
|
|
|
|
|
|
#include <OgreHardwareOcclusionQuery.h>
|
2012-03-24 16:59:26 +00:00
|
|
|
#include <OgreRenderObjectListener.h>
|
|
|
|
|
|
|
|
#include <openengine/ogre/renderer.hpp>
|
2012-03-24 12:06:01 +00:00
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
///
|
|
|
|
/// \brief Implements hardware occlusion queries on the GPU
|
|
|
|
///
|
2012-03-24 16:59:26 +00:00
|
|
|
class OcclusionQuery : public Ogre::RenderObjectListener
|
2012-03-24 12:06:01 +00:00
|
|
|
{
|
|
|
|
public:
|
2012-03-24 16:59:26 +00:00
|
|
|
OcclusionQuery(OEngine::Render::OgreRenderer*, Ogre::SceneNode* sunNode);
|
|
|
|
~OcclusionQuery();
|
2012-03-24 12:06:01 +00:00
|
|
|
|
|
|
|
bool supported();
|
|
|
|
///< returns true if occlusion queries are supported on the user's hardware
|
|
|
|
|
2012-03-24 16:59:26 +00:00
|
|
|
void update();
|
|
|
|
///< per-frame update
|
|
|
|
|
|
|
|
float getSunVisibility() const {return mSunVisibility;};
|
|
|
|
|
2012-03-24 12:06:01 +00:00
|
|
|
private:
|
|
|
|
Ogre::HardwareOcclusionQuery* mSunTotalAreaQuery;
|
|
|
|
Ogre::HardwareOcclusionQuery* mSunVisibleAreaQuery;
|
2012-03-24 16:59:26 +00:00
|
|
|
Ogre::HardwareOcclusionQuery* mActiveQuery;
|
|
|
|
|
|
|
|
Ogre::BillboardSet* mBBQueryVisible;
|
|
|
|
Ogre::BillboardSet* mBBQueryTotal;
|
|
|
|
|
|
|
|
Ogre::SceneNode* mSunNode;
|
|
|
|
|
|
|
|
float mSunVisibility;
|
2012-03-24 12:06:01 +00:00
|
|
|
|
|
|
|
bool mSupported;
|
2012-03-24 16:59:26 +00:00
|
|
|
bool mDoQuery;
|
|
|
|
|
|
|
|
OEngine::Render::OgreRenderer* mRendering;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void notifyRenderSingleObject(Ogre::Renderable* rend, const Ogre::Pass* pass, const Ogre::AutoParamDataSource* source,
|
|
|
|
const Ogre::LightList* pLightList, bool suppressRenderStateChanges);
|
2012-03-24 12:06:01 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|