From 9c6bc4975c7c5f3319a95aa036e6142b25047acc Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 10 Feb 2011 12:56:19 +0100 Subject: [PATCH] attached camera to a scene node --- apps/openmw/mwrender/mwscene.cpp | 5 ++++- apps/openmw/mwrender/player.cpp | 3 ++- apps/openmw/mwrender/player.hpp | 7 ++++++- apps/openmw/mwworld/player.cpp | 1 + 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwrender/mwscene.cpp b/apps/openmw/mwrender/mwscene.cpp index 7eb50693f..e46b53caf 100644 --- a/apps/openmw/mwrender/mwscene.cpp +++ b/apps/openmw/mwrender/mwscene.cpp @@ -42,7 +42,10 @@ MWScene::MWScene(OEngine::Render::OgreRenderer &_rend) //used to obtain ingame information of ogre objects (which are faced or selected) mRaySceneQuery = rend.getScene()->createRayQuery(Ray()); - mPlayer = new MWRender::Player (getCamera()); + Ogre::SceneNode *playerNode = mwRoot->createChildSceneNode(); + playerNode->attachObject (getCamera()); + + mPlayer = new MWRender::Player (getCamera(), playerNode->getName()); } MWScene::~MWScene() diff --git a/apps/openmw/mwrender/player.cpp b/apps/openmw/mwrender/player.cpp index badc77bda..7dcaeee09 100644 --- a/apps/openmw/mwrender/player.cpp +++ b/apps/openmw/mwrender/player.cpp @@ -3,6 +3,7 @@ namespace MWRender { - Player::Player (Ogre::Camera *camera) : mCamera (camera) + Player::Player (Ogre::Camera *camera, const std::string& handle) + : mCamera (camera), mHandle (handle) {} } diff --git a/apps/openmw/mwrender/player.hpp b/apps/openmw/mwrender/player.hpp index a8f8d24fe..f2d819116 100644 --- a/apps/openmw/mwrender/player.hpp +++ b/apps/openmw/mwrender/player.hpp @@ -1,6 +1,8 @@ #ifndef GAME_MWRENDER_PLAYER_H #define GAME_MWRENDER_PLAYER_H +#include + namespace Ogre { class Camera; @@ -12,12 +14,15 @@ namespace MWRender class Player { Ogre::Camera *mCamera; + std::string mHandle; public: - Player (Ogre::Camera *camera); + Player (Ogre::Camera *camera, const std::string& handle); Ogre::Camera *getCamera() { return mCamera; } + + std::string getHandle() const { return mHandle; } }; } diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index bdfc32c72..c4b17f48f 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -17,6 +17,7 @@ namespace MWWorld mMale = !(player->flags & ESM::NPC::Female); mRace = player->race; mPlayer.ref.pos.pos[0] = mPlayer.ref.pos.pos[1] = mPlayer.ref.pos.pos[2] = 0; + mPlayer.mData.setHandle (renderer->getHandle()); mClass = new ESM::Class (*world.getStore().classes.find (player->cls)); }