1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 10:53:54 +00:00

added some code that doesn't do anything yet, waiting for ogre 1.8

This commit is contained in:
scrawl 2012-03-24 13:06:01 +01:00
parent 9ec1e55aaf
commit f4898539e9
5 changed files with 63 additions and 3 deletions

View file

@ -15,7 +15,7 @@ source_group(game FILES ${GAME} ${GAME_HEADER})
add_openmw_dir (mwrender add_openmw_dir (mwrender
renderingmanager debugging sky player animation npcanimation creatureanimation actors objects renderingmanager debugging sky player animation npcanimation creatureanimation actors objects
renderinginterface localmap renderinginterface localmap occlusionquery
) )
add_openmw_dir (mwinput add_openmw_dir (mwinput

View file

@ -0,0 +1,27 @@
#include "occlusionquery.hpp"
#include <OgreRenderSystem.h>
#include <OgreRoot.h>
using namespace MWRender;
using namespace Ogre;
OcclusionQuery::OcclusionQuery() :
mSunTotalAreaQuery(0), mSunVisibleAreaQuery(0)
{
try {
RenderSystem* renderSystem = Root::getSingleton().getRenderSystem();
mSunTotalAreaQuery = renderSystem->createHardwareOcclusionQuery();
mSunVisibleAreaQuery = renderSystem->createHardwareOcclusionQuery();
mSupported = (mSunTotalAreaQuery != 0) && (mSunVisibleAreaQuery != 0);
}
catch (Ogre::Exception e)
{
mSupported = false;
}
if (!mSupported)
std::cout << "Hardware occlusion queries not supported." << std::endl;
}

View file

@ -0,0 +1,27 @@
#ifndef _GAME_OCCLUSION_QUERY_H
#define _GAME_OCCLUSION_QUERY_H
#include <OgreHardwareOcclusionQuery.h>
namespace MWRender
{
///
/// \brief Implements hardware occlusion queries on the GPU
///
class OcclusionQuery
{
public:
OcclusionQuery();
bool supported();
///< returns true if occlusion queries are supported on the user's hardware
private:
Ogre::HardwareOcclusionQuery* mSunTotalAreaQuery;
Ogre::HardwareOcclusionQuery* mSunVisibleAreaQuery;
bool mSupported;
};
}
#endif

View file

@ -49,6 +49,8 @@ RenderingManager::RenderingManager (OEngine::Render::OgreRenderer& _rend, const
Ogre::SceneNode *cameraYawNode = playerNode->createChildSceneNode(); Ogre::SceneNode *cameraYawNode = playerNode->createChildSceneNode();
Ogre::SceneNode *cameraPitchNode = cameraYawNode->createChildSceneNode(); Ogre::SceneNode *cameraPitchNode = cameraYawNode->createChildSceneNode();
cameraPitchNode->attachObject(mRendering.getCamera()); cameraPitchNode->attachObject(mRendering.getCamera());
mOcclusionQuery = new OcclusionQuery();
//mSkyManager = 0; //mSkyManager = 0;
mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera(), &environment); mSkyManager = new SkyManager(mMwRoot, mRendering.getCamera(), &environment);
@ -65,6 +67,7 @@ RenderingManager::~RenderingManager ()
delete mPlayer; delete mPlayer;
delete mSkyManager; delete mSkyManager;
delete mLocalMap; delete mLocalMap;
delete mOcclusionQuery;
} }
MWRender::SkyManager* RenderingManager::getSkyManager() MWRender::SkyManager* RenderingManager::getSkyManager()

View file

@ -25,6 +25,7 @@
#include "actors.hpp" #include "actors.hpp"
#include "player.hpp" #include "player.hpp"
#include "localmap.hpp" #include "localmap.hpp"
#include "occlusionquery.hpp"
namespace Ogre namespace Ogre
{ {
@ -131,9 +132,11 @@ class RenderingManager: private RenderingInterface {
private: private:
void setAmbientMode(); void setAmbientMode();
SkyManager* mSkyManager; SkyManager* mSkyManager;
OcclusionQuery* mOcclusionQuery;
OEngine::Render::OgreRenderer &mRendering; OEngine::Render::OgreRenderer &mRendering;
MWRender::Objects mObjects; MWRender::Objects mObjects;