Merge remote-tracking branch 'scrawl/raycast'

actorid
Marc Zinnschlag 12 years ago
commit a0022e711b

@ -884,13 +884,6 @@ void RenderingManager::renderPlayer(const MWWorld::Ptr &ptr)
MWBase::Environment::get().getWorld()->scaleObject(ptr, 1.f);
}
void RenderingManager::getCameraData(Ogre::Vector3 &eyepos, float &pitch, float &yaw)
{
eyepos = mCamera->getPosition();
eyepos.z += mCamera->getHeight();
mCamera->getSightAngles(pitch, yaw);
}
bool RenderingManager::vanityRotateCamera(const float *rot)
{
if(!mCamera->isVanityOrPreviewModeEnabled())

@ -87,8 +87,6 @@ public:
bool vanityRotateCamera(const float *rot);
void getCameraData(Ogre::Vector3 &eyepos, float &pitch, float &yaw);
void setupPlayer(const MWWorld::Ptr &ptr);
void renderPlayer(const MWWorld::Ptr &ptr);

@ -254,15 +254,12 @@ namespace MWWorld
std::pair<float, std::string> PhysicsSystem::getFacedHandle (MWWorld::World& world, float queryDistance)
{
btVector3 dir(0, 1, 0);
dir = dir.rotate(btVector3(1, 0, 0), mCameraData.pitch);
dir = dir.rotate(btVector3(0, 0, 1), mCameraData.yaw);
dir.setX(-dir.x());
Ray ray = mRender.getCamera()->getCameraToViewportRay(0.5, 0.5);
btVector3 origin(mCameraData.eyepos.x,
mCameraData.eyepos.y,
mCameraData.eyepos.z);
origin += dir * 5;
Ogre::Vector3 origin_ = ray.getOrigin();
btVector3 origin(origin_.x, origin_.y, origin_.z);
Ogre::Vector3 dir_ = ray.getDirection().normalisedCopy();
btVector3 dir(dir_.x, dir_.y, dir_.z);
btVector3 dest = origin + dir * queryDistance;
std::pair <std::string, float> result;
@ -273,15 +270,12 @@ namespace MWWorld
std::vector < std::pair <float, std::string> > PhysicsSystem::getFacedHandles (float queryDistance)
{
btVector3 dir(0, 1, 0);
dir = dir.rotate(btVector3(1, 0, 0), mCameraData.pitch);
dir = dir.rotate(btVector3(0, 0, 1), mCameraData.yaw);
dir.setX(-dir.x());
Ray ray = mRender.getCamera()->getCameraToViewportRay(0.5, 0.5);
btVector3 origin(mCameraData.eyepos.x,
mCameraData.eyepos.y,
mCameraData.eyepos.z);
origin += dir * 5;
Ogre::Vector3 origin_ = ray.getOrigin();
btVector3 origin(origin_.x, origin_.y, origin_.z);
Ogre::Vector3 dir_ = ray.getDirection().normalisedCopy();
btVector3 dir(dir_.x, dir_.y, dir_.z);
btVector3 dest = origin + dir * queryDistance;
std::vector < std::pair <float, std::string> > results;
@ -543,11 +537,4 @@ namespace MWWorld
return true;
}
void PhysicsSystem::updateCameraData(const Ogre::Vector3 &eyepos, float pitch, float yaw)
{
mCameraData.eyepos = eyepos;
mCameraData.pitch = pitch;
mCameraData.yaw = yaw;
}
}

@ -77,13 +77,7 @@ namespace MWWorld
bool getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max);
void updateCameraData(const Ogre::Vector3 &eyepos, float pitch, float yaw);
private:
struct {
Ogre::Vector3 eyepos;
float pitch, yaw;
} mCameraData;
OEngine::Render::OgreRenderer &mRender;
OEngine::Physic::PhysicEngine* mEngine;

@ -1234,11 +1234,6 @@ namespace MWWorld
mWorldScene->update (duration, paused);
float pitch, yaw;
Ogre::Vector3 eyepos;
mRendering->getCameraData(eyepos, pitch, yaw);
mPhysics->updateCameraData(eyepos, pitch, yaw);
performUpdateSceneQueries ();
updateWindowManager ();

Loading…
Cancel
Save