2508
|
1 #pragma once
|
2496
|
2
|
|
3 #include <cstdint>
|
|
4 #include <cstdio>
|
|
5
|
|
6 #include "lib\legacy_dx\d3d.h"
|
|
7 #include <d3d11.h>
|
|
8
|
|
9 #include "OSWindow.h"
|
|
10 #include "RenderStruct.h"
|
|
11
|
2499
|
12 #include "../VectorTypes.h"
|
2496
|
13
|
|
14 #include "IRender.h"
|
|
15
|
|
16 struct RenderD3D11: public IRender
|
|
17 {
|
|
18 RenderD3D11();
|
|
19 virtual ~RenderD3D11();
|
|
20
|
|
21 static RenderD3D11 *Create() {return new RenderD3D11;}
|
|
22
|
|
23 virtual bool Initialize(OSWindow *window);
|
|
24
|
|
25 virtual void ClearBlack();
|
|
26 virtual void PresentBlackScreen();
|
|
27
|
|
28 virtual void SaveWinnersCertificate(const char *a1);
|
|
29 virtual void ClearTarget(unsigned int uColor);
|
|
30 virtual void Present();
|
|
31
|
|
32 virtual void _49FD3A_fullscreen();
|
|
33 virtual bool InitializeFullscreen();
|
|
34
|
|
35 virtual void CreateZBuffer();
|
|
36 virtual void Release();
|
|
37
|
|
38 virtual bool SwitchToWindow();
|
|
39 virtual void RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor);
|
|
40 virtual void ClearZBuffer(int a2, int a3);
|
|
41 virtual void SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
|
|
42 virtual bool LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags);
|
|
43 virtual void GetTargetPixelFormat(DDPIXELFORMAT *pOut);
|
|
44 virtual void LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow);
|
|
45 virtual void UnlockBackBuffer();
|
|
46 virtual void LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow);
|
|
47 virtual void UnlockFrontBuffer();
|
|
48 virtual void RestoreFrontBuffer();
|
|
49 virtual void RestoreBackBuffer();
|
|
50 virtual void BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags);
|
|
51 virtual void BltBackToFontFast(int a2, int a3, RECT *pSrcRect);
|
|
52 virtual void BeginSceneD3D();
|
|
53
|
|
54 virtual unsigned int GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6);
|
|
55
|
|
56 virtual void DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture);
|
|
57 virtual void DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders);
|
|
58 virtual void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8);
|
|
59
|
|
60 virtual void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
|
|
61 virtual void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
|
|
62
|
|
63 virtual void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
|
|
64 virtual void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level);
|
|
65 virtual void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse);
|
|
66 virtual void TransformBillboardsAndSetPalettesODM();
|
|
67 virtual void DrawBillboardList_BLV();
|
|
68
|
|
69 virtual void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9);
|
|
70 virtual bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture);
|
|
71 virtual bool MoveSpriteToDevice(Sprite *pSprite);
|
|
72
|
|
73 virtual void BeginScene();
|
|
74 virtual void EndScene();
|
|
75 virtual void ScreenFade(unsigned int color, float t);
|
|
76
|
2524
|
77 virtual void SetUIClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
|
|
78 virtual void ResetUIClipRect();
|
2518
|
79 virtual void CreditsTextureScroll(unsigned int pX, unsigned int pY, int move_X, int move_Y, RGBTexture *pTexture);
|
|
80
|
|
81 virtual void DrawTextureNew(float u, float v, struct Texture *);
|
|
82 virtual void DrawTextureNew(float u, float v, struct RGBTexture *);
|
2496
|
83 virtual void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
|
2536
|
84 virtual void DrawTextureIndexed(signed int x, signed int y, struct Texture *tex);
|
2496
|
85
|
|
86 virtual void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5);
|
|
87 virtual void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal);
|
2524
|
88 virtual void DrawTextureIndexedAlpha(unsigned int uX, unsigned int uY, struct Texture *pTexture);
|
2496
|
89 virtual void DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
|
|
90 virtual void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
|
|
91
|
|
92 virtual void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4);
|
|
93 virtual void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture);
|
|
94 virtual void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices);
|
|
95
|
|
96 virtual void DrawMasked(signed int a2, signed int a3, struct Texture *pTexture, unsigned __int16 mask);
|
|
97 virtual void GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height);
|
|
98
|
2525
|
99 virtual void DrawTextAlpha(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, bool present_time_transparency);
|
2496
|
100 virtual void DrawText(signed int uOutX, signed int uOutY, unsigned __int8 *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned __int16 *pFontPalette, unsigned __int16 uFaceColor, unsigned __int16 uShadowColor);
|
|
101
|
|
102 virtual void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16);
|
|
103 virtual void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7);
|
|
104 virtual void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture *a4);
|
|
105
|
|
106 virtual void DrawBuildingsD3D();
|
|
107
|
|
108 virtual void DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID);
|
|
109 virtual void DrawOutdoorSkyD3D();
|
|
110 virtual void DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture);
|
|
111 virtual void DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture);
|
|
112
|
|
113 virtual void PrepareDecorationsRenderList_ODM();
|
|
114 virtual void DrawSpriteObjects_ODM();
|
|
115
|
|
116 virtual void RenderTerrainD3D();
|
|
117
|
|
118 virtual bool AreRenderSurfacesOk();
|
|
119 virtual bool IsGammaSupported();
|
|
120
|
|
121 virtual void SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height);
|
|
122 virtual void PackScreenshot(unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size);
|
|
123 virtual void SavePCXScreenshot();
|
|
124
|
|
125 virtual int _46À6ÀÑ_GetActorsInViewport(int pDepth);
|
|
126
|
|
127 virtual void BeginLightmaps();
|
|
128 virtual void EndLightmaps();
|
|
129 virtual void BeginLightmaps2();
|
|
130 virtual void EndLightmaps2();
|
|
131 virtual bool DrawLightmap(struct Lightmap *pLightmap, struct Vec3_float_ *pColorMult, float z_bias);
|
|
132
|
|
133 virtual void BeginDecals();
|
|
134 virtual void EndDecals();
|
|
135 virtual void DrawDecal(struct Decal *pDecal, float z_bias);
|
|
136
|
|
137 virtual void do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff);
|
|
138 virtual void DrawLines(const RenderVertexD3D3 *vertices, unsigned int num_vertices);
|
|
139
|
|
140 virtual void DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture);
|
|
141
|
|
142 virtual void am_Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3);
|
|
143 virtual void am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode);
|
|
144
|
|
145 public:
|
|
146
|
|
147 virtual void WritePixel16(int x, int y, unsigned __int16 color)
|
|
148 {
|
|
149 __debugbreak();
|
|
150 }
|
|
151
|
|
152 virtual unsigned __int16 ReadPixel16(int x, int y)
|
|
153 {
|
|
154 __debugbreak(); return 0;
|
|
155 }
|
|
156
|
|
157 virtual void ToggleTint() {}
|
|
158 virtual void ToggleColoredLights() {}
|
|
159
|
|
160 virtual unsigned int GetRenderWidth() {return window->GetWidth();}
|
|
161 virtual unsigned int GetRenderHeight() {return window->GetHeight();}
|
|
162
|
|
163 virtual void Sub01();
|
|
164
|
|
165
|
|
166 protected:
|
2524
|
167 void DrawTexture(float u, float v, int texture_width, int texture_height, ID3D11ShaderResourceView *srv, ID3D11BlendState *blend);
|
|
168 void PrepareTexture(struct RGBTexture *p);
|
|
169 void PrepareTextureIndexed(struct Texture *p);
|
|
170 ID3D11ShaderResourceView *PrepareFontTexture(unsigned char *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned short *pFontPalette, unsigned short uFaceColor, unsigned short uShadowColor);
|
2525
|
171 ID3D11ShaderResourceView *PrepareFontTexture(unsigned char *pFontPixels, unsigned int uCharWidth, unsigned int uCharHeight, unsigned short *pFontPalette);
|
2524
|
172
|
2496
|
173 OSWindow *window;
|
|
174
|
|
175 IDXGISwapChain *pSwapChain;
|
|
176 ID3D11Device *d3dd;
|
|
177 ID3D11DeviceContext *d3dc;
|
|
178 ID3D11RenderTargetView *primary_srv;
|
2525
|
179 ID3D11DepthStencilView *default_depth_srv;
|
2521
|
180 ID3D11RasterizerState *default_rasterizer;
|
|
181 ID3D11DepthStencilState *default_depthstencil;
|
|
182 ID3D11BlendState *default_blend;
|
2518
|
183
|
2521
|
184 ID3D11VertexShader *ui_vs;
|
|
185 ID3D11PixelShader *ui_ps;
|
2523
|
186 ID3D11Buffer *ui_cb_fast;
|
2521
|
187 ID3D11InputLayout *ui_layout;
|
|
188 ID3D11Buffer *ui_vb;
|
|
189 ID3D11DepthStencilState *ui_depthstencil;
|
2524
|
190 ID3D11BlendState *ui_blend_solid;
|
|
191 ID3D11BlendState *ui_blend_alpha;
|
|
192 ID3D11RasterizerState *ui_rasterizer;
|
|
193 D3D11_RECT ui_clip_rect;
|
|
194
|
|
195
|
|
196 RenderHWLContainer pD3DBitmaps;
|
|
197 RenderHWLContainer pD3DSprites;
|
2496
|
198 };
|