|
|
|
@ -61,7 +61,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
|
|
|
|
|
|
|
|
|
|
CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
|
|
|
|
const std::string& id, boost::shared_ptr<CSVWorld::PhysicsSystem> physics, const Ogre::Vector3& origin)
|
|
|
|
|
: mData (data), mId (Misc::StringUtils::lowerCase (id)), mSceneMgr(sceneManager), mPhysics(physics)
|
|
|
|
|
: mData (data), mId (Misc::StringUtils::lowerCase (id)), mSceneMgr(sceneManager), mPhysics(physics), mX(0), mY(0)
|
|
|
|
|
{
|
|
|
|
|
mCellNode = sceneManager->getRootSceneNode()->createChildSceneNode();
|
|
|
|
|
mCellNode->setPosition (origin);
|
|
|
|
@ -76,16 +76,15 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
|
|
|
|
const CSMWorld::IdCollection<CSMWorld::Land>& land = mData.getLand();
|
|
|
|
|
int landIndex = land.searchId(mId);
|
|
|
|
|
if (landIndex != -1)
|
|
|
|
|
{
|
|
|
|
|
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
|
|
|
|
|
if(esmLand)
|
|
|
|
|
{
|
|
|
|
|
mTerrain.reset(new Terrain::TerrainGrid(sceneManager, new TerrainStorage(mData), Element_Terrain, true,
|
|
|
|
|
Terrain::Align_XY));
|
|
|
|
|
|
|
|
|
|
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
|
|
|
|
|
mTerrain->loadCell(esmLand->mX,
|
|
|
|
|
esmLand->mY);
|
|
|
|
|
|
|
|
|
|
if(esmLand)
|
|
|
|
|
{
|
|
|
|
|
float verts = ESM::Land::LAND_SIZE;
|
|
|
|
|
float worldsize = ESM::Land::REAL_SIZE;
|
|
|
|
|
mX = esmLand->mX;
|
|
|
|
@ -98,6 +97,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, Ogre::SceneManager *sceneManager,
|
|
|
|
|
|
|
|
|
|
CSVRender::Cell::~Cell()
|
|
|
|
|
{
|
|
|
|
|
if (mTerrain.get())
|
|
|
|
|
mPhysics->removeHeightField(mSceneMgr, mX, mY);
|
|
|
|
|
|
|
|
|
|
for (std::map<std::string, Object *>::iterator iter (mObjects.begin());
|
|
|
|
|