D3DDeviceInfoObject.h
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:3k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1998-1999 DXGuide. All Rights Reserved.
- // File: D3DDeviceInfoObject.h
- #ifndef _D3DDEVICEINFOOBJECT__H
- #define _D3DDEVICEINFOOBJECT__H
- #if _MSC_VER >= 1000
- #pragma once
- #endif // _MSC_VER >= 1000
- //#define _SKIP_FUNKYTEXTURE
- #include "DXDriverInfoObject.h"
- #include "DDPixelFormatObject.h"
- #include <afxtempl.h>
- #include "D3DTexture.h" // for CD3DTexture::BUMPMAPFORMAT & D3DDEVICEDESC7(indirect)
- enum D3DDEVICETYPE
- {
- D3DDEVICETYPE_TnLHAL,
- D3DDEVICETYPE_HAL,
- D3DDEVICETYPE_RGB,
- D3DDEVICETYPE_REF,
- D3DDEVICETYPE_NONE,
- D3DDEVICETYPE_NUM = D3DDEVICETYPE_NONE
- };
- class CD3DDeviceInfoObject : public CDXDriverInfoObject
- {
- friend class CDDDevice;
- friend class CD3DDevice;
- friend class CD3DTexture;
- protected:
- CD3DDeviceInfoObject(void);
- virtual ~CD3DDeviceInfoObject();
- protected:
- void SetD3DDeviceDesc(const D3DDEVICEDESC7* pD3DDesc);
- protected:
- D3DDEVICEDESC7 const* GetD3DDeviceDesc(void) const;
- D3DDEVICETYPE GetD3DDeviceType(void);
- bool IsHardware(void) const;
- bool IsUseZBuffer(void) const;
- bool IsUseTextures(void) const;
- DWORD GetZBufferBitDepth(void) const;
- protected:
- bool LoadTextureFormats(
- const LPDIRECT3DDEVICE7 lpD3DDevice);
- bool LoadZBufferFormats(
- const LPDIRECT3D7 lpD3D);
- protected:
- void AddPixelFormat(const DDPIXELFORMAT* pDDPF);
- protected:
- int GetTextureFormatNumber(void) const;
- CDDPixelFormatObject* GetSelectedTextureFormat(void) const;
- int GetZBuffersFormatNumber(void) const;
- CDDPixelFormatObject* GetSelectedZBufferFormat(void) const;
- protected:
- bool SelectTextureFormat(int nPos);
- bool SelectTextureFormat(const DDPIXELFORMAT* pDDPF);
- bool SelectFourCCTextureFormat(DWORD dwFourCC);
- bool SelectPreMultAlphaTextureFormat(DWORD dwAlphaBits,
- bool bPremultipliedAlpha);
- bool SelectARGBTextureFormat(DWORD dwABits,
- DWORD dwRBits, DWORD dwGBits, DWORD dwBBits);
- bool SelectBPPTextureFormat(DWORD dwBPP, DWORD dwABits = 0);
- bool SelectBumpMapTextureFormat(CD3DTexture::BUMPMAPFORMAT format);
- bool SelectCubeMapTextureFormat(DWORD dwBPP);
- #if 0
- bool SelectAlphaTextureFormat(void);
- #endif // 0
- bool SelectZBufferFormat(int nPos);
- bool SelectZBufferFormat(DWORD dwFlags = DDPF_ZBUFFER, DWORD dwBitDepth = 16);
- protected:
- D3DDEVICEDESC7* m_pD3DDesc;
- protected:
- static HRESULT CALLBACK D3DEnumPixelFormatsCallback(LPDDPIXELFORMAT lpDDPixFmt,
- LPVOID lpContext);
- protected:
- CTypedPtrArray<CObArray, CDDPixelFormatObject*> m_textureFormatInfoArray;
- int m_nSelectedTextureFormatPos;
- protected:
- CTypedPtrArray<CObArray, CDDPixelFormatObject*> m_ZBufferFormatInfoArray;
- int m_nSelectedZBufferFormatPos;
- protected:
- enum ADD_TYPE
- {
- ADD_NONE,
- ADD_TEXTUREFORMATS,
- ADD_ZBUFFERFORMATS,
- };
- ADD_TYPE m_AddType;
- };
- #include "D3DDeviceInfoObject.inl"
- #endif // _D3DDEVICEINFOOBJECT__H