1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 06:39:49 +00:00
OpenMW/apps/openmw/mwrender/occlusionquery.hpp

77 lines
2.0 KiB
C++
Raw Normal View History

#ifndef _GAME_OCCLUSION_QUERY_H
#define _GAME_OCCLUSION_QUERY_H
#include <OgreRenderObjectListener.h>
2012-03-25 18:52:56 +00:00
#include <OgreRenderQueueListener.h>
2012-03-24 19:41:23 +00:00
namespace Ogre
{
class HardwareOcclusionQuery;
class Entity;
class SceneNode;
}
#include <openengine/ogre/renderer.hpp>
namespace MWRender
{
///
/// \brief Implements hardware occlusion queries on the GPU
///
2012-03-25 18:52:56 +00:00
class OcclusionQuery : public Ogre::RenderObjectListener, public Ogre::RenderQueueListener
{
public:
OcclusionQuery(OEngine::Render::OgreRenderer*, Ogre::SceneNode* sunNode);
~OcclusionQuery();
2012-03-24 17:38:58 +00:00
/**
* @return true if occlusion queries are supported on the user's hardware
*/
bool supported();
/**
* make sure to disable occlusion queries before updating unrelated render targets
* @param active
*/
void setActive (bool active) { mActive = active; }
2012-03-24 17:38:58 +00:00
/**
* per-frame update
*/
2012-03-25 22:31:03 +00:00
void update(float duration);
2012-03-24 17:38:58 +00:00
float getSunVisibility() const {return mSunVisibility;};
void setSunNode(Ogre::SceneNode* node);
private:
Ogre::HardwareOcclusionQuery* mSunTotalAreaQuery;
Ogre::HardwareOcclusionQuery* mSunVisibleAreaQuery;
Ogre::HardwareOcclusionQuery* mActiveQuery;
Ogre::Entity* mBBQueryVisible;
Ogre::Entity* mBBQueryTotal;
Ogre::SceneNode* mSunNode;
2012-03-31 17:08:05 +00:00
Ogre::SceneNode* mBBNodeReal;
float mSunVisibility;
2012-03-25 18:52:56 +00:00
bool mWasVisible;
2012-03-24 17:38:58 +00:00
bool mActive;
bool mSupported;
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-25 18:52:56 +00:00
virtual void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation);
};
}
#endif