| 1 |
#ifndef CTEXTUREANIMATION_H_INCLUDED |
| 2 |
#define CTEXTUREANIMATION_H_INCLUDED |
| 3 |
|
| 4 |
class CModelPlugin; |
| 5 |
class CTextureTransformer; |
| 6 |
|
| 7 |
/* |
| 8 |
* アニメーションフレーム |
| 9 |
*/ |
| 10 |
class CTexAnimFrame{ |
| 11 |
friend class CTextureAnimation; |
| 12 |
private: |
| 13 |
int m_FrameLength; // フレームの長さ |
| 14 |
string m_TextureFileName; // テクスチャファイル名 |
| 15 |
LPTEX8 m_FrameTexture; // フレームテクスチャ |
| 16 |
CTextureTransformer *m_TexTrans; // UV 変換 |
| 17 |
public: |
| 18 |
CTexAnimFrame(); |
| 19 |
CTexAnimFrame(const CTexAnimFrame &); |
| 20 |
CTexAnimFrame(string, int); |
| 21 |
~CTexAnimFrame(); |
| 22 |
char *Read(char *); |
| 23 |
void LoadData(); |
| 24 |
void Apply(CMesh *, int); |
| 25 |
}; |
| 26 |
|
| 27 |
/* |
| 28 |
* テクスチャアニメーション状態 |
| 29 |
*/ |
| 30 |
class CTexAnimState{ |
| 31 |
friend class CTextureAnimation; |
| 32 |
private: |
| 33 |
int m_Frame; // フレーム |
| 34 |
int m_Count; // カウント |
| 35 |
public: |
| 36 |
CTexAnimState(){ Reset(); } |
| 37 |
void Reset(){ m_Frame = m_Count = 0; } |
| 38 |
void Step(){ m_Count++; } |
| 39 |
char *Read(char *); |
| 40 |
void Save(FILE *, char *); |
| 41 |
}; |
| 42 |
|
| 43 |
// 反復子 |
| 44 |
typedef list<CTexAnimState>::iterator ITexAnimState; |
| 45 |
|
| 46 |
/* |
| 47 |
* テクスチャアニメーション |
| 48 |
*/ |
| 49 |
class CTextureAnimation{ |
| 50 |
private: |
| 51 |
int m_CurrentFrame; // 現在のフレーム |
| 52 |
CTexAnimState m_PreviewState; // プレビュー用状態変数 |
| 53 |
string m_AnimationName; // アニメーション名 |
| 54 |
vector<CTexAnimFrame> m_FrameList; // フレームリスト |
| 55 |
public: |
| 56 |
char *Read(char *, CModelPlugin *); |
| 57 |
void LoadData(); |
| 58 |
CTextureAnimation *Check(const string &name){ |
| 59 |
return m_AnimationName==name ? this : NULL; |
| 60 |
} |
| 61 |
void SetState(CTexAnimState *); |
| 62 |
void Apply(CMesh *, int); |
| 63 |
LPTEX8 GetFrameTexture(){ |
| 64 |
return m_FrameList.size() ? m_FrameList[m_CurrentFrame].m_FrameTexture : NULL; |
| 65 |
} |
| 66 |
}; |
| 67 |
|
| 68 |
// 反復子 |
| 69 |
typedef list<CTextureAnimation>::iterator ITextureAnimation; |
| 70 |
|
| 71 |
#endif |