mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 04:53:53 +00:00
Merge remote-tracking branch 'scrawl/raycast'
This commit is contained in:
commit
a0022e711b
5 changed files with 10 additions and 43 deletions
|
@ -884,13 +884,6 @@ void RenderingManager::renderPlayer(const MWWorld::Ptr &ptr)
|
||||||
MWBase::Environment::get().getWorld()->scaleObject(ptr, 1.f);
|
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)
|
bool RenderingManager::vanityRotateCamera(const float *rot)
|
||||||
{
|
{
|
||||||
if(!mCamera->isVanityOrPreviewModeEnabled())
|
if(!mCamera->isVanityOrPreviewModeEnabled())
|
||||||
|
|
|
@ -87,8 +87,6 @@ public:
|
||||||
|
|
||||||
bool vanityRotateCamera(const float *rot);
|
bool vanityRotateCamera(const float *rot);
|
||||||
|
|
||||||
void getCameraData(Ogre::Vector3 &eyepos, float &pitch, float &yaw);
|
|
||||||
|
|
||||||
void setupPlayer(const MWWorld::Ptr &ptr);
|
void setupPlayer(const MWWorld::Ptr &ptr);
|
||||||
void renderPlayer(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)
|
std::pair<float, std::string> PhysicsSystem::getFacedHandle (MWWorld::World& world, float queryDistance)
|
||||||
{
|
{
|
||||||
btVector3 dir(0, 1, 0);
|
Ray ray = mRender.getCamera()->getCameraToViewportRay(0.5, 0.5);
|
||||||
dir = dir.rotate(btVector3(1, 0, 0), mCameraData.pitch);
|
|
||||||
dir = dir.rotate(btVector3(0, 0, 1), mCameraData.yaw);
|
|
||||||
dir.setX(-dir.x());
|
|
||||||
|
|
||||||
btVector3 origin(mCameraData.eyepos.x,
|
Ogre::Vector3 origin_ = ray.getOrigin();
|
||||||
mCameraData.eyepos.y,
|
btVector3 origin(origin_.x, origin_.y, origin_.z);
|
||||||
mCameraData.eyepos.z);
|
Ogre::Vector3 dir_ = ray.getDirection().normalisedCopy();
|
||||||
origin += dir * 5;
|
btVector3 dir(dir_.x, dir_.y, dir_.z);
|
||||||
|
|
||||||
btVector3 dest = origin + dir * queryDistance;
|
btVector3 dest = origin + dir * queryDistance;
|
||||||
std::pair <std::string, float> result;
|
std::pair <std::string, float> result;
|
||||||
|
@ -273,15 +270,12 @@ namespace MWWorld
|
||||||
|
|
||||||
std::vector < std::pair <float, std::string> > PhysicsSystem::getFacedHandles (float queryDistance)
|
std::vector < std::pair <float, std::string> > PhysicsSystem::getFacedHandles (float queryDistance)
|
||||||
{
|
{
|
||||||
btVector3 dir(0, 1, 0);
|
Ray ray = mRender.getCamera()->getCameraToViewportRay(0.5, 0.5);
|
||||||
dir = dir.rotate(btVector3(1, 0, 0), mCameraData.pitch);
|
|
||||||
dir = dir.rotate(btVector3(0, 0, 1), mCameraData.yaw);
|
|
||||||
dir.setX(-dir.x());
|
|
||||||
|
|
||||||
btVector3 origin(mCameraData.eyepos.x,
|
Ogre::Vector3 origin_ = ray.getOrigin();
|
||||||
mCameraData.eyepos.y,
|
btVector3 origin(origin_.x, origin_.y, origin_.z);
|
||||||
mCameraData.eyepos.z);
|
Ogre::Vector3 dir_ = ray.getDirection().normalisedCopy();
|
||||||
origin += dir * 5;
|
btVector3 dir(dir_.x, dir_.y, dir_.z);
|
||||||
|
|
||||||
btVector3 dest = origin + dir * queryDistance;
|
btVector3 dest = origin + dir * queryDistance;
|
||||||
std::vector < std::pair <float, std::string> > results;
|
std::vector < std::pair <float, std::string> > results;
|
||||||
|
@ -543,11 +537,4 @@ namespace MWWorld
|
||||||
|
|
||||||
return true;
|
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);
|
bool getObjectAABB(const MWWorld::Ptr &ptr, Ogre::Vector3 &min, Ogre::Vector3 &max);
|
||||||
|
|
||||||
void updateCameraData(const Ogre::Vector3 &eyepos, float pitch, float yaw);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct {
|
|
||||||
Ogre::Vector3 eyepos;
|
|
||||||
float pitch, yaw;
|
|
||||||
} mCameraData;
|
|
||||||
|
|
||||||
OEngine::Render::OgreRenderer &mRender;
|
OEngine::Render::OgreRenderer &mRender;
|
||||||
OEngine::Physic::PhysicEngine* mEngine;
|
OEngine::Physic::PhysicEngine* mEngine;
|
||||||
|
|
|
@ -1234,11 +1234,6 @@ namespace MWWorld
|
||||||
|
|
||||||
mWorldScene->update (duration, paused);
|
mWorldScene->update (duration, paused);
|
||||||
|
|
||||||
float pitch, yaw;
|
|
||||||
Ogre::Vector3 eyepos;
|
|
||||||
mRendering->getCameraData(eyepos, pitch, yaw);
|
|
||||||
mPhysics->updateCameraData(eyepos, pitch, yaw);
|
|
||||||
|
|
||||||
performUpdateSceneQueries ();
|
performUpdateSceneQueries ();
|
||||||
|
|
||||||
updateWindowManager ();
|
updateWindowManager ();
|
||||||
|
|
Loading…
Reference in a new issue