ZFXMeshX.h
资源名称:Direct3D.rar [点击查看]
上传用户:junlon
上传日期:2022-01-05
资源大小:39075k
文件大小:1k
源码类别:
DirextX编程
开发平台:
Visual C++
- #ifndef __d3d_ZFXMesh_H__
- #define __d3d_ZFXMesh_H__
- //#pragma once
- // Mesh类
- class CZFXMesh{
- public:
- CZFXMesh();
- ~CZFXMesh();
- public:
- //if bTextureCreateFromMesh == true, 将根据mesh中提供的文件名来创建一个纹理数组,并存储在m_ppTextureFromMesh指向的数组中
- // m_bTextureCreateFromMesh = true;
- //else
- // m_bTextureCreateFromMesh = false;
- HRESULT LoadMeshFromFile( LPDIRECT3DDEVICE9 pd3dDevice, LPCTSTR strFileName, bool bTextureCreateFromMesh,
- DWORD options = D3DXMESH_MANAGED );
- HRESULT CreateTextureFromFile( LPDIRECT3DDEVICE9 pd3dDevice, LPCTSTR strFileName );
- // if m_bTextureCreateFromMesh == true
- // 将使用m_ppTextureFromMesh纹理数组
- // else
- // 使用m_pTexture纹理
- virtual void OnRender( LPDIRECT3DDEVICE9 pd3dDevice );
- void Release(); // 仅当要更新该模型内容时调用该函数,比如你想再次LoadMeshFromFile()
- // 对象析构不必调用,因为析构函数中自动调用该函数以释放模型及纹理资源
- protected:
- bool m_bTextureCreateFromMesh;
- DWORD m_dwMtrl;
- D3DMATERIAL9* m_pMeshMtrl;
- ID3DXMesh* m_pMesh;
- IDirect3DTexture9* m_pTexture;
- IDirect3DTexture9** m_ppTextureFromMesh;
- };
- #endif //__d3d_ZFXMesh_H__