2015-04-12 13:34:50 +00:00
|
|
|
#ifndef OPENMW_MWRENDER_RENDERINGMANAGER_H
|
|
|
|
#define OPENMW_MWRENDER_RENDERINGMANAGER_H
|
2011-10-20 19:02:19 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
#include <osg/ref_ptr>
|
|
|
|
#include <osg/Light>
|
2011-11-12 05:19:22 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
#include "objects.hpp"
|
2013-02-03 17:03:09 +00:00
|
|
|
|
2011-11-12 05:19:22 +00:00
|
|
|
#include "renderinginterface.hpp"
|
2011-11-24 06:48:54 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
namespace osg
|
2011-10-20 22:15:30 +00:00
|
|
|
{
|
2015-04-12 13:34:50 +00:00
|
|
|
class Group;
|
2011-10-20 22:15:30 +00:00
|
|
|
}
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
namespace Resource
|
2011-10-20 19:02:19 +00:00
|
|
|
{
|
2015-04-12 13:34:50 +00:00
|
|
|
class ResourceSystem;
|
2011-10-20 22:15:30 +00:00
|
|
|
}
|
2011-10-20 19:02:19 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
namespace osgViewer
|
2012-07-03 20:48:16 +00:00
|
|
|
{
|
2015-04-12 13:34:50 +00:00
|
|
|
class Viewer;
|
2012-07-03 20:48:16 +00:00
|
|
|
}
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
namespace ESM
|
2013-08-16 11:01:52 +00:00
|
|
|
{
|
2015-04-12 13:34:50 +00:00
|
|
|
struct Cell;
|
2013-08-16 11:01:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-20 22:15:30 +00:00
|
|
|
namespace MWRender
|
|
|
|
{
|
2012-08-12 11:50:37 +00:00
|
|
|
|
2015-04-14 13:55:56 +00:00
|
|
|
class StateUpdater;
|
|
|
|
|
2015-04-19 15:55:56 +00:00
|
|
|
class EffectManager;
|
2015-04-14 13:55:56 +00:00
|
|
|
class SkyManager;
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
class RenderingManager : public MWRender::RenderingInterface
|
2013-04-29 12:50:40 +00:00
|
|
|
{
|
2015-04-12 13:34:50 +00:00
|
|
|
public:
|
|
|
|
RenderingManager(osgViewer::Viewer& viewer, osg::ref_ptr<osg::Group> rootNode, Resource::ResourceSystem* resourceSystem);
|
2015-04-14 13:55:56 +00:00
|
|
|
~RenderingManager();
|
2014-01-17 09:52:44 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
MWRender::Objects& getObjects();
|
2013-04-29 10:31:46 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
Resource::ResourceSystem* getResourceSystem();
|
2011-11-04 03:47:15 +00:00
|
|
|
|
2015-04-14 13:55:56 +00:00
|
|
|
void setAmbientColour(const osg::Vec4f& colour);
|
|
|
|
|
|
|
|
void setSunDirection(const osg::Vec3f& direction);
|
|
|
|
void setSunColour(const osg::Vec4f& colour);
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
void configureAmbient(const ESM::Cell* cell);
|
2015-04-21 21:27:26 +00:00
|
|
|
void configureFog(const ESM::Cell* cell);
|
2015-04-14 13:55:56 +00:00
|
|
|
void configureFog(float fogDepth, const osg::Vec4f& colour);
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
void removeCell(const MWWorld::CellStore* store);
|
2013-02-27 08:20:42 +00:00
|
|
|
|
2015-04-23 21:50:46 +00:00
|
|
|
// TODO rename to setRotation/setPosition/setScale, along with the World equivalents
|
|
|
|
void rotateObject(const MWWorld::Ptr& ptr, const osg::Quat& rot);
|
|
|
|
void moveObject(const MWWorld::Ptr& ptr, const osg::Vec3f& pos);
|
|
|
|
void scaleObject(const MWWorld::Ptr& ptr, const osg::Vec3f& scale);
|
|
|
|
|
2015-04-14 13:55:56 +00:00
|
|
|
void setSkyEnabled(bool enabled);
|
|
|
|
|
|
|
|
SkyManager* getSkyManager();
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
osg::Vec3f getEyePos();
|
2011-11-02 04:13:33 +00:00
|
|
|
|
2015-04-19 15:55:56 +00:00
|
|
|
void spawnEffect(const std::string &model, const std::string &texture, const osg::Vec3f &worldPosition, float scale = 1.f);
|
|
|
|
|
|
|
|
/// Clear all savegame-specific data
|
|
|
|
void clear();
|
|
|
|
|
|
|
|
/// Clear all worldspace-specific data
|
|
|
|
void notifyWorldSpaceChanged();
|
|
|
|
|
2015-04-18 23:57:52 +00:00
|
|
|
void update(float dt, bool paused);
|
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
private:
|
|
|
|
osgViewer::Viewer& mViewer;
|
|
|
|
osg::ref_ptr<osg::Group> mRootNode;
|
|
|
|
Resource::ResourceSystem* mResourceSystem;
|
2012-03-29 09:27:13 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
osg::ref_ptr<osg::Light> mSunLight;
|
2012-04-11 16:53:13 +00:00
|
|
|
|
2015-04-12 13:34:50 +00:00
|
|
|
std::auto_ptr<Objects> mObjects;
|
2015-04-14 13:55:56 +00:00
|
|
|
std::auto_ptr<SkyManager> mSky;
|
2015-04-19 15:55:56 +00:00
|
|
|
std::auto_ptr<EffectManager> mEffectManager;
|
2015-04-14 13:55:56 +00:00
|
|
|
|
|
|
|
osg::ref_ptr<StateUpdater> mStateUpdater;
|
|
|
|
|
2015-04-21 21:27:26 +00:00
|
|
|
float mViewDistance;
|
|
|
|
|
2015-04-14 13:55:56 +00:00
|
|
|
void operator = (const RenderingManager&);
|
|
|
|
RenderingManager(const RenderingManager&);
|
2015-04-12 13:34:50 +00:00
|
|
|
};
|
2011-10-20 19:02:19 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|