Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cDXTexture.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cDXTexture_H
7 #define _INC_cDXTexture_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 #include "cDXBase.h"
12 #include "GrayLib/include/WinAPI/WinTypes.h" // cWinSize
15 #include "GrayCore/include/IUnknown.h" // __IUnknown_INTERFACE_DEFINED__
16 
17 namespace Gray3D
18 {
20  : public cDXBase
21  {
26 
27  typedef cDXBase SUPER_t;
28 
29  public:
31  protected:
32  cIUnkPtr<ID3DTexture> m_pDXTexture; // IDirect3DTexture9
35 
36  protected:
37  HRESULT UpdateFullOpaqueHint();
38 
39  public:
40  cDXTextureBase(PIXELS_t cx = 0, PIXELS_t cy = 0);
41  virtual ~cDXTextureBase();
42 
43  STDMETHOD_(cString, get_Name)() const = 0;
44 
45  virtual bool UpdateOrigSize()
46  {
48  return true;
49  }
50  PIXELS_t get_OrigSizeX() const noexcept
51  {
52  return m_SizeOrig.cx;
53  }
54  PIXELS_t get_OrigSizeY() const noexcept
55  {
56  return m_SizeOrig.cy;
57  }
59  {
60  UpdateOrigSize();
61  return m_SizeOrig;
62  }
63 
64  bool isLoaded() const noexcept
65  {
66  return m_pDXTexture != nullptr ;
67  }
68  ID3DTexture* get_DXTexture();
69 
70  virtual HRESULT DeleteDeviceObjects();
71 
72  HRESULT UpdateDescSize();
73  bool GetDescSize(SIZE* pSize);
74 
75  bool IsFullOpaque() const noexcept
76  {
77  // Test D3DFMT_X8R8G8B8 ?
78  return m_IsFullOpaque; // No need for alpha.
79  }
80  };
81 
83  : public cDXTextureBase
84  {
89  typedef cDXTextureBase SUPER_t;
90  friend class cDXSurface;
91 
92  protected:
93  UINT m_nMipLevels;
95  DWORD m_dwUsage;
97 
98  private:
99  cDXTexture(const cDXTexture&);
100  public:
101  cDXTexture(PIXELS_t nWidth, PIXELS_t nHeight, UINT nMipLevels, D3DFORMAT eFormat, DWORD dwUsage, D3DPOOL ePool = D3DPOOL_DEFAULT);
102  virtual ~cDXTexture();
103 
104  STDMETHOD_(cString, get_Name)() const override
105  {
106  return "DXTexture";
107  }
108 
109  virtual HRESULT InitDeviceObjects(cDXDevice* pDXDev);
110  virtual HRESULT DeleteDeviceObjects();
111  };
112 }
113 #endif // _INC_cDXTexture_H
#define GRAY3D_LINK
Definition: Gray3D.h:15
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
enum _D3DPOOL D3DPOOL
@ D3DPOOL_DEFAULT
Definition: UseDX.h:285
enum _D3DFORMAT D3DFORMAT
Definition: cDXBase.h:20
Definition: cDXDevice.h:20
Definition: cDXTexture.h:21
PIXELS_t get_OrigSizeY() const noexcept
Definition: cDXTexture.h:54
bool m_IsFullOpaque
alpha mask doesn't exist or is all ones. render this faster if assumed to be opaque....
Definition: cDXTexture.h:34
cWinSize m_SizeOrig
PIXELS_t size i intended it to be, may not be allocated/aligned size. before TEXTURELOAD_FILTER.
Definition: cDXTexture.h:30
bool isLoaded() const noexcept
Definition: cDXTexture.h:64
cWinSize m_SizeDesc
allocated size for the texture. may be rounded up to power of 2 (if TEXTURELOAD_FILTER)
Definition: cDXTexture.h:33
cWinSize get_OrigSize()
Definition: cDXTexture.h:58
cIUnkPtr< ID3DTexture > m_pDXTexture
Definition: cDXTexture.h:32
bool IsFullOpaque() const noexcept
Definition: cDXTexture.h:75
PIXELS_t get_OrigSizeX() const noexcept
Definition: cDXTexture.h:50
virtual bool UpdateOrigSize()
Definition: cDXTexture.h:45
STDMETHOD_(cString, get_Name)() const =0
Definition: cDXTexture.h:84
DWORD m_dwUsage
D3DXCreateTexture D3DUSAGE_RENDERTARGET , mask.
Definition: cDXTexture.h:95
D3DPOOL m_ePool
D3DPOOL_DEFAULT, D3DPOOL_SYSTEMMEM.
Definition: cDXTexture.h:96
STDMETHOD_(cString, get_Name)() const override
Definition: cDXTexture.h:104
UINT m_nMipLevels
0 if D3DUSAGE_AUTOGENMIPMAP
Definition: cDXTexture.h:93
D3DFORMAT m_eFormat
D3DFMT_X8R8G8B8.
Definition: cDXTexture.h:94
Definition: WinTypes.h:128
Definition: cIUnkPtr.h:32
Definition: IUnknown.h:68
Definition: Gray3D.cpp:12
int PIXELS_t
Count of pixels in a dimension of some image/surface.
Definition: cSurfaceInfo.h:20