0001: // ----------------------------------------------------------------------------
0002: //
0003: // load.h - Load mesh
0004: // 
0005: // Copyright (c) 2002 IMAGIRE Takashi (imagire@gmail.com)
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:     D3DXVECTOR2  texcoord0;
0021: }D3D_CUSTOMVERTEX;
0022: 
0023: #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_TEX1)
0024: 
0025: extern DWORD dwDecl[];
0026: 
0027: // ----------------------------------------------------------------------------
0028: // モデル
0029: // ----------------------------------------------------------------------------
0030: 
0031: class CMyMesh{
0032: public:
0033:     CMyMesh(){
0034:         bActive = false;
0035:         pVB = NULL;
0036:         pIndex = NULL;
0037:         pSubsetTable = NULL;
0038:         pTextures = NULL;
0039:         pMaterials = NULL;
0040:         nFaces = nVertices = dwNumMaterials = 0;
0041:         rot.x = rot.y = rot.z = 0;
0042:     }
0043:     bool                    bActive;
0044:     float                   radius;     // 大きさ
0045:     D3DXVECTOR3             center;     // 中心位置
0046:     D3DXVECTOR3             rot;
0047: 
0048:     LPDIRECT3DVERTEXBUFFER8 pVB;
0049:     LPDIRECT3DINDEXBUFFER8  pIndex;
0050:     D3DXATTRIBUTERANGE      *pSubsetTable;
0051:     DWORD                   nFaces;
0052:     DWORD                   nVertices;
0053:     D3DMATERIAL8            *pMaterials;        // メッシュの質感
0054:     LPDIRECT3DTEXTURE8      *pTextures;     // メッシュのテクスチャー
0055:     DWORD                   dwNumMaterials; // マテリアルの数
0056: 
0057:     HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, char *filename);
0058:     void Release();
0059: };
0060: // ----------------------------------------------------------------------------
0061: // テクスチャー
0062: // ----------------------------------------------------------------------------
0063: class CTextureMgr{
0064: public:
0065:     static HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, const char *filename, LPDIRECT3DTEXTURE8 *ppTexture);
0066:     static void Release(LPDIRECT3DTEXTURE8 pTexture);
0067: };
0068: 
0069: 
0070: #endif /* !_LOAD_H */
0071: