1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-04 11:15:32 +00:00
openmw-tes3mp/apps/opencs/view/render/cell.hpp

117 lines
3.7 KiB
C++
Raw Normal View History

2014-06-29 12:18:46 +00:00
#ifndef OPENCS_VIEW_CELL_H
#define OPENCS_VIEW_CELL_H
#include <string>
#include <map>
2014-11-05 18:45:32 +00:00
#include <memory>
2014-06-29 12:18:46 +00:00
#include <OgreVector3.h>
#include <components/terrain/terraingrid.hpp>
#include <components/esm/loadpgrd.hpp> // FIXME: temporaty storage until saving to document
2014-06-29 12:18:46 +00:00
#include "object.hpp"
class QModelIndex;
namespace Ogre
{
class SceneManager;
class SceneNode;
class ManualObject;
2014-06-29 12:18:46 +00:00
}
namespace CSMWorld
{
class Data;
class Pathgrid;
2014-06-29 12:18:46 +00:00
}
2014-11-01 07:57:39 +00:00
namespace CSVWorld
{
class PhysicsSystem;
}
2014-06-29 12:18:46 +00:00
namespace CSVRender
{
class PathgridPoint;
2014-06-29 12:18:46 +00:00
class Cell
{
CSMWorld::Data& mData;
std::string mId;
Ogre::SceneNode *mCellNode;
std::map<std::string, Object *> mObjects;
std::map<std::string, PathgridPoint *> mPgPoints;
std::map<std::pair<int, int>, std::string> mPgEdges;
ESM::Pathgrid::PointList mPoints; // FIXME: temporary storage until saving to document
ESM::Pathgrid::EdgeList mEdges; // FIXME: temporary storage until saving to document
std::string mPathgridId; // FIXME: temporary storage until saving to document
std::auto_ptr<Terrain::TerrainGrid> mTerrain;
2014-11-01 07:57:39 +00:00
CSVWorld::PhysicsSystem *mPhysics;
Ogre::SceneManager *mSceneMgr;
2014-11-01 07:57:39 +00:00
int mX;
int mY;
2014-06-29 12:18:46 +00:00
/// Ignored if cell does not have an object with the given ID.
///
/// \return Was the object deleted?
bool removeObject (const std::string& id);
/// Add objects from reference table that are within this cell.
///
/// \return Have any objects been added?
bool addObjects (int start, int end);
public:
2014-11-01 07:57:39 +00:00
Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager, const std::string& id,
CSVWorld::PhysicsSystem *physics, const Ogre::Vector3& origin = Ogre::Vector3 (0, 0, 0));
2014-06-29 12:18:46 +00:00
~Cell();
/// \return Did this call result in a modification of the visual representation of
/// this cell?
bool referenceableDataChanged (const QModelIndex& topLeft,
const QModelIndex& bottomRight);
/// \return Did this call result in a modification of the visual representation of
/// this cell?
bool referenceableAboutToBeRemoved (const QModelIndex& parent, int start, int end);
/// \return Did this call result in a modification of the visual representation of
/// this cell?
bool referenceDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
/// \return Did this call result in a modification of the visual representation of
/// this cell?
bool referenceAboutToBeRemoved (const QModelIndex& parent, int start, int end);
/// \return Did this call result in a modification of the visual representation of
/// this cell?
bool referenceAdded (const QModelIndex& parent, int start, int end);
float getTerrainHeightAt(const Ogre::Vector3 &pos) const;
void pathgridPointAdded(const Ogre::Vector3 &pos);
void pathgridPointMoved(const std::string &name, const Ogre::Vector3 &newPos);
void pathgridPointRemoved(const std::string &name);
private:
// for drawing pathgrid points & lines
void createGridMaterials();
void destroyGridMaterials();
void loadPathgrid();
Ogre::ManualObject *createPathgridEdge(const std::string &name,
const Ogre::Vector3 &start, const Ogre::Vector3 &end);
void addPathgridEdge();
void removePathgridEdge();
2014-06-29 12:18:46 +00:00
};
}
#endif