D3DTexture.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:3k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: D3DTexture.h
- #ifndef _D3DTEXTURE__H
- #define _D3DTEXTURE__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- #pragma warning(disable: 4201)
- #include <d3d.h>
- #pragma warning(default: 4201)
- class CD3DDevice;
- class CDDSurface;
- class CPackFileManager;
- class CDIB;
- class CDDPalette;
- class CD3DTexture
- {
- // friend class CDirectShow; // m_lpD3DTexture
- public:
- // Texture creation and deletion functions
- enum D3DTEXTURE_FLAGS
- {
- D3DTEXTURE_TRANSPARENTWHITE = 0x00000001L,
- D3DTEXTURE_TRANSPARENTBLACK = 0x00000002L,
- D3DTEXTURE_32BITSPERPIXEL = 0x00000004L,
- };
- enum BUMPMAPFORMAT
- {
- BUMPMAP_NONE,
- BUMPMAP_U5V5L6,
- BUMPMAP_U8V8L8,
- BUMPMAP_U8V8
- };
- public:
- CD3DTexture();
- virtual ~CD3DTexture();
- public:
- bool Create(CD3DDevice* pD3DDevice,
- LPCTSTR lpszFileName,
- CPackFileManager* pPackFileManager/* = NULL*/,
- DWORD dwStage = 0,
- DWORD dwFlags = 0);
- bool CreateDDSTexture(CD3DDevice* pD3DDevice,
- LPCTSTR lpszFileName,
- CPackFileManager* pPackFileManager/* = NULL*/);
- bool CreateTargaTexture(CD3DDevice* pD3DDevice,
- LPCTSTR lpszFileName,
- CPackFileManager* pPackFileManager/* = NULL*/,
- DWORD dwStage = 0,
- DWORD dwFlags = 0);
- bool CreateDynamicTexture(CD3DDevice* pD3DDevice,
- DWORD dwWidth, DWORD dwHeight, DWORD dwBPP);
- bool CreateBumpMapTexture(CD3DDevice* pD3DDevice,
- LPCTSTR lpszFileName, CPackFileManager* pPackFileManager,
- BUMPMAPFORMAT format, DWORD dwStage = 0);
- bool CreateInvAlphaTexFromTex(CD3DTexture* pSrcTexture);
- bool SetAsCurrent(void);
- void SetStage(DWORD dwStage);
- bool IsMipTexture(void) const; // does texture have mipmaps?
- bool IsPremultipliedAlpha(void) const;
- protected:
- bool GetD3DTextureInterface(void);
- bool CopyBitmapToSurface(DWORD dwFlags);
- bool CopyRGBADataToSurface(DWORD dwWidth,
- DWORD dwHeight, DWORD* pdwRGBAData);
- bool BltToUncompressedSurface(
- DDSURFACEDESC2* pDDSD, const DDPIXELFORMAT* pDDPF);
- bool SetupTexture(DWORD dwWidth, DWORD dwHeight,
- DWORD dwBPP, DWORD dwAlphaBit, bool bDynamic,
- BUMPMAPFORMAT format);
- bool CreateTempSurface(DDSURFACEDESC2& ddsd,
- DWORD dwWidth, DWORD dwHeight,
- CDDSurface& ddsTempSurface);
- public:
- CDDSurface* m_pSurface;
- protected:
- CDDPalette* m_pPalette;
- CDIB* m_pDIB;
- CD3DDevice* m_pD3DDevice;
- DWORD m_dwStage; // Texture stage (for multi-textures).
- DWORD m_dwMipmapCount;
- bool m_bPremultipliedAlpha;
- };
- #include "D3DTexture.inl"
- #endif // _D3DTEXTURE__H