mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 21:45:33 +00:00
Set bounding box on manual objects rather than creating meshes.
This commit is contained in:
parent
f459adf117
commit
47c5bc9a19
2 changed files with 11 additions and 24 deletions
|
@ -12,7 +12,6 @@
|
||||||
#include <OgreOverlayManager.h>
|
#include <OgreOverlayManager.h>
|
||||||
#include <OgreRoot.h>
|
#include <OgreRoot.h>
|
||||||
#include <OgreSceneQuery.h>
|
#include <OgreSceneQuery.h>
|
||||||
#include <OgreEntity.h>
|
|
||||||
|
|
||||||
#include <components/esm/loadland.hpp>
|
#include <components/esm/loadland.hpp>
|
||||||
#include "textoverlay.hpp"
|
#include "textoverlay.hpp"
|
||||||
|
@ -53,13 +52,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
|
||||||
mTextOverlays.erase(itOverlay);
|
mTextOverlays.erase(itOverlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
// destroy manual objects and entities
|
// destroy manual objects
|
||||||
std::map<CSMWorld::CellCoordinates, Ogre::Entity *>::iterator itEntity = mEntities.find(iter->first);
|
|
||||||
if(itEntity != mEntities.end())
|
|
||||||
{
|
|
||||||
getSceneManager()->destroyEntity(itEntity->second);
|
|
||||||
mEntities.erase(itEntity);
|
|
||||||
}
|
|
||||||
getSceneManager()->destroyManualObject("manual"+iter->first.getId(mWorldspace));
|
getSceneManager()->destroyManualObject("manual"+iter->first.getId(mWorldspace));
|
||||||
|
|
||||||
iter++;
|
iter++;
|
||||||
|
@ -143,16 +136,18 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells()
|
||||||
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2,
|
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2,
|
||||||
height+2000); // FIXME: config setting
|
height+2000); // FIXME: config setting
|
||||||
manual->end();
|
manual->end();
|
||||||
Ogre::MeshPtr meshPtr = manual->convertToMesh("vLine" + iter->getId(mWorldspace));
|
manual->setBoundingBox(Ogre::AxisAlignedBox(
|
||||||
Ogre::Entity* entity = getSceneManager()->createEntity(meshPtr);
|
ESM::Land::REAL_SIZE * iter->getX() + ESM::Land::REAL_SIZE/2,
|
||||||
getSceneManager()->getRootSceneNode()->createChildSceneNode()->attachObject(entity);
|
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2,
|
||||||
entity->setVisible(false);
|
height,
|
||||||
|
ESM::Land::REAL_SIZE * iter->getX() + ESM::Land::REAL_SIZE/2,
|
||||||
// keep pointers so that they can be deleted later
|
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2,
|
||||||
mEntities.insert(std::make_pair(*iter, entity));
|
height+2000));
|
||||||
|
getSceneManager()->getRootSceneNode()->createChildSceneNode()->attachObject(manual);
|
||||||
|
manual->setVisible(false);
|
||||||
|
|
||||||
CSVRender::TextOverlay *textDisp =
|
CSVRender::TextOverlay *textDisp =
|
||||||
new CSVRender::TextOverlay(entity, getCamera(), iter->getId(mWorldspace));
|
new CSVRender::TextOverlay(manual, getCamera(), iter->getId(mWorldspace));
|
||||||
textDisp->enable(true);
|
textDisp->enable(true);
|
||||||
textDisp->setCaption(iter->getId(mWorldspace));
|
textDisp->setCaption(iter->getId(mWorldspace));
|
||||||
std::string desc = cells.getRecord(index).get().mName;
|
std::string desc = cells.getRecord(index).get().mName;
|
||||||
|
@ -317,13 +312,6 @@ CSVRender::PagedWorldspaceWidget::~PagedWorldspaceWidget()
|
||||||
getSceneManager()->destroyManualObject("manual"+iter->first.getId(mWorldspace));
|
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());
|
for (std::map<CSMWorld::CellCoordinates, TextOverlay *>::iterator iter (mTextOverlays.begin());
|
||||||
iter != mTextOverlays.end(); ++iter)
|
iter != mTextOverlays.end(); ++iter)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@ namespace CSVRender
|
||||||
CSVWidget::SceneToolToggle *mControlElements;
|
CSVWidget::SceneToolToggle *mControlElements;
|
||||||
bool mDisplayCellCoord;
|
bool mDisplayCellCoord;
|
||||||
std::map<CSMWorld::CellCoordinates, TextOverlay *> mTextOverlays;
|
std::map<CSMWorld::CellCoordinates, TextOverlay *> mTextOverlays;
|
||||||
std::map<CSMWorld::CellCoordinates, Ogre::Entity*> mEntities;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue