2012-09-13 00:54:32 +02:00
|
|
|
#ifndef MWRENDER_CHARACTERPREVIEW_H
|
|
|
|
#define MWRENDER_CHARACTERPREVIEW_H
|
|
|
|
|
|
|
|
#include <OgreRenderTarget.h>
|
2012-09-14 14:34:18 +02:00
|
|
|
#include <OgreMaterialManager.h>
|
2014-02-19 18:40:29 +01:00
|
|
|
#include <OgreVector3.h>
|
2012-09-14 14:34:18 +02:00
|
|
|
|
2012-11-10 11:41:12 +04:00
|
|
|
#include <components/esm/loadnpc.hpp>
|
2012-09-14 14:34:18 +02:00
|
|
|
|
2012-09-15 00:57:29 +02:00
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
|
2012-09-14 14:34:18 +02:00
|
|
|
namespace OEngine
|
|
|
|
{
|
|
|
|
namespace Render
|
|
|
|
{
|
|
|
|
class SelectionBuffer;
|
|
|
|
}
|
|
|
|
}
|
2012-09-13 00:54:32 +02:00
|
|
|
|
|
|
|
namespace MWRender
|
|
|
|
{
|
|
|
|
|
2012-09-13 19:03:31 +02:00
|
|
|
class NpcAnimation;
|
|
|
|
|
2013-01-09 01:44:15 -04:00
|
|
|
class CharacterPreview
|
2012-09-13 00:54:32 +02:00
|
|
|
{
|
|
|
|
public:
|
2012-09-15 00:57:29 +02:00
|
|
|
CharacterPreview(MWWorld::Ptr character, int sizeX, int sizeY, const std::string& name,
|
2012-09-13 19:03:31 +02:00
|
|
|
Ogre::Vector3 position, Ogre::Vector3 lookAt);
|
2012-09-15 00:57:29 +02:00
|
|
|
virtual ~CharacterPreview();
|
|
|
|
|
2013-01-09 01:44:15 -04:00
|
|
|
virtual void setup ();
|
2012-09-15 00:57:29 +02:00
|
|
|
virtual void onSetup();
|
|
|
|
|
2012-11-10 11:41:12 +04:00
|
|
|
virtual void rebuild();
|
2012-09-13 00:54:32 +02:00
|
|
|
|
2014-04-30 21:15:14 +02:00
|
|
|
private:
|
|
|
|
CharacterPreview(const CharacterPreview&);
|
|
|
|
CharacterPreview& operator=(const CharacterPreview&);
|
|
|
|
|
2012-09-13 19:03:31 +02:00
|
|
|
protected:
|
2013-03-06 18:03:47 +01:00
|
|
|
virtual bool renderHeadOnly() { return false; }
|
|
|
|
|
2012-09-13 00:54:32 +02:00
|
|
|
Ogre::TexturePtr mTexture;
|
|
|
|
Ogre::RenderTarget* mRenderTarget;
|
|
|
|
Ogre::Viewport* mViewport;
|
|
|
|
|
|
|
|
Ogre::Camera* mCamera;
|
|
|
|
|
|
|
|
Ogre::SceneManager* mSceneMgr;
|
|
|
|
Ogre::SceneNode* mNode;
|
2012-09-13 19:03:31 +02:00
|
|
|
|
2012-09-15 00:57:29 +02:00
|
|
|
Ogre::Vector3 mPosition;
|
|
|
|
Ogre::Vector3 mLookAt;
|
|
|
|
|
|
|
|
MWWorld::Ptr mCharacter;
|
|
|
|
|
|
|
|
MWRender::NpcAnimation* mAnimation;
|
2013-04-29 12:08:43 -07:00
|
|
|
std::string mCurrentAnimGroup;
|
2012-09-15 00:57:29 +02:00
|
|
|
|
|
|
|
std::string mName;
|
|
|
|
|
2012-09-13 19:03:31 +02:00
|
|
|
int mSizeX;
|
|
|
|
int mSizeY;
|
|
|
|
};
|
|
|
|
|
|
|
|
class InventoryPreview : public CharacterPreview
|
|
|
|
{
|
|
|
|
public:
|
2012-09-15 00:57:29 +02:00
|
|
|
|
|
|
|
InventoryPreview(MWWorld::Ptr character);
|
2012-09-14 14:34:18 +02:00
|
|
|
virtual ~InventoryPreview();
|
2012-09-15 00:57:29 +02:00
|
|
|
virtual void onSetup();
|
2012-09-13 19:03:31 +02:00
|
|
|
|
|
|
|
void update(int sizeX, int sizeY);
|
|
|
|
|
2012-09-14 14:34:18 +02:00
|
|
|
int getSlotSelected(int posX, int posY);
|
|
|
|
|
2012-09-13 19:03:31 +02:00
|
|
|
private:
|
2012-09-14 14:34:18 +02:00
|
|
|
|
|
|
|
OEngine::Render::SelectionBuffer* mSelectionBuffer;
|
2012-09-13 19:03:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class RaceSelectionPreview : public CharacterPreview
|
|
|
|
{
|
2012-11-10 11:41:12 +04:00
|
|
|
ESM::NPC mBase;
|
|
|
|
MWWorld::LiveCellRef<ESM::NPC> mRef;
|
|
|
|
|
2013-03-06 18:03:47 +01:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual bool renderHeadOnly() { return true; }
|
|
|
|
|
|
|
|
void updateCamera();
|
|
|
|
|
2012-09-13 19:03:31 +02:00
|
|
|
public:
|
2012-09-15 00:57:29 +02:00
|
|
|
RaceSelectionPreview();
|
2012-09-13 19:03:31 +02:00
|
|
|
|
2013-02-25 16:40:08 -08:00
|
|
|
virtual void onSetup();
|
2013-07-06 17:02:40 +02:00
|
|
|
void render();
|
2013-02-25 16:40:08 -08:00
|
|
|
|
2012-09-13 19:03:31 +02:00
|
|
|
void update(float angle);
|
2012-11-10 11:41:12 +04:00
|
|
|
|
|
|
|
const ESM::NPC &getPrototype() const {
|
|
|
|
return mBase;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setPrototype(const ESM::NPC &proto);
|
2012-09-13 00:54:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|