D3DDeviceInfoObject.h
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:3k
源码类别:

DirextX编程

开发平台:

Visual C++

  1. // Copyright (C) 1998-1999 DXGuide.  All Rights Reserved.
  2. // File: D3DDeviceInfoObject.h
  3. #ifndef _D3DDEVICEINFOOBJECT__H
  4. #define _D3DDEVICEINFOOBJECT__H
  5. #if _MSC_VER >= 1000
  6. #pragma once
  7. #endif // _MSC_VER >= 1000
  8. //#define _SKIP_FUNKYTEXTURE
  9. #include "DXDriverInfoObject.h"
  10. #include "DDPixelFormatObject.h"
  11. #include <afxtempl.h>
  12. #include "D3DTexture.h" // for CD3DTexture::BUMPMAPFORMAT & D3DDEVICEDESC7(indirect)
  13. enum D3DDEVICETYPE
  14. {
  15. D3DDEVICETYPE_TnLHAL,
  16. D3DDEVICETYPE_HAL,
  17. D3DDEVICETYPE_RGB,
  18. D3DDEVICETYPE_REF,
  19. D3DDEVICETYPE_NONE,
  20. D3DDEVICETYPE_NUM = D3DDEVICETYPE_NONE
  21. };
  22. class CD3DDeviceInfoObject : public CDXDriverInfoObject
  23. {
  24. friend class CDDDevice;
  25. friend class CD3DDevice;
  26. friend class CD3DTexture;
  27. protected:
  28. CD3DDeviceInfoObject(void);
  29. virtual ~CD3DDeviceInfoObject();
  30. protected:
  31. void SetD3DDeviceDesc(const D3DDEVICEDESC7*  pD3DDesc);
  32. protected:
  33. D3DDEVICEDESC7 const* GetD3DDeviceDesc(void) const;
  34. D3DDEVICETYPE GetD3DDeviceType(void);
  35. bool IsHardware(void) const;
  36. bool IsUseZBuffer(void) const;
  37. bool IsUseTextures(void) const;
  38. DWORD GetZBufferBitDepth(void) const;
  39. protected:
  40. bool LoadTextureFormats(
  41. const LPDIRECT3DDEVICE7  lpD3DDevice);
  42. bool LoadZBufferFormats(
  43. const LPDIRECT3D7  lpD3D);
  44. protected:
  45. void AddPixelFormat(const DDPIXELFORMAT*  pDDPF);
  46. protected:
  47. int GetTextureFormatNumber(void) const;
  48. CDDPixelFormatObject* GetSelectedTextureFormat(void) const;
  49. int GetZBuffersFormatNumber(void) const;
  50. CDDPixelFormatObject* GetSelectedZBufferFormat(void) const;
  51. protected:
  52. bool SelectTextureFormat(int  nPos);
  53. bool SelectTextureFormat(const DDPIXELFORMAT*  pDDPF);
  54. bool SelectFourCCTextureFormat(DWORD  dwFourCC);
  55. bool SelectPreMultAlphaTextureFormat(DWORD  dwAlphaBits,
  56. bool  bPremultipliedAlpha);
  57. bool SelectARGBTextureFormat(DWORD  dwABits,
  58. DWORD  dwRBits, DWORD  dwGBits, DWORD  dwBBits);
  59. bool SelectBPPTextureFormat(DWORD  dwBPP, DWORD  dwABits = 0);
  60. bool SelectBumpMapTextureFormat(CD3DTexture::BUMPMAPFORMAT  format);
  61. bool SelectCubeMapTextureFormat(DWORD  dwBPP);
  62. #if 0
  63. bool SelectAlphaTextureFormat(void);
  64. #endif // 0
  65. bool SelectZBufferFormat(int  nPos);
  66. bool SelectZBufferFormat(DWORD  dwFlags = DDPF_ZBUFFER, DWORD  dwBitDepth = 16);
  67. protected:
  68. D3DDEVICEDESC7* m_pD3DDesc;
  69. protected:
  70. static HRESULT CALLBACK D3DEnumPixelFormatsCallback(LPDDPIXELFORMAT  lpDDPixFmt,
  71. LPVOID  lpContext);
  72. protected:
  73. CTypedPtrArray<CObArray, CDDPixelFormatObject*> m_textureFormatInfoArray;
  74. int m_nSelectedTextureFormatPos;
  75. protected:
  76. CTypedPtrArray<CObArray, CDDPixelFormatObject*> m_ZBufferFormatInfoArray;
  77. int m_nSelectedZBufferFormatPos;
  78. protected:
  79. enum ADD_TYPE
  80. {
  81. ADD_NONE,
  82. ADD_TEXTUREFORMATS,
  83. ADD_ZBUFFERFORMATS,
  84. };
  85. ADD_TYPE m_AddType;
  86. };
  87. #include "D3DDeviceInfoObject.inl"
  88. #endif // _D3DDEVICEINFOOBJECT__H