#ifndef MORPHWIN_H
#define MORPHWIN_H


#include "RMWin.h"

#define MAXMORPHTARGETS 26

enum MORPH_TYPE
{
MORPH_FORWARD=0,
MORPH_REVERSE,
MORPH_BOTH,
};

class MorphWin : public RMWin
{
public:
    MorphWin();
    LPDIRECT3DRMMESH GetMorphMesh() { return morphmesh; }
    DWORD GetNumMorphTargets()  { return nummorphtargets; }
    BOOL LoadMorphSequence( const CString& filename );
    BOOL AddMorphKey( DWORD target, D3DVALUE time );
    BOOL DeleteMorphKey( D3DVALUE time );
    BOOL SetMorphTime( D3DVALUE time );
private:
    BOOL LoadMeshes( const CString& filename );
    BOOL CreateAnimations();
    BOOL PrepareMorphVertices();
    BOOL ReleaseAnimations(int count);
protected:
    //{{AFX_MSG(MorphWin)
    afx_msg void OnDestroy();
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
private:
    LPDIRECT3DRMMESH morphmesh;
    D3DRMVERTEX* morphmeshdata[MAXMORPHTARGETS];
    D3DRMVERTEX* morphvertex;
    DWORD nummorphvertices;
    DWORD nummorphtargets;
    LPDIRECT3DRMANIMATION* posanimation;
    LPDIRECT3DRMFRAME* posframe;
    LPDIRECT3DRMANIMATION* normanimation;
    LPDIRECT3DRMFRAME* normframe;
    BOOL morphing;
};



#endif
