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

96 lines
2.6 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();
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
/**
* request occlusion test for a billboard at the given position, omitting an entity
* @param position of the billboard in ogre coordinates
2012-03-25 18:52:56 +00:00
* @param object to exclude from the occluders
2012-03-24 17:38:58 +00:00
*/
2012-03-25 18:52:56 +00:00
void occlusionTest(const Ogre::Vector3& position, Ogre::SceneNode* object);
2012-03-24 17:38:58 +00:00
/**
* @return true if a request is still outstanding
*/
bool occlusionTestPending();
/**
* @return true if the object tested in the last request was occluded
*/
bool getTestResult();
float getSunVisibility() const {return mSunVisibility;};
private:
Ogre::HardwareOcclusionQuery* mSunTotalAreaQuery;
Ogre::HardwareOcclusionQuery* mSunVisibleAreaQuery;
2012-03-24 19:41:23 +00:00
Ogre::HardwareOcclusionQuery* mSingleObjectQuery;
Ogre::HardwareOcclusionQuery* mActiveQuery;
Ogre::BillboardSet* mBBQueryVisible;
Ogre::BillboardSet* mBBQueryTotal;
2012-03-24 19:41:23 +00:00
Ogre::BillboardSet* mBBQuerySingleObject;
Ogre::SceneNode* mSunNode;
2012-03-24 17:38:58 +00:00
Ogre::SceneNode* mBBNode;
2012-03-31 17:08:05 +00:00
Ogre::SceneNode* mBBNodeReal;
float mSunVisibility;
2012-03-24 19:41:23 +00:00
Ogre::SceneNode* mObjectNode;
2012-03-25 18:52:56 +00:00
bool mWasVisible;
2012-03-26 19:52:38 +00:00
bool mObjectWasVisible;
2012-03-24 19:41:23 +00:00
2012-03-24 17:38:58 +00:00
bool mTestResult;
bool mSupported;
bool mDoQuery;
2012-03-31 17:12:02 +00:00
bool mDoQuery2;
2012-03-24 19:41:23 +00:00
bool mQuerySingleObjectRequested;
bool mQuerySingleObjectStarted;
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