World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
RenderD3D.h
См. документацию.
1 #pragma once
2 
3 #include <d3d.h>
4 #include <ddraw.h>
5 
6 #include "Engine/VectorTypes.h"
7 
8 #define ErrD3D(hr) \
9  do { \
10  extern void ErrHR(HRESULT, const char *, const char *, const char *, \
11  int); \
12  ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__); \
13  } while (0)
14 
15 struct Polygon;
16 struct Texture_MM7;
17 struct ODMFace;
18 
21  : bIsDeviceCompatible(false),
22  pName(nullptr),
23  pDescription(nullptr),
24  pGUID(nullptr),
25  uCaps(0),
26  pDriverName(nullptr),
27  pDeviceDesc(nullptr),
28  pDDraw4DevDesc(nullptr),
29  pDirectDrawGUID(nullptr),
30  uVideoMem(0) {}
31 
32  unsigned int bIsDeviceCompatible;
33  char *pName;
34  char *pDescription;
35  GUID *pGUID;
36  unsigned int uCaps;
37  char *pDriverName;
38  char *pDeviceDesc;
41  int uVideoMem;
42 };
43 
44 class Sprite;
45 class SpriteFrame;
46 
48  int field_0;
49  int field_4;
50  int field_8;
51  int field_C;
52  int field_10;
53  char *pDriverName;
54  char *pDeviceDesc;
56  GUID *pGUID;
57  unsigned int uVideoMem;
58 };
59 
60 struct RenderD3D_aux {
63 };
64 
65 class OSWindow;
66 
67 class RenderD3D {
68  public:
69  RenderD3D();
70 
71  void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices);
72  void Release();
73  bool CreateDevice(unsigned int uDeviceID, int bWindowed, OSWindow *window);
74  unsigned int GetDeviceCaps();
75  void ClearTarget(unsigned int bClearColor, unsigned int uClearColor,
76  unsigned int bClearDepth, float z_clear);
77  void Present(bool bForceBlit);
78  bool CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight,
79  IDirectDrawSurface4 **pOutSurface,
80  IDirect3DTexture2 **pOutTexture, bool bAlphaChannel,
81  bool bMipmaps, unsigned int uMinDeviceTexDim);
82  void HandleLostResources();
83 
84  unsigned int bWindowed;
85  int field_4;
86  int field_8;
87  HWND hWindow;
88  int field_10;
89  int field_14;
90  int field_18;
92  IDirectDraw4 *pHost;
93  IDirect3D3 *pDirect3D;
94  IUnknown *pUnk;
95  IDirectDrawSurface4 *pBackBuffer;
96  IDirectDrawSurface4 *pFrontBuffer;
97  IDirectDrawSurface4 *pZBuffer;
98  IDirect3DDevice3 *pDevice;
99  IDirect3DViewport3 *pViewport;
100  int field_40;
101  int field_44;
102  char pErrorMessage[48];
103  char field_78[208];
104 };
105 
106 extern struct RenderVertexD3D3 pVertices[50];
107 
108 extern struct IDirectDrawClipper *pDDrawClipper;
109 extern struct pUnkTerrain *Unks;
RenderD3D::field_8
int field_8
Definition: RenderD3D.h:86
RenderD3D::pDirect3D
IDirect3D3 * pDirect3D
Definition: RenderD3D.h:93
RenderD3D::field_14
int field_14
Definition: RenderD3D.h:89
RenderD3D::GetAvailableDevices
void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices)
Definition: RenderD3D.cpp:177
RenderD3D::field_78
char field_78[208]
Definition: RenderD3D.h:103
VectorTypes.h
RenderD3D::pFrontBuffer
IDirectDrawSurface4 * pFrontBuffer
Definition: RenderD3D.h:96
Polygon
Definition: Polygon.h:14
RenderD3D__DevInfo::pGUID
GUID * pGUID
Definition: RenderD3D.h:35
RenderD3D__DevInfo
Definition: RenderD3D.h:19
RenderD3D::pErrorMessage
char pErrorMessage[48]
Definition: RenderD3D.h:102
RenderD3D::pHost
IDirectDraw4 * pHost
Definition: RenderD3D.h:92
RenderD3D_D3DDevDesc::pDeviceDesc
char * pDeviceDesc
Definition: RenderD3D.h:54
RenderD3D::field_44
int field_44
Definition: RenderD3D.h:101
RenderD3D::pZBuffer
IDirectDrawSurface4 * pZBuffer
Definition: RenderD3D.h:97
RenderVertexD3D3
Definition: IRender.h:129
RenderD3D__DevInfo::pName
char * pName
Definition: RenderD3D.h:33
RenderD3D::RenderD3D
RenderD3D()
Definition: RenderD3D.cpp:187
RenderD3D__DevInfo::pDirectDrawGUID
GUID * pDirectDrawGUID
Definition: RenderD3D.h:40
Sprite
Definition: Sprites.h:10
OSWindow
Definition: OSWindow.h:12
RenderD3D::field_40
int field_40
Definition: RenderD3D.h:100
RenderD3D::pAvailableDevices
RenderD3D__DevInfo * pAvailableDevices
Definition: RenderD3D.h:91
pDDrawClipper
struct IDirectDrawClipper * pDDrawClipper
Definition: Render.cpp:49
RenderD3D__DevInfo::pDDraw4DevDesc
char * pDDraw4DevDesc
Definition: RenderD3D.h:39
RenderD3D::bWindowed
unsigned int bWindowed
Definition: RenderD3D.h:84
RenderD3D_D3DDevDesc::field_0
int field_0
Definition: RenderD3D.h:48
RenderD3D::HandleLostResources
void HandleLostResources()
Definition: RenderD3D.cpp:856
RenderD3D::pDevice
IDirect3DDevice3 * pDevice
Definition: RenderD3D.h:98
RenderD3D__DevInfo::pDescription
char * pDescription
Definition: RenderD3D.h:34
window
EGLSurface EGLNativeWindowType * window
Definition: SDL_egl.h:1580
RenderD3D::CreateDevice
bool CreateDevice(unsigned int uDeviceID, int bWindowed, OSWindow *window)
Definition: RenderD3D.cpp:291
RenderD3D_aux::ptr_4
RenderD3D_D3DDevDesc * ptr_4
Definition: RenderD3D.h:62
RenderD3D_D3DDevDesc::pDriverName
char * pDriverName
Definition: RenderD3D.h:53
RenderD3D_D3DDevDesc
Definition: RenderD3D.h:47
RenderD3D__DevInfo::uVideoMem
int uVideoMem
Definition: RenderD3D.h:41
RenderD3D::pViewport
IDirect3DViewport3 * pViewport
Definition: RenderD3D.h:99
RenderD3D_D3DDevDesc::pDDraw4DevDesc
char * pDDraw4DevDesc
Definition: RenderD3D.h:55
RenderD3D__DevInfo::RenderD3D__DevInfo
RenderD3D__DevInfo()
Definition: RenderD3D.h:20
Texture_MM7
Definition: Image.h:97
RenderD3D_D3DDevDesc::field_10
int field_10
Definition: RenderD3D.h:52
Unks
struct pUnkTerrain * Unks
RenderD3D::Release
void Release()
Definition: RenderD3D.cpp:201
RenderD3D::GetDeviceCaps
unsigned int GetDeviceCaps()
Definition: RenderD3D.cpp:702
RenderD3D_D3DDevDesc::field_4
int field_4
Definition: RenderD3D.h:49
RenderD3D::pBackBuffer
IDirectDrawSurface4 * pBackBuffer
Definition: RenderD3D.h:95
RenderD3D_D3DDevDesc::field_C
int field_C
Definition: RenderD3D.h:51
RenderD3D::Present
void Present(bool bForceBlit)
Definition: RenderD3D.cpp:747
SpriteFrame
Definition: Sprites.h:39
ODMFace
Definition: BSPModel.h:93
RenderD3D::pUnk
IUnknown * pUnk
Definition: RenderD3D.h:94
RenderD3D_aux
Definition: RenderD3D.h:60
RenderD3D__DevInfo::bIsDeviceCompatible
unsigned int bIsDeviceCompatible
Definition: RenderD3D.h:32
RenderD3D__DevInfo::pDeviceDesc
char * pDeviceDesc
Definition: RenderD3D.h:38
RenderD3D_D3DDevDesc::field_8
int field_8
Definition: RenderD3D.h:50
pVertices
struct RenderVertexD3D3 pVertices[50]
Definition: Render.cpp:50
RenderD3D::ClearTarget
void ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear)
Definition: RenderD3D.cpp:735
RenderD3D_aux::pInfo
RenderD3D__DevInfo * pInfo
Definition: RenderD3D.h:61
RenderD3D::hWindow
HWND hWindow
Definition: RenderD3D.h:87
RenderD3D_D3DDevDesc::uVideoMem
unsigned int uVideoMem
Definition: RenderD3D.h:57
RenderD3D__DevInfo::uCaps
unsigned int uCaps
Definition: RenderD3D.h:36
RenderD3D::field_10
int field_10
Definition: RenderD3D.h:88
RenderD3D::CreateTexture
bool CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim)
Definition: RenderD3D.cpp:781
RenderD3D_D3DDevDesc::pGUID
GUID * pGUID
Definition: RenderD3D.h:56
RenderD3D__DevInfo::pDriverName
char * pDriverName
Definition: RenderD3D.h:37
RenderD3D::field_18
int field_18
Definition: RenderD3D.h:90
RenderD3D
Definition: RenderD3D.h:67
RenderD3D::field_4
int field_4
Definition: RenderD3D.h:85