Remove a redundant list.

loadfix
cc9cii 10 years ago
parent 7f54dab6ef
commit 49d416353e

@ -333,6 +333,7 @@ namespace CSVRender
//plane X, upvector Y, mOffset x : x-z plane, wheel closer/further
std::pair<Ogre::Vector3, Ogre::Vector3> MouseState::planeAxis()
{
// FIXME: explore using signals instread of retrieving each time
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
QString coord = userSettings.setting("debug/mouse-reference", QString("screen"));
Ogre::Vector3 dir = getCamera()->getDerivedDirection();

@ -74,7 +74,6 @@ namespace CSVWorld
throw std::runtime_error("No physics system found for the given document.");
}
// delete physics when the last scene widget for the document is closed
void PhysicsManager::removeSceneWidget(CSVRender::WorldspaceWidget *widget)
{
CSVRender::SceneWidget *sceneWidget = static_cast<CSVRender::SceneWidget *>(widget);

@ -37,13 +37,13 @@ namespace CSVWorld
const Ogre::Vector3 &position, const Ogre::Quaternion &rotation, bool placeable)
{
bool foundSceneManager = false;
std::list<Ogre::SceneManager *>::const_iterator iter = mSceneManagers.begin();
for(; iter != mSceneManagers.end(); ++iter)
std::map<Ogre::SceneManager *, CSVRender::SceneWidget *>::const_iterator iter = mSceneWidgets.begin();
for(; iter != mSceneWidgets.end(); ++iter)
{
if((*iter)->hasSceneNode(sceneNodeName))
if((*iter).first->hasSceneNode(sceneNodeName))
{
mSceneNodeToRefId[sceneNodeName] = referenceId;
mRefIdToSceneNode[referenceId][*iter] = sceneNodeName;
mRefIdToSceneNode[referenceId][(*iter).first] = sceneNodeName;
mSceneNodeToMesh[sceneNodeName] = mesh;
foundSceneManager = true;
break;
@ -54,7 +54,6 @@ namespace CSVWorld
{
std::cerr << "Attempt to add an object without a corresponding SceneManager: "
+ referenceId + " : " + sceneNodeName << std::endl;
return;
}
@ -67,19 +66,6 @@ namespace CSVWorld
0, // boxRotation
true, // raycasting
placeable);
// update other scene managers if they have the referenceId (may have moved)
// NOTE: this part is not needed if object has not moved
iter = mSceneManagers.begin();
for(; iter != mSceneManagers.end(); ++iter)
{
std::string name = refIdToSceneNode(referenceId, *iter);
if(name != sceneNodeName && (*iter)->hasSceneNode(name))
{
// FIXME: rotation or scale not updated
(*iter)->getSceneNode(name)->setPosition(position);
}
}
}
}
@ -96,12 +82,12 @@ namespace CSVWorld
// find which SceneManager has this object
Ogre::SceneManager *sceneManager = NULL;
std::list<Ogre::SceneManager *>::const_iterator iter = mSceneManagers.begin();
for(; iter != mSceneManagers.end(); ++iter)
std::map<Ogre::SceneManager *, CSVRender::SceneWidget *>::const_iterator iter = mSceneWidgets.begin();
for(; iter != mSceneWidgets.end(); ++iter)
{
if((*iter)->hasSceneNode(sceneNodeName))
if((*iter).first->hasSceneNode(sceneNodeName))
{
sceneManager = *iter;
sceneManager = (*iter).first;
break;
}
}
@ -110,7 +96,6 @@ namespace CSVWorld
{
std::cerr << "Attempt to remove an object without a corresponding SceneManager: "
+ sceneNodeName << std::endl;
return;
}
@ -167,16 +152,8 @@ namespace CSVWorld
placeable);
// update other scene managers if they have the referenceId
std::list<Ogre::SceneManager *>::const_iterator iter = mSceneManagers.begin();
for(; iter != mSceneManagers.end(); ++iter)
{
std::string name = refIdToSceneNode(referenceId, *iter);
if(name != sceneNodeName && (*iter)->hasSceneNode(name))
{
// FIXME: rotation or scale not updated
(*iter)->getSceneNode(name)->setPosition(position);
}
}
// FIXME: rotation or scale not updated
moveSceneNodeImpl(sceneNodeName, referenceId, position);
}
}
@ -190,13 +167,13 @@ namespace CSVWorld
void PhysicsSystem::moveSceneNodeImpl(const std::string sceneNodeName,
const std::string referenceId, const Ogre::Vector3 &position)
{
std::list<Ogre::SceneManager *>::const_iterator iter = mSceneManagers.begin();
for(; iter != mSceneManagers.end(); ++iter)
std::map<Ogre::SceneManager *, CSVRender::SceneWidget *>::const_iterator iter = mSceneWidgets.begin();
for(; iter != mSceneWidgets.end(); ++iter)
{
std::string name = refIdToSceneNode(referenceId, *iter);
if(name != sceneNodeName && (*iter)->hasSceneNode(name))
std::string name = refIdToSceneNode(referenceId, (*iter).first);
if(name != sceneNodeName && (*iter).first->hasSceneNode(name))
{
(*iter)->getSceneNode(name)->setPosition(position);
(*iter).first->getSceneNode(name)->setPosition(position);
}
}
}
@ -301,7 +278,6 @@ namespace CSVWorld
void PhysicsSystem::addSceneManager(Ogre::SceneManager *sceneMgr, CSVRender::SceneWidget * sceneWidget)
{
mSceneManagers.push_back(sceneMgr);
mSceneWidgets[sceneMgr] = sceneWidget;
}
@ -312,15 +288,6 @@ namespace CSVWorld
void PhysicsSystem::removeSceneManager(Ogre::SceneManager *sceneMgr)
{
std::list<Ogre::SceneManager *>::iterator iter = mSceneManagers.begin();
for(; iter != mSceneManagers.end(); ++iter)
{
if(*iter == sceneMgr)
{
mSceneManagers.erase(iter);
break;
}
}
mSceneWidgets.erase(sceneMgr);
}

@ -3,7 +3,6 @@
#include <string>
#include <map>
#include <list>
namespace Ogre
{
@ -33,7 +32,6 @@ namespace CSVWorld
std::map<std::string, std::string> mSceneNodeToRefId;
std::map<std::string, std::map<Ogre::SceneManager *, std::string> > mRefIdToSceneNode;
std::map<std::string, std::string> mSceneNodeToMesh;
std::list<Ogre::SceneManager *> mSceneManagers;
std::map<Ogre::SceneManager*, CSVRender::SceneWidget *> mSceneWidgets;
OEngine::Physic::PhysicEngine* mEngine;
std::multimap<std::string, Ogre::SceneManager *> mTerrain;

Loading…
Cancel
Save