mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-03 23:56:47 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			121 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			121 lines
		
	
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef MWRENDER_CHARACTERPREVIEW_H
 | 
						|
#define MWRENDER_CHARACTERPREVIEW_H
 | 
						|
 | 
						|
#include <osg/ref_ptr>
 | 
						|
#include <memory>
 | 
						|
 | 
						|
#include <osg/PositionAttitudeTransform>
 | 
						|
 | 
						|
#include <components/esm/loadnpc.hpp>
 | 
						|
 | 
						|
#include <components/resource/resourcesystem.hpp>
 | 
						|
 | 
						|
#include "../mwworld/ptr.hpp"
 | 
						|
 | 
						|
namespace osg
 | 
						|
{
 | 
						|
    class Texture2D;
 | 
						|
    class Camera;
 | 
						|
    class Group;
 | 
						|
}
 | 
						|
 | 
						|
namespace MWRender
 | 
						|
{
 | 
						|
 | 
						|
    class NpcAnimation;
 | 
						|
    class DrawOnceCallback;
 | 
						|
 | 
						|
    class CharacterPreview
 | 
						|
    {
 | 
						|
    public:
 | 
						|
        CharacterPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character, int sizeX, int sizeY,
 | 
						|
                         const osg::Vec3f& position, const osg::Vec3f& lookAt);
 | 
						|
        virtual ~CharacterPreview();
 | 
						|
 | 
						|
        int getTextureWidth() const;
 | 
						|
        int getTextureHeight() const;
 | 
						|
 | 
						|
        void redraw();
 | 
						|
 | 
						|
        void rebuild();
 | 
						|
 | 
						|
        osg::ref_ptr<osg::Texture2D> getTexture();
 | 
						|
 | 
						|
    private:
 | 
						|
        CharacterPreview(const CharacterPreview&);
 | 
						|
        CharacterPreview& operator=(const CharacterPreview&);
 | 
						|
 | 
						|
    protected:
 | 
						|
        virtual bool renderHeadOnly() { return false; }
 | 
						|
        virtual void onSetup();
 | 
						|
 | 
						|
        osg::ref_ptr<osg::Group> mParent;
 | 
						|
        Resource::ResourceSystem* mResourceSystem;
 | 
						|
        osg::ref_ptr<osg::Texture2D> mTexture;
 | 
						|
        osg::ref_ptr<osg::Camera> mCamera;
 | 
						|
        osg::ref_ptr<DrawOnceCallback> mDrawOnceCallback;
 | 
						|
 | 
						|
        osg::Vec3f mPosition;
 | 
						|
        osg::Vec3f mLookAt;
 | 
						|
 | 
						|
        MWWorld::Ptr mCharacter;
 | 
						|
 | 
						|
        std::auto_ptr<MWRender::NpcAnimation> mAnimation;
 | 
						|
        osg::ref_ptr<osg::PositionAttitudeTransform> mNode;
 | 
						|
        std::string mCurrentAnimGroup;
 | 
						|
 | 
						|
        int mSizeX;
 | 
						|
        int mSizeY;
 | 
						|
    };
 | 
						|
 | 
						|
    class InventoryPreview : public CharacterPreview
 | 
						|
    {
 | 
						|
    public:
 | 
						|
 | 
						|
        InventoryPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem, MWWorld::Ptr character);
 | 
						|
 | 
						|
        void updatePtr(const MWWorld::Ptr& ptr);
 | 
						|
 | 
						|
        void update(); // Render preview again, e.g. after changed equipment
 | 
						|
        void setViewport(int sizeX, int sizeY);
 | 
						|
 | 
						|
        int getSlotSelected(int posX, int posY);
 | 
						|
 | 
						|
    protected:
 | 
						|
        virtual void onSetup();
 | 
						|
    };
 | 
						|
 | 
						|
    class UpdateCameraCallback;
 | 
						|
 | 
						|
    class RaceSelectionPreview : public CharacterPreview
 | 
						|
    {
 | 
						|
        ESM::NPC                        mBase;
 | 
						|
        MWWorld::LiveCellRef<ESM::NPC>  mRef;
 | 
						|
 | 
						|
    protected:
 | 
						|
 | 
						|
        virtual bool renderHeadOnly() { return true; }
 | 
						|
        virtual void onSetup();
 | 
						|
 | 
						|
    public:
 | 
						|
        RaceSelectionPreview(osg::Group* parent, Resource::ResourceSystem* resourceSystem);
 | 
						|
        virtual ~RaceSelectionPreview();
 | 
						|
 | 
						|
        void setAngle(float angleRadians);
 | 
						|
 | 
						|
        const ESM::NPC &getPrototype() const {
 | 
						|
            return mBase;
 | 
						|
        }
 | 
						|
 | 
						|
        void setPrototype(const ESM::NPC &proto);
 | 
						|
 | 
						|
    private:
 | 
						|
 | 
						|
        osg::ref_ptr<UpdateCameraCallback> mUpdateCameraCallback;
 | 
						|
 | 
						|
        float mPitchRadians;
 | 
						|
    };
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
#endif
 |