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

156 lines
4.4 KiB
C++
Raw Normal View History

2011-10-20 19:02:19 +00:00
#ifndef _GAME_RENDERING_MANAGER_H
#define _GAME_RENDERING_MANAGER_H
#include "sky.hpp"
2011-10-30 04:25:29 +00:00
#include "debugging.hpp"
2011-11-12 05:19:22 +00:00
2011-11-16 21:22:13 +00:00
#include "../mwworld/class.hpp"
2011-10-20 19:02:19 +00:00
#include <utility>
2011-10-20 19:02:19 +00:00
#include <openengine/ogre/renderer.hpp>
#include <openengine/ogre/fader.hpp>
2011-10-20 19:02:19 +00:00
#include <openengine/bullet/physic.hpp>
#include <vector>
#include <string>
#include "../mwworld/ptr.hpp"
2011-10-20 19:02:19 +00:00
#include <boost/filesystem.hpp>
2011-11-12 05:19:22 +00:00
#include "renderinginterface.hpp"
2011-11-12 20:58:22 +00:00
#include "objects.hpp"
#include "actors.hpp"
2011-11-12 20:58:22 +00:00
#include "player.hpp"
2011-10-20 19:02:19 +00:00
namespace Ogre
{
class Camera;
class Viewport;
class SceneManager;
class SceneNode;
class RaySceneQuery;
class Quaternion;
class Vector3;
}
namespace MWWorld
2011-10-20 19:02:19 +00:00
{
class World;
}
2011-10-20 19:02:19 +00:00
namespace MWRender
{
2011-11-12 20:58:22 +00:00
2011-10-22 04:15:15 +00:00
2011-11-01 03:59:16 +00:00
class RenderingManager: private RenderingInterface {
private:
virtual MWRender::Objects& getObjects();
virtual MWRender::Actors& getActors();
2011-10-20 19:02:19 +00:00
public:
2011-12-09 05:08:30 +00:00
RenderingManager(OEngine::Render::OgreRenderer& _rend, const boost::filesystem::path& resDir, OEngine::Physic::PhysicEngine* engine, MWWorld::Environment& environment);
2011-11-12 20:58:22 +00:00
virtual ~RenderingManager();
2011-11-04 03:47:15 +00:00
virtual MWRender::Player& getPlayer(); /// \todo move this to private again as soon as
/// MWWorld::Player has been rewritten to not need access
/// to internal details of the rendering system anymore
SkyManager* getSkyManager();
void toggleLight();
bool toggleRenderMode(int mode);
OEngine::Render::Fader* getFader();
void removeCell (MWWorld::Ptr::CellStore *store);
/// \todo this function should be removed later. Instead the rendering subsystems should track
/// when rebatching is needed and update automatically at the end of each frame.
void cellAdded (MWWorld::Ptr::CellStore *store);
2011-10-20 19:02:19 +00:00
2011-11-11 05:20:53 +00:00
void addObject (const MWWorld::Ptr& ptr);
void removeObject (const MWWorld::Ptr& ptr);
2011-10-20 19:02:19 +00:00
void moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position);
void scaleObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& scale);
void rotateObject (const MWWorld::Ptr& ptr, const::Ogre::Quaternion& orientation);
2011-11-11 05:20:53 +00:00
/// \param store Cell the object was in previously (\a ptr has already been updated to the new cell).
2011-10-20 19:02:19 +00:00
void moveObjectToCell (const MWWorld::Ptr& ptr, const Ogre::Vector3& position, MWWorld::Ptr::CellStore *store);
2011-10-20 19:02:19 +00:00
void update (float duration);
void setAmbientColour(const Ogre::ColourValue& colour);
void setSunColour(const Ogre::ColourValue& colour);
void setSunDirection(const Ogre::Vector3& direction);
void sunEnable();
void sunDisable();
void setGlare(bool glare);
2011-10-20 19:02:19 +00:00
void skyEnable ();
void skyDisable ();
void skySetHour (double hour);
void skySetDate (int day, int month);
int skyGetMasserPhase() const;
int skyGetSecundaPhase() const;
void skySetMoonColour (bool red);
void configureAmbient(ESMS::CellStore<MWWorld::RefData> &mCell);
2012-02-26 12:13:29 +00:00
/// configure fog according to cell
2011-11-04 03:47:15 +00:00
void configureFog(ESMS::CellStore<MWWorld::RefData> &mCell);
2012-02-26 12:13:29 +00:00
/// configure fog manually
void configureFog(const float density, const Ogre::ColourValue& colour);
void playAnimationGroup (const MWWorld::Ptr& ptr, const std::string& groupName, int mode,
int number = 1);
///< Run animation for a MW-reference. Calls to this function for references that are currently not
/// in the rendered scene should be ignored.
///
/// \param mode: 0 normal, 1 immediate start, 2 immediate loop
/// \param number How offen the animation should be run
void skipAnimation (const MWWorld::Ptr& ptr);
///< Skip the animation for the given MW-reference for one frame. Calls to this function for
/// references that are currently not in the rendered scene should be ignored.
private:
2011-11-04 03:47:15 +00:00
void setAmbientMode();
2011-10-20 19:02:19 +00:00
SkyManager* mSkyManager;
2011-11-22 07:39:28 +00:00
OEngine::Render::OgreRenderer &mRendering;
2011-11-22 07:39:28 +00:00
MWRender::Objects mObjects;
MWRender::Actors mActors;
2011-11-02 04:13:33 +00:00
// 0 normal, 1 more bright, 2 max
2011-11-04 03:47:15 +00:00
int mAmbientMode;
Ogre::ColourValue mAmbientColor;
2012-02-07 23:32:22 +00:00
Ogre::Light* mSun;
2011-11-04 03:47:15 +00:00
/// Root node for all objects added to the scene. This is rotated so
/// that the OGRE coordinate system matches that used internally in
/// Morrowind.
2011-11-22 07:39:28 +00:00
Ogre::SceneNode *mMwRoot;
Ogre::RaySceneQuery *mRaySceneQuery;
2011-11-02 04:13:33 +00:00
2011-11-22 07:39:28 +00:00
OEngine::Physic::PhysicEngine* mPhysicsEngine;
2011-11-02 04:13:33 +00:00
MWRender::Player *mPlayer;
MWRender::Debugging mDebugging;
2011-10-20 19:02:19 +00:00
};
}
#endif