annotate Render.h @ 2457:17ac6a47f8fb

speed actors
author Ritor1
date Sat, 26 Jul 2014 10:42:29 +0600
parents 2d3c3d1dff0c
children 1d04e48651d4
rev   line source
0
Ritor1
parents:
diff changeset
1 #pragma once
1512
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
2
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
3 #include <cstdint>
af57b3b76fe4 Clean and decouple. (1)
yoctozepto
parents: 1496
diff changeset
4 #include <cstdio>
0
Ritor1
parents:
diff changeset
5
Ritor1
parents:
diff changeset
6 #include "lib\legacy_dx\d3d.h"
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1675
diff changeset
7 #include "OSWindow.h"
2410
2d3c3d1dff0c added RenderStruct.h
Ritor1
parents: 2404
diff changeset
8 #include "RenderStruct.h"
0
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10 #include "VectorTypes.h"
Ritor1
parents:
diff changeset
11
Ritor1
parents:
diff changeset
12 struct Render
Ritor1
parents:
diff changeset
13 {
Ritor1
parents:
diff changeset
14 Render();
Ritor1
parents:
diff changeset
15 ~Render();
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17 static Render *Create() {return new Render;}
Ritor1
parents:
diff changeset
18
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
19 bool Initialize(OSWindow *window, bool bColoredLights, uint32_t uDetailLevel, bool bTinting);
0
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21
Ritor1
parents:
diff changeset
22 void ClearBlack();
Ritor1
parents:
diff changeset
23 void PresentBlackScreen();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
24
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
25 void SaveWinnersCertificate(const char *a1);
0
Ritor1
parents:
diff changeset
26 void ClearTarget(unsigned int uColor);
Ritor1
parents:
diff changeset
27 void Present();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
28
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
29 void _49FD3A_fullscreen();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
30 bool InitializeFullscreen();
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
31
0
Ritor1
parents:
diff changeset
32 void CreateZBuffer();
Ritor1
parents:
diff changeset
33 void Release();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
34
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1675
diff changeset
35 bool SwitchToWindow();
2102
0db53678ff48 RasterLine2D, DIALOGUE_EVT_A etc.
Ritor1
parents: 2101
diff changeset
36 void RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor);
0
Ritor1
parents:
diff changeset
37 void ClearZBuffer(int a2, int a3);
709
af08fc9e29c8 Items (blue dots) on minimap fixed
Nomad
parents: 688
diff changeset
38 void SetRasterClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
0
Ritor1
parents:
diff changeset
39 bool LockSurface_DDraw4(IDirectDrawSurface4 *pSurface, DDSURFACEDESC2 *pDesc, unsigned int uLockFlags);
Ritor1
parents:
diff changeset
40 void GetTargetPixelFormat(DDPIXELFORMAT *pOut);
Ritor1
parents:
diff changeset
41 void LockRenderSurface(void **pOutSurfacePtr, unsigned int *pOutPixelsPerRow);
Ritor1
parents:
diff changeset
42 void UnlockBackBuffer();
Ritor1
parents:
diff changeset
43 void LockFrontBuffer(void **pOutSurface, unsigned int *pOutPixelsPerRow);
Ritor1
parents:
diff changeset
44 void UnlockFrontBuffer();
Ritor1
parents:
diff changeset
45 void RestoreFrontBuffer();
2152
d44b7775fc06 Removed DirectDraw2 compatibility.
Nomad
parents: 2128
diff changeset
46 void RestoreBackBuffer();
0
Ritor1
parents:
diff changeset
47 void BltToFront(RECT *pDstRect, IDirectDrawSurface *pSrcSurface, RECT *pSrcRect, unsigned int uBltFlags);
Ritor1
parents:
diff changeset
48 void BltBackToFontFast(int a2, int a3, RECT *a4);
Ritor1
parents:
diff changeset
49 void BeginSceneD3D();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
50
349
672b83584b0f GetActorTintColor
Nomad
parents: 315
diff changeset
51 unsigned int GetActorTintColor(float a2, int tint, int a4, int a5, RenderBillboard *a6);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
52
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
53 void DrawPolygon(unsigned int uNumVertices, struct Polygon *a3, ODMFace *a4, IDirect3DTexture2 *pTexture);
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
54 void DrawTerrainPolygon(unsigned int uNumVertices, struct Polygon *a4, IDirect3DTexture2 *a5, bool transparent, bool clampAtTextureBorders);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
55 void DrawIndoorPolygon(unsigned int uNumVertices, struct BLVFace *a3, IDirect3DTexture2 *pHwTex, struct Texture *pTex, int uPackedID, unsigned int uColor, int a8);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
56
0
Ritor1
parents:
diff changeset
57 void MakeParticleBillboardAndPush_BLV(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
Ritor1
parents:
diff changeset
58 void MakeParticleBillboardAndPush_ODM(RenderBillboardTransform_local0 *a2, IDirect3DTexture2 *a3, unsigned int uDiffuse, int angle);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
59
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
60 void DrawBillboards_And_MaybeRenderSpecialEffects_And_EndScene();
717
Ritor1
parents: 688
diff changeset
61 void DrawBillboard_Indoor(RenderBillboardTransform_local0 *pSoftBillboard, Sprite *pSprite, int dimming_level);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
62 void _4A4CC9_AddSomeBillboard(struct stru6_stru1_indoor_sw_billboard *a1, int diffuse);
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
63 void TransformBillboardsAndSetPalettesODM();
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
64 void DrawBillboardList_BLV();
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
65
0
Ritor1
parents:
diff changeset
66 void DrawProjectile(float srcX, float srcY, float a3, float a4, float dstX, float dstY, float a7, float a8, IDirect3DTexture2 *a9);
Ritor1
parents:
diff changeset
67 bool LoadTexture(const char *pName, unsigned int bMipMaps, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture);
670
9824e2eeee30 fixed decorations animation
Gloval
parents: 657
diff changeset
68 bool MoveSpriteToDevice(Sprite *pSprite);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
69
0
Ritor1
parents:
diff changeset
70 void BeginScene();
Ritor1
parents:
diff changeset
71 void EndScene();
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
72 void ScreenFade(unsigned int color, float t);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
73
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
74 void SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW);
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
75 void ResetTextureClipRect();
0
Ritor1
parents:
diff changeset
76 void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4);
1675
f1cdf8c062d4 MainMenuUI_Credits_Loop() and CreditsTextureScroll
Ritor1
parents: 1655
diff changeset
77 void CreditsTextureScroll(unsigned int pX, unsigned int pY, int move_X, int move_Y, RGBTexture *pTexture);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
78 void DrawTextureIndexed(unsigned int uX, unsigned int uY, struct Texture *a4);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
79
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
80 void ZBuffer_Fill_2(signed int a2, signed int a3, struct Texture *pTexture, int a5);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
81 void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, struct Texture *pTexture, int zVal);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
82 void DrawTextureTransparent(unsigned int uX, unsigned int uY, struct Texture *pTexture);
1455
bfe342ae0c1f DrawPaperdoll cleaning
Ritor1
parents: 1427
diff changeset
83 void DrawAura(unsigned int a2, unsigned int a3, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
84 void _4A65CC(unsigned int x, unsigned int y, struct Texture *a4, struct Texture *a5, int a6, int a7, int a8);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
85
1262
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
86 void DrawTransparentRedShade(unsigned int a2, unsigned int a3, struct Texture *a4);
0aeac0b9ca30 included header cleanup
Grumpy7
parents: 1207
diff changeset
87 void DrawTransparentGreenShade(signed int a2, signed int a3, struct Texture *pTexture);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
88 void DrawFansTransparent(const RenderVertexD3D3 *vertices, unsigned int num_vertices);
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
89
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
90 void DrawMasked(signed int a2, signed int a3, struct Texture *pTexture, unsigned __int16 mask);
1496
ab6bf38b2940 UIGame.cpp cleaning(continue)
Ritor1
parents: 1458
diff changeset
91 void GetLeather(unsigned int a2, unsigned int a3, struct Texture *a4, __int16 height);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
92
1268
2929c4406d2c guiwindow funcs cleanup
Gloval
parents: 1262
diff changeset
93 void DrawTextPalette(int x, int y, unsigned char* font_pixels, int a5, unsigned int uFontHeight, unsigned __int16 *pPalette, int a8);
0
Ritor1
parents:
diff changeset
94 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);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
95
0
Ritor1
parents:
diff changeset
96 void FillRectFast(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uColor16);
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
97 void _4A6DF5(unsigned __int16 *pBitmap, unsigned int uBitmapPitch, struct Vec2_int_ *pBitmapXY, void *pTarget, unsigned int uTargetPitch, Vec4_int_ *a7);
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
98 void DrawTranslucent(unsigned int a2, unsigned int a3, struct Texture *a4);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
99
1787
0c4d3c6a9d5a DrawBuildingsD3D cleared
Ritor1
parents: 1675
diff changeset
100 void DrawBuildingsD3D();
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
101 //struct BSPModel *DrawBuildingsSW();
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
102 //int OnOutdoorRedrawSW();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
103
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
104 void DrawIndoorSky(unsigned int uNumVertices, unsigned int uFaceID);
1923
f92e0bab7c78 rename DrawIndoorPolygonSky
Ritor1
parents: 1922
diff changeset
105 void DrawOutdoorSkyD3D();
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
106 //int DrawSkySW(struct Span *a1, Polygon *a2, int a3);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
107 void DrawOutdoorSkyPolygon(unsigned int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture);
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
108 void DrawIndoorSkyPolygon(signed int uNumVertices, struct Polygon *pSkyPolygon, IDirect3DTexture2 *pTexture);
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
109
144
8ab4484c22e0 Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents: 142
diff changeset
110 void PrepareDecorationsRenderList_ODM();
515
cb0ad52d6a26 LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents: 430
diff changeset
111 void DrawSpriteObjects_ODM();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
112
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
113 //float DrawBezierTerrain();
86
ec84db4c8f9d 4.01.13
Ritor1
parents: 67
diff changeset
114 void RenderTerrainD3D();
2322
a59892f99d31 for draw terrain
Ritor1
parents: 2316
diff changeset
115 void DrawTerrainD3D(int a1, int edx0, int a3, int unk4);
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
116 //void DrawTerrainSW(int a1, int a2, int a3, int a4);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
117
1391
cc9a3a24d61d Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents: 1390
diff changeset
118 //void ExecOutdoorDrawSW();
0
Ritor1
parents:
diff changeset
119 void ChangeBetweenWinFullscreenModes();
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
120 bool AreRenderSurfacesOk();
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
121 bool IsGammaSupported();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
122
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
123 void SaveScreenshot(const char *pFilename, unsigned int width, unsigned int height);
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
124 void PackScreenshot(unsigned int width, unsigned int height, void *out_data, unsigned int data_size, unsigned int *screenshot_size);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
125 void SavePCXScreenshot();
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
126
2182
e1e4a8a20b5f _46Ð6ÐС_GetActorsInViewport
Ritor1
parents: 2155
diff changeset
127 int _46À6ÀÑ_GetActorsInViewport(int pDepth);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
128
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
129 void BeginLightmaps();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
130 void EndLightmaps();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
131 void BeginLightmaps2();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
132 void EndLightmaps2();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
133 bool DrawLightmap(struct Lightmap *pLightmap, struct Vec3_float_ *pColorMult, float z_bias);
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
134
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
135 void BeginDecals();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
136 void EndDecals();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
137 void DrawDecal(struct Decal *pDecal, float z_bias);
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
138
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
139 void do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, signed int sDiffuseBegin, const RenderVertexD3D3 *pLineEnd, signed int sDiffuseEnd, float z_stuff);
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
140 void DrawLines(const RenderVertexD3D3 *vertices, unsigned int num_vertices);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
141
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
142 void DrawSpecialEffectsQuad(const RenderVertexD3D3 *vertices, IDirect3DTexture2 *texture);
0
Ritor1
parents:
diff changeset
143
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
144 void am_Blt_Copy(RECT *pSrcRect, POINT *pTargetXY, int a3);
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
145 void am_Blt_Chroma(RECT *pSrcRect, POINT *pTargetPoint, int a3, int blend_mode);
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2152
diff changeset
146
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
147 public:
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
148 int *pActiveZBuffer;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
149 IDirectDraw4 *pDirectDraw4;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
150 IDirectDrawSurface4 *pFrontBuffer4;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
151 IDirectDrawSurface4 *pBackBuffer4;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
152 void *pTargetSurface;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
153 unsigned int uTargetSurfacePitch;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
154 unsigned int bUseColoredLights;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
155 unsigned int bTinting;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
156 unsigned int bUsingSpecular;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
157 uint32_t uFogColor;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
158 unsigned int pHDWaterBitmapIDs[7];
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
159 int hd_water_current_frame;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
160 int hd_water_tile_id;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
161 void (*pBeforePresentFunction)();
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
162 uint32_t bFogEnabled;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
163 RenderBillboardD3D pBillboardRenderListD3D[1000];
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
164 unsigned int uNumBillboardsToDraw;
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
165
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
166 inline void WritePixel16(int x, int y, unsigned __int16 color)
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
167 {
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
168 if (ddpfPrimarySuface.dwRGBBitCount == 32)
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
169 {
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
170 auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
171 *p = Color32(color);
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
172 }
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
173 else if (ddpfPrimarySuface.dwRGBBitCount == 16)
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
174 {
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
175 auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
176 *p = color;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
177 }
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
178 else __debugbreak();
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
179 }
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
180
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
181 inline unsigned __int16 ReadPixel16(int x, int y)
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
182 {
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
183 if (ddpfPrimarySuface.dwRGBBitCount == 32)
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
184 {
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
185 auto p = (unsigned __int32 *)pTargetSurface + x + y * uTargetSurfacePitch;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
186 return Color16((*p >> 16) & 255, (*p >> 8) & 255, *p & 255);
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
187 }
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
188 else if (ddpfPrimarySuface.dwRGBBitCount == 16)
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
189 {
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
190 auto p = (unsigned __int16 *)pTargetSurface + x + y * uTargetSurfacePitch;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
191 return *p;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
192 }
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
193 else __debugbreak();
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
194 }
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
195
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
196 inline void ToggleTint() {bTinting = !bTinting;}
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
197 inline void ToggleColoredLights() {bUseColoredLights = !bUseColoredLights;}
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
198
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
199 inline unsigned int GetRenderWidth() {return window->GetWidth();}
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
200 inline unsigned int GetRenderHeight() {return window->GetHeight();}
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
201
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
202 inline void Sub01()
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
203 {
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
204 if (pRenderD3D && !bWindowMode)
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
205 _49FD3A_fullscreen();
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
206 }
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
207
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
208 friend void Present_NoColorKey();
2069
259df09dfb50 32bits almost there
Nomad
parents: 2006
diff changeset
209
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2152
diff changeset
210 protected:
2402
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
211 unsigned int uDesiredDirect3DDevice;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
212 int raster_clip_x;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
213 int raster_clip_y; // clipping rect for raster ops
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
214 int raster_clip_z; // like RasterLine2D for (mini)map
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
215 int raster_clip_w;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
216 int *pDefaultZBuffer;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
217 OSWindow *window;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
218 unsigned int bWindowMode;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
219 RenderD3D *pRenderD3D;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
220 DDPIXELFORMAT ddpfPrimarySuface;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
221 unsigned int uTargetRBits;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
222 unsigned int uTargetGBits;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
223 unsigned int uTargetBBits;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
224 unsigned int uTargetRMask;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
225 unsigned int uTargetGMask;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
226 unsigned int uTargetBMask;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
227 unsigned int uNumSceneBegins;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
228 unsigned __int32 *pTargetSurface_unaligned;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
229 unsigned int uClipY;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
230 unsigned int uClipX;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
231 unsigned int uClipW;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
232 unsigned int uClipZ;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
233 unsigned int bClip;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
234 unsigned int uNumD3DSceneBegins;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
235 int using_software_screen_buffer;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
236 RenderHWLContainer pD3DBitmaps;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
237 RenderHWLContainer pD3DSprites;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
238 unsigned int bRequiredTextureStagesAvailable;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
239 unsigned int uLevelOfDetail;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
240 unsigned int uMaxDeviceTextureDim;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
241 unsigned int uMinDeviceTextureDim;
8cee51ce4382 included directx 11
Ritor1
parents: 2343
diff changeset
242
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
243 void DoRenderBillboards_D3D();
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
244 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
245 void TransformBillboard(RenderBillboardTransform_local0 *a2, Sprite *pSprite, int dimming_level, RenderBillboard *pBillboard);
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
246 unsigned int Billboard_ProbablyAddToListAndSortByZOrder(float z);
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
247 unsigned int GetParentBillboardID(unsigned int uBillboardID);
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
248 unsigned int GetBillboardDrawListSize();
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
249
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
250 void DrawBorderTiles(struct Polygon *poly);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
251
2154
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
252 unsigned short *MakeScreenshot(signed int width, signed int height);
9bd7522cdbbb Render decoupling.
Nomad
parents: 2153
diff changeset
253 bool CheckTextureStages();
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
254 void ParseTargetPixelFormat();
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
255
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
256 void CreateDirectDraw();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
257 void SetDirectDrawCooperationMode(HWND hWnd, bool bFullscreen);
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
258 void SetDirectDrawDisplayMode(unsigned int uWidth, unsigned int uHeight, unsigned int uBPP);
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
259 void CreateFrontBuffer();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
260 void CreateBackBuffer();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
261 void CreateDirectDrawPrimarySurface();
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
262 void CreateClipper(HWND a2);
2404
82512695b45d struct Render
Ritor1
parents: 2402
diff changeset
263
2155
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
264 void PackPCXpicture(unsigned short* picture_data, int wight, int heidth, void *data_buff, int max_buff_size,unsigned int* packed_size);
0a1438c16c2b Render decoupling.
Nomad
parents: 2154
diff changeset
265 void SavePCXImage(const char *Filename, unsigned short* picture_data, int width, int height);
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2152
diff changeset
266
1802
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1675
diff changeset
267 //int windowed_mode_width;
633f81bb3ae7 HWND -> class OSWindow
Nomad
parents: 1675
diff changeset
268 //int windowed_mode_height;
0
Ritor1
parents:
diff changeset
269 };