1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00
OpenMW/apps/openmw/mwrender/renderingmanager.hpp

148 lines
3.9 KiB
C++
Raw Normal View History

#ifndef OPENMW_MWRENDER_RENDERINGMANAGER_H
#define OPENMW_MWRENDER_RENDERINGMANAGER_H
2011-10-20 15:02:19 -04:00
#include <osg/ref_ptr>
#include <osg/Light>
2011-11-12 00:19:22 -05:00
#include <components/settings/settings.hpp>
#include "objects.hpp"
2011-11-12 00:19:22 -05:00
#include "renderinginterface.hpp"
2015-05-02 22:45:27 +02:00
#include "rendermode.hpp"
namespace osg
{
class Group;
2015-05-01 18:21:50 +02:00
class PositionAttitudeTransform;
}
namespace Resource
2011-10-20 15:02:19 -04:00
{
class ResourceSystem;
}
2011-10-20 15:02:19 -04:00
namespace osgViewer
2012-07-03 22:48:16 +02:00
{
class Viewer;
2012-07-03 22:48:16 +02:00
}
namespace ESM
{
struct Cell;
}
namespace MWRender
{
2012-08-12 15:50:37 +04:00
class StateUpdater;
2015-04-19 17:55:56 +02:00
class EffectManager;
class SkyManager;
2015-05-01 18:21:50 +02:00
class NpcAnimation;
class Pathgrid;
2015-05-21 23:54:39 +02:00
class Camera;
class RenderingManager : public MWRender::RenderingInterface
2013-04-29 05:50:40 -07:00
{
public:
2015-05-14 21:42:04 +02:00
RenderingManager(osgViewer::Viewer* viewer, osg::ref_ptr<osg::Group> rootNode, Resource::ResourceSystem* resourceSystem);
~RenderingManager();
2014-01-17 10:52:44 +01:00
MWRender::Objects& getObjects();
Resource::ResourceSystem* getResourceSystem();
2011-11-03 23:47:15 -04:00
void setAmbientColour(const osg::Vec4f& colour);
void setSunDirection(const osg::Vec3f& direction);
void setSunColour(const osg::Vec4f& colour);
void configureAmbient(const ESM::Cell* cell);
void configureFog(const ESM::Cell* cell);
void configureFog(float fogDepth, const osg::Vec4f& colour);
2015-05-02 22:45:27 +02:00
void addCell(const MWWorld::CellStore* store);
void removeCell(const MWWorld::CellStore* store);
2013-02-27 09:20:42 +01:00
2015-05-14 17:34:55 +02:00
void updatePtr(const MWWorld::Ptr& old, const MWWorld::Ptr& updated);
2015-04-23 23:50:46 +02:00
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);
void setSkyEnabled(bool enabled);
2015-05-02 22:45:27 +02:00
bool toggleRenderMode(RenderMode mode);
SkyManager* getSkyManager();
osg::Vec3f getEyePos();
2011-11-02 00:13:33 -04:00
2015-04-19 17:55:56 +02: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-19 01:57:52 +02:00
void update(float dt, bool paused);
2015-05-01 18:21:50 +02:00
Animation* getAnimation(const MWWorld::Ptr& ptr);
Animation* getPlayerAnimation();
2015-05-21 23:54:39 +02:00
void updatePlayerPtr(const MWWorld::Ptr &ptr);
2015-05-01 18:21:50 +02:00
void setupPlayer(const MWWorld::Ptr& player);
void renderPlayer(const MWWorld::Ptr& player);
2015-04-25 15:19:17 +02:00
2015-05-21 23:54:39 +02:00
void rebuildPtr(const MWWorld::Ptr& ptr);
void processChangedSettings(const Settings::CategorySettingVector& settings);
2015-05-21 23:54:39 +02:00
// camera stuff
bool vanityRotateCamera(const float *rot);
void setCameraDistance(float dist, bool adjust, bool override);
void resetCamera();
float getCameraDistance() const;
Camera* getCamera();
void togglePOV();
void togglePreviewMode(bool enable);
bool toggleVanityMode(bool enable);
void allowVanityMode(bool allow);
void togglePlayerLooking(bool enable);
void changeVanityModeScale(float factor);
private:
void updateProjectionMatrix();
2015-05-14 21:42:04 +02:00
void updateTextureFiltering();
2015-05-14 21:42:04 +02:00
osg::ref_ptr<osgViewer::Viewer> mViewer;
osg::ref_ptr<osg::Group> mRootNode;
2015-05-01 18:21:50 +02:00
osg::ref_ptr<osg::Group> mLightRoot;
Resource::ResourceSystem* mResourceSystem;
osg::ref_ptr<osg::Light> mSunLight;
2012-04-11 18:53:13 +02:00
std::auto_ptr<Pathgrid> mPathgrid;
std::auto_ptr<Objects> mObjects;
std::auto_ptr<SkyManager> mSky;
2015-04-19 17:55:56 +02:00
std::auto_ptr<EffectManager> mEffectManager;
2015-05-01 18:21:50 +02:00
std::auto_ptr<NpcAnimation> mPlayerAnimation;
osg::ref_ptr<osg::PositionAttitudeTransform> mPlayerNode;
2015-05-21 23:54:39 +02:00
std::auto_ptr<Camera> mCamera;
osg::ref_ptr<StateUpdater> mStateUpdater;
float mViewDistance;
float mFieldOfView;
void operator = (const RenderingManager&);
RenderingManager(const RenderingManager&);
};
2011-10-20 15:02:19 -04:00
}
#endif