attached camera to a scene node

actorid
Marc Zinnschlag 14 years ago
parent 151560b882
commit 9c6bc4975c

@ -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()

@ -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)
{}
}

@ -1,6 +1,8 @@
#ifndef GAME_MWRENDER_PLAYER_H
#define GAME_MWRENDER_PLAYER_H
#include <iostream>
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; }
};
}

@ -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));
}

Loading…
Cancel
Save