Set bounding box on manual objects rather than creating meshes.

loadfix
cc9cii 10 years ago
parent f459adf117
commit 47c5bc9a19

@ -12,7 +12,6 @@
#include <OgreOverlayManager.h>
#include <OgreRoot.h>
#include <OgreSceneQuery.h>
#include <OgreEntity.h>
#include <components/esm/loadland.hpp>
#include "textoverlay.hpp"
@ -53,13 +52,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
mTextOverlays.erase(itOverlay);
}
// destroy manual objects and entities
std::map<CSMWorld::CellCoordinates, Ogre::Entity *>::iterator itEntity = mEntities.find(iter->first);
if(itEntity != mEntities.end())
{
getSceneManager()->destroyEntity(itEntity->second);
mEntities.erase(itEntity);
}
// destroy manual objects
getSceneManager()->destroyManualObject("manual"+iter->first.getId(mWorldspace));
iter++;
@ -143,16 +136,18 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2,
height+2000); // FIXME: config setting
manual->end();
Ogre::MeshPtr meshPtr = manual->convertToMesh("vLine" + iter->getId(mWorldspace));
Ogre::Entity* entity = getSceneManager()->createEntity(meshPtr);
getSceneManager()->getRootSceneNode()->createChildSceneNode()->attachObject(entity);
entity->setVisible(false);
// keep pointers so that they can be deleted later
mEntities.insert(std::make_pair(*iter, entity));
manual->setBoundingBox(Ogre::AxisAlignedBox(
ESM::Land::REAL_SIZE * iter->getX() + ESM::Land::REAL_SIZE/2,
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2,
height,
ESM::Land::REAL_SIZE * iter->getX() + ESM::Land::REAL_SIZE/2,
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2,
height+2000));
getSceneManager()->getRootSceneNode()->createChildSceneNode()->attachObject(manual);
manual->setVisible(false);
CSVRender::TextOverlay *textDisp =
new CSVRender::TextOverlay(entity, getCamera(), iter->getId(mWorldspace));
new CSVRender::TextOverlay(manual, getCamera(), iter->getId(mWorldspace));
textDisp->enable(true);
textDisp->setCaption(iter->getId(mWorldspace));
std::string desc = cells.getRecord(index).get().mName;
@ -317,13 +312,6 @@ CSVRender::PagedWorldspaceWidget::~PagedWorldspaceWidget()
getSceneManager()->destroyManualObject("manual"+iter->first.getId(mWorldspace));
}
for (std::map<CSMWorld::CellCoordinates, Ogre::Entity *>::iterator iter (mEntities.begin());
iter != mEntities.end(); ++iter)
{
getSceneManager()->destroyEntity(iter->second);
mEntities.erase(iter);
}
for (std::map<CSMWorld::CellCoordinates, TextOverlay *>::iterator iter (mTextOverlays.begin());
iter != mTextOverlays.end(); ++iter)
{

@ -24,7 +24,6 @@ namespace CSVRender
CSVWidget::SceneToolToggle *mControlElements;
bool mDisplayCellCoord;
std::map<CSMWorld::CellCoordinates, TextOverlay *> mTextOverlays;
std::map<CSMWorld::CellCoordinates, Ogre::Entity*> mEntities;
private:

Loading…
Cancel
Save