2012-09-12 22:54:32 +00:00
|
|
|
#include "characterpreview.hpp"
|
|
|
|
|
|
|
|
#include <OgreSceneManager.h>
|
2013-01-09 05:44:15 +00:00
|
|
|
#include <OgreRoot.h>
|
2012-09-12 22:54:32 +00:00
|
|
|
#include <OgreHardwarePixelBuffer.h>
|
2014-01-09 19:56:24 +00:00
|
|
|
#include <OgreCamera.h>
|
2014-02-19 17:40:29 +00:00
|
|
|
#include <OgreSceneNode.h>
|
|
|
|
#include <OgreTextureManager.h>
|
|
|
|
#include <OgreViewport.h>
|
|
|
|
#include <OgreRenderTexture.h>
|
2012-09-12 22:54:32 +00:00
|
|
|
|
2012-09-14 12:34:18 +00:00
|
|
|
#include <libs/openengine/ogre/selectionbuffer.hpp>
|
|
|
|
|
2012-09-12 22:54:32 +00:00
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
#include "../mwbase/environment.hpp"
|
|
|
|
#include "../mwbase/world.hpp"
|
2013-01-06 05:12:08 +00:00
|
|
|
#include "../mwworld/class.hpp"
|
2013-04-29 19:08:43 +00:00
|
|
|
#include "../mwworld/inventorystore.hpp"
|
2012-09-14 22:57:29 +00:00
|
|
|
|
2012-09-12 22:54:32 +00:00
|
|
|
#include "renderconst.hpp"
|
2012-09-13 17:03:31 +00:00
|
|
|
#include "npcanimation.hpp"
|
2012-09-12 22:54:32 +00:00
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
CharacterPreview::CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name,
|
2012-09-13 17:03:31 +00:00
|
|
|
Ogre::Vector3 position, Ogre::Vector3 lookAt)
|
2013-04-19 12:41:26 +00:00
|
|
|
: mSceneMgr (0)
|
2012-09-14 22:57:29 +00:00
|
|
|
, mPosition(position)
|
|
|
|
, mLookAt(lookAt)
|
|
|
|
, mCharacter(character)
|
2012-09-23 22:42:05 +00:00
|
|
|
, mAnimation(NULL)
|
2013-04-19 12:41:26 +00:00
|
|
|
, mName(name)
|
|
|
|
, mSizeX(sizeX)
|
|
|
|
, mSizeY(sizeY)
|
2013-07-31 16:46:32 +00:00
|
|
|
, mRenderTarget(NULL)
|
|
|
|
, mViewport(NULL)
|
|
|
|
, mCamera(NULL)
|
|
|
|
, mNode(NULL)
|
2014-08-08 13:44:22 +00:00
|
|
|
, mRecover(false)
|
2012-09-14 22:57:29 +00:00
|
|
|
{
|
2013-11-23 02:25:55 +00:00
|
|
|
mCharacter.mCell = NULL;
|
2012-09-14 22:57:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CharacterPreview::onSetup()
|
2012-09-12 22:54:32 +00:00
|
|
|
{
|
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
}
|
|
|
|
|
2014-08-08 13:44:22 +00:00
|
|
|
void CharacterPreview::onFrame()
|
|
|
|
{
|
|
|
|
if (mRecover)
|
|
|
|
{
|
|
|
|
setupRenderTarget();
|
|
|
|
mRenderTarget->update();
|
|
|
|
mRecover = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-09 05:44:15 +00:00
|
|
|
void CharacterPreview::setup ()
|
2012-09-14 22:57:29 +00:00
|
|
|
{
|
2013-01-09 05:44:15 +00:00
|
|
|
mSceneMgr = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC);
|
2013-01-09 19:08:59 +00:00
|
|
|
|
2013-07-14 12:54:40 +00:00
|
|
|
// This is a dummy light to turn off shadows without having to use a separate set of shaders
|
2013-01-09 19:08:59 +00:00
|
|
|
Ogre::Light* l = mSceneMgr->createLight();
|
|
|
|
l->setType (Ogre::Light::LT_DIRECTIONAL);
|
2013-07-14 12:54:40 +00:00
|
|
|
l->setDiffuseColour (Ogre::ColourValue(0,0,0));
|
|
|
|
|
|
|
|
/// \todo Read the fallback values from INIImporter (Inventory:Directional*)
|
|
|
|
l = mSceneMgr->createLight();
|
|
|
|
l->setType (Ogre::Light::LT_DIRECTIONAL);
|
2015-03-08 00:07:29 +00:00
|
|
|
l->setDirection (Ogre::Vector3(0.3f, -0.7f, 0.3f));
|
2013-01-09 19:08:59 +00:00
|
|
|
l->setDiffuseColour (Ogre::ColourValue(1,1,1));
|
|
|
|
|
2014-12-23 18:51:17 +00:00
|
|
|
mSceneMgr->setAmbientLight (Ogre::ColourValue(0.25, 0.25, 0.25));
|
2013-01-09 19:08:59 +00:00
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
mCamera = mSceneMgr->createCamera (mName);
|
2015-03-08 00:07:29 +00:00
|
|
|
mCamera->setFOVy(Ogre::Degree(12.3f));
|
2012-09-14 22:57:29 +00:00
|
|
|
mCamera->setAspectRatio (float(mSizeX) / float(mSizeY));
|
|
|
|
|
2013-01-09 05:44:15 +00:00
|
|
|
Ogre::SceneNode* renderRoot = mSceneMgr->getRootSceneNode()->createChildSceneNode("renderRoot");
|
|
|
|
|
2014-12-23 18:51:17 +00:00
|
|
|
// leftover of old coordinate system. TODO: remove this and adjust positions/orientations to match
|
2013-01-09 05:44:15 +00:00
|
|
|
renderRoot->pitch(Ogre::Degree(-90));
|
|
|
|
|
|
|
|
mNode = renderRoot->createChildSceneNode();
|
2012-09-14 22:57:29 +00:00
|
|
|
|
2013-11-14 13:41:10 +00:00
|
|
|
mAnimation = new NpcAnimation(mCharacter, mNode,
|
2014-10-12 09:40:14 +00:00
|
|
|
0, true, true, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
|
2012-09-14 22:57:29 +00:00
|
|
|
|
2012-11-10 07:41:12 +00:00
|
|
|
Ogre::Vector3 scale = mNode->getScale();
|
|
|
|
mCamera->setPosition(mPosition * scale);
|
|
|
|
mCamera->lookAt(mLookAt * scale);
|
2012-09-12 22:54:32 +00:00
|
|
|
|
2014-12-23 18:51:17 +00:00
|
|
|
mCamera->setNearClipDistance (1);
|
2012-09-13 17:03:31 +00:00
|
|
|
mCamera->setFarClipDistance (1000);
|
2012-09-12 22:54:32 +00:00
|
|
|
|
2014-08-04 14:32:53 +00:00
|
|
|
mTexture = Ogre::TextureManager::getSingleton().createManual(mName,
|
|
|
|
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D, mSizeX, mSizeY, 0, Ogre::PF_A8R8G8B8, Ogre::TU_RENDERTARGET, this);
|
2012-09-12 22:54:32 +00:00
|
|
|
|
2014-08-04 14:32:53 +00:00
|
|
|
setupRenderTarget();
|
2012-09-14 22:57:29 +00:00
|
|
|
|
|
|
|
onSetup ();
|
|
|
|
}
|
|
|
|
|
|
|
|
CharacterPreview::~CharacterPreview ()
|
|
|
|
{
|
2013-04-19 12:41:26 +00:00
|
|
|
if (mSceneMgr)
|
|
|
|
{
|
|
|
|
mSceneMgr->destroyAllCameras();
|
|
|
|
delete mAnimation;
|
|
|
|
Ogre::Root::getSingleton().destroySceneManager(mSceneMgr);
|
2014-08-04 14:32:53 +00:00
|
|
|
Ogre::TextureManager::getSingleton().remove(mName);
|
2013-04-19 12:41:26 +00:00
|
|
|
}
|
2012-09-12 22:54:32 +00:00
|
|
|
}
|
|
|
|
|
2012-11-10 07:41:12 +00:00
|
|
|
void CharacterPreview::rebuild()
|
|
|
|
{
|
|
|
|
delete mAnimation;
|
2014-12-02 23:02:14 +00:00
|
|
|
mAnimation = NULL;
|
2013-11-14 13:41:10 +00:00
|
|
|
mAnimation = new NpcAnimation(mCharacter, mNode,
|
2014-10-12 09:40:14 +00:00
|
|
|
0, true, true, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
|
2012-11-10 07:41:12 +00:00
|
|
|
|
2013-03-15 15:44:35 +00:00
|
|
|
float scale=1.f;
|
2014-05-22 18:37:22 +00:00
|
|
|
mCharacter.getClass().adjustScale(mCharacter, scale);
|
2013-03-15 15:44:35 +00:00
|
|
|
mNode->setScale(Ogre::Vector3(scale));
|
|
|
|
|
|
|
|
mCamera->setPosition(mPosition * mNode->getScale());
|
|
|
|
mCamera->lookAt(mLookAt * mNode->getScale());
|
2012-11-10 07:41:12 +00:00
|
|
|
|
|
|
|
onSetup();
|
|
|
|
}
|
2012-09-14 22:57:29 +00:00
|
|
|
|
2014-08-04 14:32:53 +00:00
|
|
|
void CharacterPreview::loadResource(Ogre::Resource *resource)
|
|
|
|
{
|
|
|
|
Ogre::Texture* tex = dynamic_cast<Ogre::Texture*>(resource);
|
|
|
|
if (!tex)
|
|
|
|
return;
|
|
|
|
|
|
|
|
tex->createInternalResources();
|
|
|
|
|
2014-08-08 13:44:22 +00:00
|
|
|
mRenderTarget = NULL;
|
|
|
|
mViewport = NULL;
|
|
|
|
mRecover = true;
|
2014-08-04 14:32:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CharacterPreview::setupRenderTarget()
|
|
|
|
{
|
|
|
|
mRenderTarget = mTexture->getBuffer()->getRenderTarget();
|
|
|
|
mRenderTarget->removeAllViewports ();
|
|
|
|
mViewport = mRenderTarget->addViewport(mCamera);
|
|
|
|
mViewport->setOverlaysEnabled(false);
|
|
|
|
mViewport->setBackgroundColour(Ogre::ColourValue(0, 0, 0, 0));
|
|
|
|
mViewport->setShadowsEnabled(false);
|
|
|
|
mRenderTarget->setActive(true);
|
|
|
|
mRenderTarget->setAutoUpdated (false);
|
|
|
|
}
|
|
|
|
|
2012-09-13 17:03:31 +00:00
|
|
|
// --------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
InventoryPreview::InventoryPreview(MWWorld::Ptr character)
|
2014-12-23 18:51:17 +00:00
|
|
|
: CharacterPreview(character, 512, 1024, "CharacterPreview", Ogre::Vector3(0, 71, -700), Ogre::Vector3(0,71,0))
|
2013-02-03 14:46:23 +00:00
|
|
|
, mSelectionBuffer(NULL)
|
2014-08-04 14:32:53 +00:00
|
|
|
, mSizeX(0)
|
|
|
|
, mSizeY(0)
|
2012-09-13 17:03:31 +00:00
|
|
|
{
|
2012-09-14 12:34:18 +00:00
|
|
|
}
|
2012-09-13 17:03:31 +00:00
|
|
|
|
2012-09-14 12:34:18 +00:00
|
|
|
InventoryPreview::~InventoryPreview()
|
|
|
|
{
|
|
|
|
delete mSelectionBuffer;
|
2012-09-13 17:03:31 +00:00
|
|
|
}
|
|
|
|
|
2014-08-12 14:36:13 +00:00
|
|
|
void InventoryPreview::resize(int sizeX, int sizeY)
|
2012-09-12 22:54:32 +00:00
|
|
|
{
|
2014-08-04 14:32:53 +00:00
|
|
|
mSizeX = sizeX;
|
|
|
|
mSizeY = sizeY;
|
|
|
|
|
2014-08-12 14:36:13 +00:00
|
|
|
mViewport->setDimensions (0, 0, std::min(1.f, float(mSizeX) / float(512)), std::min(1.f, float(mSizeY) / float(1024)));
|
|
|
|
mTexture->load();
|
|
|
|
|
|
|
|
if (!mRenderTarget)
|
|
|
|
setupRenderTarget();
|
|
|
|
|
|
|
|
mRenderTarget->update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InventoryPreview::update()
|
|
|
|
{
|
2014-12-02 23:02:14 +00:00
|
|
|
if (!mAnimation)
|
|
|
|
return;
|
|
|
|
|
2014-01-04 19:43:57 +00:00
|
|
|
mAnimation->updateParts();
|
2013-11-20 23:27:22 +00:00
|
|
|
|
2014-01-19 10:42:58 +00:00
|
|
|
MWWorld::InventoryStore &inv = mCharacter.getClass().getInventoryStore(mCharacter);
|
2013-04-29 19:08:43 +00:00
|
|
|
MWWorld::ContainerStoreIterator iter = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
|
|
|
std::string groupname;
|
2014-12-12 15:49:22 +00:00
|
|
|
bool showCarriedLeft = true;
|
2013-04-29 19:08:43 +00:00
|
|
|
if(iter == inv.end())
|
|
|
|
groupname = "inventoryhandtohand";
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const std::string &type = iter->getTypeName();
|
|
|
|
if(type == typeid(ESM::Lockpick).name() || type == typeid(ESM::Probe).name())
|
|
|
|
groupname = "inventoryweapononehand";
|
|
|
|
else if(type == typeid(ESM::Weapon).name())
|
|
|
|
{
|
|
|
|
MWWorld::LiveCellRef<ESM::Weapon> *ref = iter->get<ESM::Weapon>();
|
|
|
|
|
|
|
|
int type = ref->mBase->mData.mType;
|
|
|
|
if(type == ESM::Weapon::ShortBladeOneHand ||
|
|
|
|
type == ESM::Weapon::LongBladeOneHand ||
|
|
|
|
type == ESM::Weapon::BluntOneHand ||
|
2014-01-31 02:28:18 +00:00
|
|
|
type == ESM::Weapon::AxeOneHand ||
|
2014-02-03 21:24:03 +00:00
|
|
|
type == ESM::Weapon::MarksmanThrown ||
|
|
|
|
type == ESM::Weapon::MarksmanCrossbow ||
|
|
|
|
type == ESM::Weapon::MarksmanBow)
|
2013-04-29 19:08:43 +00:00
|
|
|
groupname = "inventoryweapononehand";
|
|
|
|
else if(type == ESM::Weapon::LongBladeTwoHand ||
|
|
|
|
type == ESM::Weapon::BluntTwoClose ||
|
2014-02-03 21:24:03 +00:00
|
|
|
type == ESM::Weapon::AxeTwoHand)
|
2013-04-29 19:08:43 +00:00
|
|
|
groupname = "inventoryweapontwohand";
|
|
|
|
else if(type == ESM::Weapon::BluntTwoWide ||
|
|
|
|
type == ESM::Weapon::SpearTwoWide)
|
|
|
|
groupname = "inventoryweapontwowide";
|
|
|
|
else
|
|
|
|
groupname = "inventoryhandtohand";
|
2014-12-12 15:49:22 +00:00
|
|
|
|
|
|
|
showCarriedLeft = (iter->getClass().canBeEquipped(*iter, mCharacter).first != 2);
|
|
|
|
}
|
2013-04-29 19:08:43 +00:00
|
|
|
else
|
|
|
|
groupname = "inventoryhandtohand";
|
|
|
|
}
|
|
|
|
|
2014-12-12 15:49:22 +00:00
|
|
|
mAnimation->showCarriedLeft(showCarriedLeft);
|
|
|
|
|
2014-01-04 19:43:57 +00:00
|
|
|
mCurrentAnimGroup = groupname;
|
|
|
|
mAnimation->play(mCurrentAnimGroup, 1, Animation::Group_All, false, 1.0f, "start", "stop", 0.0f, 0);
|
2013-04-29 19:08:43 +00:00
|
|
|
|
2013-05-17 13:21:59 +00:00
|
|
|
MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
|
2014-12-28 13:09:27 +00:00
|
|
|
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name() && showCarriedLeft)
|
2013-05-17 13:21:59 +00:00
|
|
|
{
|
|
|
|
if(!mAnimation->getInfo("torch"))
|
|
|
|
mAnimation->play("torch", 2, MWRender::Animation::Group_LeftArm, false,
|
2014-12-21 14:29:20 +00:00
|
|
|
1.0f, "start", "stop", 0.0f, ~0ul, true);
|
2013-05-17 13:21:59 +00:00
|
|
|
}
|
|
|
|
else if(mAnimation->getInfo("torch"))
|
|
|
|
mAnimation->disable("torch");
|
|
|
|
|
2013-02-22 19:16:00 +00:00
|
|
|
mAnimation->runAnimation(0.0f);
|
2012-09-13 17:03:31 +00:00
|
|
|
|
|
|
|
mNode->setOrientation (Ogre::Quaternion::IDENTITY);
|
|
|
|
|
2014-08-04 14:32:53 +00:00
|
|
|
mViewport->setDimensions (0, 0, std::min(1.f, float(mSizeX) / float(512)), std::min(1.f, float(mSizeY) / float(1024)));
|
|
|
|
mTexture->load();
|
2014-08-08 13:44:22 +00:00
|
|
|
|
|
|
|
if (!mRenderTarget)
|
|
|
|
setupRenderTarget();
|
|
|
|
|
2012-09-12 22:54:32 +00:00
|
|
|
mRenderTarget->update();
|
2013-05-19 16:40:37 +00:00
|
|
|
|
2012-09-14 12:34:18 +00:00
|
|
|
mSelectionBuffer->update();
|
2012-09-13 17:03:31 +00:00
|
|
|
}
|
|
|
|
|
2014-08-04 14:32:53 +00:00
|
|
|
void InventoryPreview::setupRenderTarget()
|
|
|
|
{
|
|
|
|
CharacterPreview::setupRenderTarget();
|
|
|
|
mViewport->setDimensions (0, 0, std::min(1.f, float(mSizeX) / float(512)), std::min(1.f, float(mSizeY) / float(1024)));
|
|
|
|
}
|
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
int InventoryPreview::getSlotSelected (int posX, int posY)
|
2012-09-13 17:03:31 +00:00
|
|
|
{
|
2012-09-14 22:57:29 +00:00
|
|
|
return mSelectionBuffer->getSelected (posX, posY);
|
2012-09-13 17:03:31 +00:00
|
|
|
}
|
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
void InventoryPreview::onSetup ()
|
2012-09-14 12:34:18 +00:00
|
|
|
{
|
2013-05-19 16:40:37 +00:00
|
|
|
delete mSelectionBuffer;
|
|
|
|
mSelectionBuffer = new OEngine::Render::SelectionBuffer(mCamera, 512, 1024, 0);
|
2012-10-01 16:04:21 +00:00
|
|
|
|
2013-04-29 19:08:43 +00:00
|
|
|
mAnimation->showWeapons(true);
|
|
|
|
|
|
|
|
mCurrentAnimGroup = "inventoryhandtohand";
|
2013-07-16 07:43:31 +00:00
|
|
|
mAnimation->play(mCurrentAnimGroup, 1, Animation::Group_All, false, 1.0f, "start", "stop", 0.0f, 0);
|
2012-09-14 12:34:18 +00:00
|
|
|
}
|
|
|
|
|
2012-09-13 17:03:31 +00:00
|
|
|
// --------------------------------------------------------------------------------------------------
|
|
|
|
|
2012-09-14 22:57:29 +00:00
|
|
|
RaceSelectionPreview::RaceSelectionPreview()
|
2014-01-08 17:39:44 +00:00
|
|
|
: CharacterPreview(MWBase::Environment::get().getWorld()->getPlayerPtr(),
|
2014-12-23 18:51:17 +00:00
|
|
|
512, 512, "CharacterHeadPreview", Ogre::Vector3(0, 8, -125), Ogre::Vector3(0,127,0))
|
2014-09-26 15:12:48 +00:00
|
|
|
, mBase (*mCharacter.get<ESM::NPC>()->mBase)
|
2012-11-10 07:41:12 +00:00
|
|
|
, mRef(&mBase)
|
2014-12-23 18:51:17 +00:00
|
|
|
, mPitch(Ogre::Degree(6))
|
2012-09-13 17:03:31 +00:00
|
|
|
{
|
2013-11-23 02:25:55 +00:00
|
|
|
mCharacter = MWWorld::Ptr(&mRef, NULL);
|
2012-09-13 17:03:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void RaceSelectionPreview::update(float angle)
|
|
|
|
{
|
2013-02-26 00:40:08 +00:00
|
|
|
mAnimation->runAnimation(0.0f);
|
2014-12-23 18:51:17 +00:00
|
|
|
|
|
|
|
mNode->setOrientation(Ogre::Quaternion(Ogre::Radian(angle), Ogre::Vector3::UNIT_Z)
|
|
|
|
* Ogre::Quaternion(mPitch, Ogre::Vector3::UNIT_X));
|
2012-09-13 17:03:31 +00:00
|
|
|
|
2013-03-06 17:03:47 +00:00
|
|
|
updateCamera();
|
2013-07-06 15:02:40 +00:00
|
|
|
}
|
2013-03-06 17:03:47 +00:00
|
|
|
|
2013-07-06 15:02:40 +00:00
|
|
|
void RaceSelectionPreview::render()
|
|
|
|
{
|
2014-08-04 14:32:53 +00:00
|
|
|
mTexture->load();
|
2014-08-13 17:30:46 +00:00
|
|
|
|
|
|
|
if (!mRenderTarget)
|
|
|
|
setupRenderTarget();
|
2012-09-13 17:03:31 +00:00
|
|
|
mRenderTarget->update();
|
2012-09-12 22:54:32 +00:00
|
|
|
}
|
|
|
|
|
2012-11-10 07:41:12 +00:00
|
|
|
void RaceSelectionPreview::setPrototype(const ESM::NPC &proto)
|
|
|
|
{
|
|
|
|
mBase = proto;
|
|
|
|
mBase.mId = "player";
|
|
|
|
rebuild();
|
2014-12-23 18:51:17 +00:00
|
|
|
mAnimation->runAnimation(0.0f);
|
|
|
|
updateCamera();
|
2012-11-10 07:41:12 +00:00
|
|
|
}
|
2013-02-26 00:40:08 +00:00
|
|
|
|
|
|
|
void RaceSelectionPreview::onSetup ()
|
|
|
|
{
|
2013-07-16 07:43:31 +00:00
|
|
|
mAnimation->play("idle", 1, Animation::Group_All, false, 1.0f, "start", "stop", 0.0f, 0);
|
2013-03-06 17:03:47 +00:00
|
|
|
|
|
|
|
updateCamera();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RaceSelectionPreview::updateCamera()
|
|
|
|
{
|
|
|
|
Ogre::Vector3 scale = mNode->getScale();
|
2014-12-18 02:24:10 +00:00
|
|
|
Ogre::Node* headNode = mAnimation->getNode("Bip01 Head");
|
|
|
|
if (!headNode)
|
|
|
|
return;
|
|
|
|
Ogre::Vector3 headOffset = headNode->_getDerivedPosition();
|
2013-03-06 17:03:47 +00:00
|
|
|
headOffset = mNode->convertLocalToWorldPosition(headOffset);
|
|
|
|
|
|
|
|
mCamera->setPosition(headOffset + mPosition * scale);
|
|
|
|
mCamera->lookAt(headOffset + mPosition*Ogre::Vector3(0,1,0) * scale);
|
2013-02-26 00:40:08 +00:00
|
|
|
}
|
2012-09-12 22:54:32 +00:00
|
|
|
}
|