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: 
0019: // ----------------------------------------------------------------------------
0020: // 頂点の定義
0021: // ----------------------------------------------------------------------------
0022: typedef struct {
0023:     float x,y,z;
0024:     float nx,ny,nz;
0025:     float tu0,tv0;
0026: //  float tu1,tv1;
0027: }D3D_CUSTOMVERTEX;
0028: #define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1/* | D3DFVF_TEX2*/)
0029: 
0030: extern DWORD dwDecl[];
0031: 
0032: class CMyMesh{
0033: public:
0034:     CMyMesh(){
0035:         bActive = false;
0036:         pVB = NULL;
0037:         pIndex = NULL;
0038:         pSubsetTable = NULL;
0039:         pTextures = NULL;
0040:         pMaterials = NULL;
0041:         nFaces = nVertices = dwNumMaterials = 0;
0042:         rot.x = rot.y = rot.z = 0;
0043:     }
0044:     bool                    bActive;
0045:     float                   radius;     // 大きさ
0046:     D3DXVECTOR3             center;     // 中心位置
0047:     D3DXVECTOR3             rot;
0048: 
0049:     LPDIRECT3DVERTEXBUFFER8 pVB;
0050:     LPDIRECT3DINDEXBUFFER8  pIndex;
0051:     D3DXATTRIBUTERANGE      *pSubsetTable;
0052:     DWORD                   nFaces;
0053:     DWORD                   nVertices;
0054:     D3DMATERIAL8            *pMaterials;        // メッシュの質感
0055:     LPDIRECT3DTEXTURE8      *pTextures;     // メッシュのテクスチャー
0056:     DWORD                   dwNumMaterials; // マテリアルの数
0057: 
0058:     HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, char *filename);
0059:     void Release();
0060: };
0061: // ----------------------------------------------------------------------------
0062: // テクスチャー
0063: // ----------------------------------------------------------------------------
0064: class CTextureMgr{
0065: public:
0066:     static HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, const char *filename, LPDIRECT3DTEXTURE8 *ppTexture);
0067:     static void Release(LPDIRECT3DTEXTURE8 pTexture);
0068: };
0069: // ----------------------------------------------------------------------------
0070: // 頂点シェーダー
0071: // ----------------------------------------------------------------------------
0072: class CVertexShaderMgr{
0073: public:
0074:     static HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, const char *filename, DWORD *phVertexShader, const DWORD dwDecl[]);
0075:     static void Release(LPDIRECT3DDEVICE8 lpD3DDev, DWORD *phVertexShader);
0076: };
0077: // ----------------------------------------------------------------------------
0078: // ピクセルシェーダー
0079: // ----------------------------------------------------------------------------
0080: class CPixelShaderMgr{
0081: public:
0082:     static HRESULT Load(LPDIRECT3DDEVICE8 lpD3DDev, const char *filename, DWORD *phPixelShader);
0083:     static void Release(LPDIRECT3DDEVICE8 lpD3DDev, DWORD *phPixelShader);
0084: };
0085: 
0086: 
0087: #endif /* !_LOAD_H */
0088: