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

134 lines
4.1 KiB
C++
Raw Normal View History

2010-06-12 11:01:20 +00:00
#ifndef _GAME_RENDER_INTERIOR_H
#define _GAME_RENDER_INTERIOR_H
#include "cell.hpp"
#include "cellimp.hpp"
2011-08-01 13:55:36 +00:00
#include "../mwworld/physicssystem.hpp"
2010-06-12 12:45:54 +00:00
#include "OgreColourValue.h"
2010-11-25 20:44:56 +00:00
#include <OgreSceneNode.h>
2010-06-12 12:45:54 +00:00
namespace Ogre
{
class SceneNode;
}
2010-06-12 11:01:20 +00:00
namespace MWWorld
{
class Environment;
}
2010-06-12 11:01:20 +00:00
namespace MWRender
{
class RenderingManager;
2010-06-12 11:01:20 +00:00
/**
This class is responsible for inserting meshes and other
rendering objects from the given cell into the given rendering
scene.
*/
class InteriorCellRender : public CellRender, private CellRenderImp
2010-06-12 11:01:20 +00:00
{
2011-01-05 21:18:21 +00:00
//static bool isChest;
2010-06-15 07:30:24 +00:00
static bool lightConst;
static float lightConstValue;
static bool lightLinear;
static int lightLinearMethod;
static float lightLinearValue;
static float lightLinearRadiusMult;
static bool lightQuadratic;
static int lightQuadraticMethod;
static float lightQuadraticValue;
static float lightQuadraticRadiusMult;
static bool lightOutQuadInLin;
2010-07-03 13:41:20 +00:00
ESMS::CellStore<MWWorld::RefData> &cell;
MWWorld::Environment &mEnvironment;
OEngine::Render::OgreRenderer& mRenderer;
Ogre::SceneNode *mMwRoot;
2011-08-01 13:55:36 +00:00
MWWorld::PhysicsSystem *mPhysics;
2010-06-12 11:01:20 +00:00
/// The scene node that contains all objects belonging to this
/// cell.
Ogre::SceneNode *base;
2010-06-12 11:01:20 +00:00
Ogre::SceneNode *insert;
std::string mInsertMesh;
2011-01-05 21:18:21 +00:00
Ogre::SceneNode *npcPart;
2010-06-12 11:01:20 +00:00
2010-06-12 12:45:54 +00:00
// 0 normal, 1 more bright, 2 max
int ambientMode;
2010-06-12 12:45:54 +00:00
Ogre::ColourValue ambientColor;
2010-06-12 11:01:20 +00:00
/// start inserting a new reference.
virtual void insertBegin (ESM::CellRef &ref, MWWorld::RefData& refData, bool static_ = false);
2011-01-05 21:18:21 +00:00
virtual void rotateMesh(Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName[], int elements);
virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
2010-06-12 11:01:20 +00:00
/// insert a mesh related to the most recent insertBegin call.
virtual void insertMesh(const std::string &mesh);
2011-01-05 21:18:21 +00:00
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements);
virtual void insertMesh(const std::string &mesh, Ogre::Vector3 vec, Ogre::Vector3 axis, Ogre::Radian angle, std::string sceneNodeName, std::string sceneParent[], int elements, bool translateFirst);
virtual void insertObjectPhysics();
virtual void insertActorPhysics();
/// insert a light related to the most recent insertBegin call.
virtual void insertLight(float r, float g, float b, float radius);
2010-06-12 11:01:20 +00:00
/// finish inserting a new reference and return a handle to it.
2010-07-09 14:07:03 +00:00
virtual std::string insertEnd (bool Enable);
2010-06-12 12:45:54 +00:00
/// configure lighting according to cell
void configureAmbient();
2010-06-12 12:45:54 +00:00
/// configure fog according to cell
void configureFog();
2010-06-12 12:45:54 +00:00
void setAmbientMode();
2010-11-25 20:44:56 +00:00
2010-06-12 11:01:20 +00:00
public:
InteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
OEngine::Render::OgreRenderer& renderer, Ogre::SceneNode *mwRoot, MWWorld::PhysicsSystem *physics)
: cell(_cell), mEnvironment (environment), mRenderer(renderer), base(NULL), insert(NULL), ambientMode (0)
2011-08-01 13:55:36 +00:00
{
mMwRoot = mwRoot;
2011-08-01 13:55:36 +00:00
mPhysics = physics;
}
2010-06-12 11:01:20 +00:00
virtual ~InteriorCellRender() { destroy(); }
2010-06-12 11:01:20 +00:00
/// Make the cell visible. Load the cell if necessary.
2011-01-05 21:18:21 +00:00
//virtual void scaleMesh(Ogre::Vector3 axis, std::string sceneNodeName[], int elements);
virtual void show();
2010-06-12 11:01:20 +00:00
/// Remove the cell from rendering, but don't remove it from
/// memory.
2010-07-09 14:07:03 +00:00
virtual void hide();
2010-06-12 11:01:20 +00:00
/// Destroy all rendering objects connected with this cell.
2010-07-22 10:29:23 +00:00
virtual void destroy(); // comment by Zini: shouldn't this go into the destructor?
2010-06-12 12:45:54 +00:00
/// Switch through lighting modes.
void toggleLight();
2010-07-09 14:07:03 +00:00
/// Make the reference with the given handle visible.
virtual void enable (const std::string& handle);
2010-08-07 18:25:17 +00:00
2010-07-09 14:07:03 +00:00
/// Make the reference with the given handle invisible.
2010-08-07 18:25:17 +00:00
virtual void disable (const std::string& handle);
/// Remove the reference with the given handle permanently from the scene.
virtual void deleteObject (const std::string& handle);
2010-06-12 11:01:20 +00:00
};
}
#endif