1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-29 08:15:35 +00:00

temporarily removed statics from raycast test (makes object activation easier by removing inactive obstacles, that overlap the AABB of the object)

This commit is contained in:
Marc Zinnschlag 2010-08-25 09:19:15 +02:00
parent 9e8251e6b4
commit bdb5749b57
3 changed files with 18 additions and 6 deletions

View file

@ -9,6 +9,10 @@
#include "OgreCamera.h"
#include "OgreTextureManager.h"
#include "../mwworld/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwworld/ptr.hpp"
#include <components/esm/loadstat.hpp>
using namespace MWRender;
using namespace Ogre;
@ -36,7 +40,7 @@ MWScene::MWScene(OEngine::Render::OgreRenderer &_rend)
mRaySceneQuery = rend.getScene()->createRayQuery(Ray());
}
std::pair<std::string, float> MWScene::getFacedHandle()
std::pair<std::string, float> MWScene::getFacedHandle (MWWorld::World& world)
{
std::string handle = "";
float distance = -1;
@ -57,10 +61,14 @@ std::pair<std::string, float> MWScene::getFacedHandle()
{
// there seem to be omnipresent objects like the caelum sky dom,
// the distance of these objects is always 0 so this if excludes these
// TODO: Check if the object can be focused (ignore walls etc..
// in this state of openmw not possible)
if ( itr->movable && itr->distance >= 0.1)
{
// horrible hack to exclude statics. this must be removed as soon as a replacement for the
// AABB raycasting is implemented (we should not ignore statics)
MWWorld::Ptr ptr = world.getPtrViaHandle (itr->movable->getParentSceneNode()->getName());
if (ptr.getType()==typeid (ESM::Static))
break;
if ( nearest == result.end() ) //if no object is set
{
nearest = itr;
@ -80,4 +88,3 @@ std::pair<std::string, float> MWScene::getFacedHandle()
return std::pair<std::string, float>(handle, distance);
}

View file

@ -13,6 +13,11 @@ namespace Ogre
class RaySceneQuery;
}
namespace MWWorld
{
class World;
}
namespace MWRender
{
/** Class responsible for Morrowind-specific interfaces to OGRE.
@ -43,7 +48,7 @@ namespace MWRender
//pair<name, distance>
//name is empty and distance = -1 if there is no object which
//can be faced
std::pair<std::string, float> getFacedHandle();
std::pair<std::string, float> getFacedHandle (MWWorld::World& world);
};
}

View file

@ -648,7 +648,7 @@ namespace MWWorld
std::string World::getFacedHandle()
{
std::pair<std::string, float> result = mScene.getFacedHandle();
std::pair<std::string, float> result = mScene.getFacedHandle (*this);
if (result.first.empty() ||
result.second>getStore().gameSettings.find ("iMaxActivateDist")->i)