1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 03:54:40 +00:00
OpenMW/apps/openmw/mwrender/characterpreview.hpp

128 lines
2.6 KiB
C++
Raw Normal View History

2012-09-12 22:54:32 +00:00
#ifndef MWRENDER_CHARACTERPREVIEW_H
#define MWRENDER_CHARACTERPREVIEW_H
#include <OgreRenderTarget.h>
2012-09-14 12:34:18 +00:00
#include <OgreMaterialManager.h>
#include <OgreVector3.h>
2012-09-14 12:34:18 +00:00
#include <components/esm/loadnpc.hpp>
2012-09-14 12:34:18 +00:00
#include "../mwworld/ptr.hpp"
2012-09-14 12:34:18 +00:00
namespace OEngine
{
namespace Render
{
class SelectionBuffer;
}
}
2012-09-12 22:54:32 +00:00
namespace MWRender
{
2012-09-13 17:03:31 +00:00
class NpcAnimation;
class CharacterPreview : public Ogre::ManualResourceLoader
2012-09-12 22:54:32 +00:00
{
public:
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);
virtual ~CharacterPreview();
virtual void setup ();
virtual void onSetup();
virtual void rebuild();
2012-09-12 22:54:32 +00:00
void onFrame();
void loadResource(Ogre::Resource *resource);
private:
bool mRecover; // Texture content was lost and needs to be re-rendered
2014-04-30 19:15:14 +00:00
private:
CharacterPreview(const CharacterPreview&);
CharacterPreview& operator=(const CharacterPreview&);
2012-09-13 17:03:31 +00:00
protected:
virtual bool renderHeadOnly() { return false; }
virtual void setupRenderTarget();
2012-09-12 22:54:32 +00:00
Ogre::TexturePtr mTexture;
Ogre::RenderTarget* mRenderTarget;
Ogre::Viewport* mViewport;
Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::SceneNode* mNode;
2012-09-13 17:03:31 +00:00
Ogre::Vector3 mPosition;
Ogre::Vector3 mLookAt;
MWWorld::Ptr mCharacter;
MWRender::NpcAnimation* mAnimation;
std::string mCurrentAnimGroup;
std::string mName;
2012-09-13 17:03:31 +00:00
int mSizeX;
int mSizeY;
};
class InventoryPreview : public CharacterPreview
{
public:
InventoryPreview(MWWorld::Ptr character);
2012-09-14 12:34:18 +00:00
virtual ~InventoryPreview();
virtual void onSetup();
2012-09-13 17:03:31 +00:00
void update(); // Render preview again, e.g. after changed equipment
void resize(int sizeX, int sizeY);
2012-09-13 17:03:31 +00:00
2012-09-14 12:34:18 +00:00
int getSlotSelected(int posX, int posY);
protected:
virtual void setupRenderTarget();
2012-09-13 17:03:31 +00:00
private:
int mSizeX;
int mSizeY;
2012-09-14 12:34:18 +00:00
OEngine::Render::SelectionBuffer* mSelectionBuffer;
2012-09-13 17:03:31 +00:00
};
class RaceSelectionPreview : public CharacterPreview
{
ESM::NPC mBase;
MWWorld::LiveCellRef<ESM::NPC> mRef;
protected:
virtual bool renderHeadOnly() { return true; }
void updateCamera();
2012-09-13 17:03:31 +00:00
public:
RaceSelectionPreview();
2012-09-13 17:03:31 +00:00
virtual void onSetup();
void render();
2012-09-13 17:03:31 +00:00
void update(float angle);
const ESM::NPC &getPrototype() const {
return mBase;
}
void setPrototype(const ESM::NPC &proto);
2012-09-12 22:54:32 +00:00
};
}
#endif