OpenMW
apps/openmw/mwrender/occlusionquery.hpp
Go to the documentation of this file.
00001 #ifndef _GAME_OCCLUSION_QUERY_H
00002 #define _GAME_OCCLUSION_QUERY_H
00003 
00004 #include <OgreRenderObjectListener.h>
00005 #include <OgreRenderQueueListener.h>
00006 
00007 namespace Ogre
00008 {
00009     class HardwareOcclusionQuery;
00010     class Entity;
00011     class SceneNode;
00012 }
00013 
00014 #include <openengine/ogre/renderer.hpp>
00015 
00016 namespace MWRender
00017 {
00021     class OcclusionQuery : public Ogre::RenderObjectListener, public Ogre::RenderQueueListener
00022     {
00023     public:
00024         OcclusionQuery(OEngine::Render::OgreRenderer*, Ogre::SceneNode* sunNode);
00025         ~OcclusionQuery();
00026 
00030         bool supported();
00031 
00036         void setActive (bool active) { mActive = active; }
00037 
00041         void update(float duration);
00042 
00043         float getSunVisibility() const {return mSunVisibility;};
00044 
00045         void setSunNode(Ogre::SceneNode* node);
00046 
00047     private:
00048         Ogre::HardwareOcclusionQuery* mSunTotalAreaQuery;
00049         Ogre::HardwareOcclusionQuery* mSunVisibleAreaQuery;
00050         Ogre::HardwareOcclusionQuery* mActiveQuery;
00051 
00052         Ogre::Entity* mBBQueryVisible;
00053         Ogre::Entity* mBBQueryTotal;
00054 
00055         Ogre::SceneNode* mSunNode;
00056         Ogre::SceneNode* mBBNodeReal;
00057         float mSunVisibility;
00058 
00059         bool mWasVisible;
00060 
00061         bool mActive;
00062         bool mFirstFrame;
00063 
00064         bool mSupported;
00065         bool mDoQuery;
00066 
00067         OEngine::Render::OgreRenderer* mRendering;
00068 
00069     protected:
00070         virtual void notifyRenderSingleObject(Ogre::Renderable* rend, const Ogre::Pass* pass, const Ogre::AutoParamDataSource* source, 
00071                         const Ogre::LightList* pLightList, bool suppressRenderStateChanges);
00072 
00073         virtual void renderQueueEnded(Ogre::uint8 queueGroupId, const Ogre::String& invocation, bool& repeatThisInvocation);
00074     };
00075 }
00076 
00077 #endif