0001: // ----------------------------------------------------------------------------
0002: //
0003: // load.h - 全体的な定義
0004: // 
0005: // Copyright (c) 2001 IF (if@kun-desu.ne.jp)
0006: // All Rights Reserved.
0007: //
0008: // ----------------------------------------------------------------------------
0009: #ifndef _LOAD_H
0010: #define _LOAD_H
0011: 
0012: #include <d3d8.h>
0013: #include <d3dx8.h>
0014: 
0015: // ----------------------------------------------------------------------------
0016: // 頂点の定義
0017: // ----------------------------------------------------------------------------
0018: typedef struct {
0019:     D3DXVECTOR4  position;
0020:     D3DXVECTOR4  weight;
0021:     D3DXVECTOR4  normal;
0022:     D3DXVECTOR2  texcoord0;
0023: }D3D_CUSTOMVERTEX;
0024: 
0025: #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_XYZB4 | D3DFVF_NORMAL | D3DFVF_TEX1)
0026: 
0027: extern DWORD dwDecl[];
0028: 
0029: // ----------------------------------------------------------------------------
0030: // モデル
0031: // ----------------------------------------------------------------------------
0032: 
0033: class CMyMesh{
0034: public:
0035:     CMyMesh(){
0036:         bActive = false;
0037:         pVB = NULL;
0038:         pIndex = NULL;
0039:         pSubsetTable = NULL;
0040:         pTextures = NULL;
0041:         pMaterials = NULL;
0042:         nFaces = nVertices = dwNumMaterials = 0;
0043:         rot.x = rot.y = rot.z = 0;
0044:     }
0045:     bool                    bActive;
0046:     float                   radius;     // 大きさ
0047:     D3DXVECTOR3             center;     // 中心位置
0048:     D3DXVECTOR3             rot;
0049: 
0050:     LPDIRECT3DVERTEXBUFFER8 pVB;
0051:     LPDIRECT3DINDEXBUFFER8  pIndex;
0052:     D3DXATTRIBUTERANGE      *pSubsetTable;
0053:     DWORD                   nFaces;
0054:     DWORD                   nVertices;
0055:     D3DMATERIAL8            *pMaterials;        // メッシュの質感
0056:     LPDIRECT3DTEXTURE8      *pTextures;     // メッシュのテクスチャー
0057:     DWORD                   dwNumMaterials; // マテリアルの数
0058: 
0059:     HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, char *filename);
0060:     void Release();
0061: };
0062: // ----------------------------------------------------------------------------
0063: // テクスチャー
0064: // ----------------------------------------------------------------------------
0065: class CTextureMgr{
0066: public:
0067:     static HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, const char *filename, LPDIRECT3DTEXTURE8 *ppTexture);
0068:     static void Release(LPDIRECT3DTEXTURE8 pTexture);
0069: };
0070: 
0071: 
0072: #endif /* !_LOAD_H */
0073: