2011-11-12 15:58:22 -05:00
|
|
|
#ifndef _GAME_RENDER_OBJECTS_H
|
|
|
|
#define _GAME_RENDER_OBJECTS_H
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
#include <OgreColourValue.h>
|
2013-02-06 21:47:09 -08:00
|
|
|
#include <OgreAxisAlignedBox.h>
|
2012-07-03 13:55:53 +02:00
|
|
|
|
2012-02-06 10:29:18 +01:00
|
|
|
#include <openengine/ogre/renderer.hpp>
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
class CellStore;
|
|
|
|
}
|
2011-10-31 23:59:16 -04:00
|
|
|
|
|
|
|
namespace MWRender{
|
2011-11-07 23:35:39 -05:00
|
|
|
|
2013-08-06 19:45:07 -07:00
|
|
|
class ObjectAnimation;
|
|
|
|
|
2011-10-31 23:59:16 -04:00
|
|
|
class Objects{
|
2013-08-06 19:45:07 -07:00
|
|
|
typedef std::map<MWWorld::Ptr,ObjectAnimation*> PtrAnimationMap;
|
|
|
|
|
2012-02-06 10:41:13 +01:00
|
|
|
OEngine::Render::OgreRenderer &mRenderer;
|
2013-08-06 19:45:07 -07:00
|
|
|
|
|
|
|
std::map<MWWorld::CellStore*,Ogre::SceneNode*> mCellSceneNodes;
|
|
|
|
std::map<MWWorld::CellStore*,Ogre::StaticGeometry*> mStaticGeometry;
|
|
|
|
std::map<MWWorld::CellStore*,Ogre::StaticGeometry*> mStaticGeometrySmall;
|
|
|
|
std::map<MWWorld::CellStore*,Ogre::AxisAlignedBox> mBounds;
|
|
|
|
PtrAnimationMap mObjects;
|
|
|
|
|
2013-02-26 14:01:10 +01:00
|
|
|
Ogre::SceneNode* mRootNode;
|
2013-08-07 03:02:27 -07:00
|
|
|
|
2011-11-04 21:57:39 -04:00
|
|
|
static int uniqueID;
|
2013-08-06 19:45:07 -07:00
|
|
|
|
2011-10-31 23:59:16 -04:00
|
|
|
public:
|
2013-08-07 01:31:01 -07:00
|
|
|
Objects(OEngine::Render::OgreRenderer &renderer)
|
|
|
|
: mRenderer(renderer)
|
2013-07-31 18:46:32 +02:00
|
|
|
, mRootNode(NULL)
|
|
|
|
{}
|
2011-10-31 23:59:16 -04:00
|
|
|
~Objects(){}
|
2013-08-07 03:02:27 -07:00
|
|
|
void insertBegin (const MWWorld::Ptr& ptr);
|
2013-08-06 19:45:07 -07:00
|
|
|
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
2011-11-21 12:52:28 +01:00
|
|
|
|
2012-04-02 19:37:24 +02:00
|
|
|
void enableLights();
|
|
|
|
void disableLights();
|
|
|
|
|
2012-04-19 20:59:57 +02:00
|
|
|
void update (const float dt);
|
|
|
|
///< per-frame update
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
Ogre::AxisAlignedBox getDimensions(MWWorld::CellStore*);
|
2012-03-10 15:28:18 +01:00
|
|
|
///< get a bounding box that encloses all objects in the specified cell
|
|
|
|
|
2011-11-21 12:52:28 +01:00
|
|
|
bool deleteObject (const MWWorld::Ptr& ptr);
|
|
|
|
///< \return found?
|
|
|
|
|
2012-07-03 13:55:53 +02:00
|
|
|
void removeCell(MWWorld::CellStore* store);
|
|
|
|
void buildStaticGeometry(MWWorld::CellStore &cell);
|
2013-02-26 14:01:10 +01:00
|
|
|
void setRootNode(Ogre::SceneNode* root);
|
2012-07-11 02:31:03 +02:00
|
|
|
|
|
|
|
void rebuildStaticGeometry();
|
2012-07-30 23:28:14 +04:00
|
|
|
|
2012-07-31 16:52:21 +04:00
|
|
|
/// Updates containing cell for object rendering data
|
2013-02-24 14:59:21 +04:00
|
|
|
void updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur);
|
2011-10-31 23:59:16 -04:00
|
|
|
};
|
2011-11-12 15:58:22 -05:00
|
|
|
}
|
2011-11-21 12:52:28 +01:00
|
|
|
#endif
|