Mercurial > mm7
annotate Engine/Graphics/RenderStruct.h @ 2568:f2f2595fe308
rename Decals[], DecalCount
author | Ritor1 |
---|---|
date | Thu, 21 May 2015 18:32:45 +0600 |
parents | b8a56afc6ba1 |
children | dd36326a9994 |
rev | line source |
---|---|
2496 | 1 #pragma once |
2 | |
3 #include <cstdint> | |
4 #include <cstdio> | |
5 | |
6 #include "lib\legacy_dx\d3d.h" | |
7 #include "OSWindow.h" | |
8 | |
2499 | 9 #include "../VectorTypes.h" |
2496 | 10 |
11 | |
12 #define ErrD3D(hr) \ | |
13 do \ | |
14 { \ | |
15 extern void ErrHR(HRESULT, const char *, const char *, const char *, int); \ | |
16 ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__); \ | |
17 } while(0) | |
18 | |
19 struct Polygon; | |
20 struct Texture; | |
21 struct RGBTexture; | |
22 struct RenderBillboardTransform_local0; | |
23 struct ODMFace; | |
24 | |
25 | |
26 unsigned __int16 Color16(unsigned __int32 r, unsigned __int32 g, unsigned __int32 b); | |
27 unsigned __int32 Color32(unsigned __int16 color16); | |
2523 | 28 unsigned __int32 Color32_SwapRedBlue(unsigned __int16 color16); |
2496 | 29 |
30 /* 119 */ | |
31 #pragma pack(push, 1) | |
32 struct RenderVertexSoft | |
33 { | |
34 inline RenderVertexSoft(): | |
35 flt_2C(0.0f) | |
36 {} | |
37 | |
38 Vec3_float_ vWorldPosition; | |
39 Vec3_float_ vWorldViewPosition; | |
40 float vWorldViewProjX; | |
41 float vWorldViewProjY; | |
42 float _rhw; | |
43 float u; | |
44 float v; | |
45 float flt_2C; | |
46 }; | |
47 #pragma pack(pop) | |
48 | |
49 | |
50 | |
51 /* 112 */ | |
52 #pragma pack(push, 1) | |
53 struct RenderVertexD3D3 | |
54 { | |
55 Vec3_float_ pos; | |
56 float rhw; | |
57 signed int diffuse; | |
58 unsigned int specular; | |
59 Vec2_float_ texcoord; | |
60 }; | |
61 #pragma pack(pop) | |
62 | |
63 class Sprite; | |
64 class SpriteFrame; | |
65 | |
66 /* 161 */ | |
67 #pragma pack(push, 1) | |
68 struct RenderBillboard | |
69 { | |
70 int _screenspace_x_scaler_packedfloat; | |
71 int _screenspace_y_scaler_packedfloat; | |
72 float fov_x; | |
73 float fov_y; | |
74 union | |
75 { | |
76 int sZValue; | |
77 struct | |
78 { | |
79 unsigned __int16 object_pid; | |
80 signed __int16 actual_z; | |
81 }; | |
82 }; | |
83 int field_14_actor_id; | |
84 signed __int16 HwSpriteID; | |
85 __int16 uPalette; | |
86 __int16 uIndoorSectorID; | |
87 __int16 field_1E; | |
88 __int16 world_x; | |
89 __int16 world_y; | |
90 __int16 world_z; | |
91 __int16 uScreenSpaceX; | |
92 __int16 uScreenSpaceY; | |
93 unsigned __int16 dimming_level; | |
94 signed int sTintColor; | |
95 SpriteFrame *pSpriteFrame; | |
96 | |
97 inline float GetFloatZ() const | |
98 { | |
99 return (float)object_pid / 65535.0f + (float)actual_z; | |
100 } | |
101 }; | |
102 #pragma pack(pop) | |
103 | |
104 | |
105 #pragma pack(push, 1) | |
106 struct RenderD3D__DevInfo | |
107 { | |
2555
67d837007a4c
ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
a.parshin
parents:
2523
diff
changeset
|
108 inline RenderD3D__DevInfo(): |
67d837007a4c
ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
a.parshin
parents:
2523
diff
changeset
|
109 bIsDeviceCompatible(false), pName(nullptr), pDescription(nullptr), |
67d837007a4c
ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
a.parshin
parents:
2523
diff
changeset
|
110 pGUID(nullptr), uCaps(0), pDriverName(nullptr), pDeviceDesc(nullptr), |
67d837007a4c
ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
a.parshin
parents:
2523
diff
changeset
|
111 pDDraw4DevDesc(nullptr), pDirectDrawGUID(nullptr), uVideoMem(0) |
67d837007a4c
ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
a.parshin
parents:
2523
diff
changeset
|
112 {} |
67d837007a4c
ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed
a.parshin
parents:
2523
diff
changeset
|
113 |
2496 | 114 unsigned int bIsDeviceCompatible; |
115 char *pName; | |
116 char *pDescription; | |
117 GUID *pGUID; | |
118 unsigned int uCaps; | |
119 char *pDriverName; | |
120 char *pDeviceDesc; | |
121 char *pDDraw4DevDesc; | |
122 GUID *pDirectDrawGUID; | |
123 int uVideoMem; | |
124 }; | |
125 #pragma pack(pop) | |
126 | |
127 | |
128 | |
129 #pragma pack(push, 1) | |
130 struct RenderD3D_D3DDevDesc | |
131 { | |
132 int field_0; | |
133 int field_4; | |
134 int field_8; | |
135 int field_C; | |
136 int field_10; | |
137 char *pDriverName; | |
138 char *pDeviceDesc; | |
139 char *pDDraw4DevDesc; | |
140 GUID *pGUID; | |
141 unsigned int uVideoMem; | |
142 }; | |
143 #pragma pack(pop) | |
144 | |
145 | |
146 | |
147 | |
148 | |
149 | |
150 | |
151 | |
152 | |
153 /* 280 */ | |
154 #pragma pack(push, 1) | |
155 struct HWLTexture | |
156 { | |
157 inline HWLTexture(): | |
158 field_0(0), field_4(0), field_8(0), | |
159 field_C(0), field_10(0), field_14(0) | |
160 {} | |
161 | |
162 int field_0; | |
163 int field_4; | |
164 int field_8; | |
165 int field_C; | |
166 int field_10; | |
167 int field_14; | |
168 int uBufferWidth; | |
169 int uBufferHeight; | |
170 int uAreaWidth; | |
171 int uAreaHeigth; | |
172 unsigned int uWidth; | |
173 unsigned int uHeight; | |
174 int uAreaX; | |
175 int uAreaY; | |
176 unsigned __int16 *pPixels; | |
177 }; | |
178 #pragma pack(pop) | |
179 | |
180 | |
181 /* 185 */ | |
182 #pragma pack(push, 1) | |
183 struct RenderHWLContainer | |
184 { | |
185 RenderHWLContainer(); | |
186 bool Load(const wchar_t *pFilename); | |
187 bool Release(); | |
188 | |
189 HWLTexture *LoadTexture(const char *pName, int bMipMaps); | |
190 | |
191 FILE *pFile; | |
192 uint32_t uSignature; | |
193 unsigned int uDataOffset; | |
194 unsigned int uNumItems; | |
195 char *pSpriteNames[50000]; | |
196 int pSpriteOffsets[50000]; | |
197 int bDumpDebug; | |
198 int scale_hwls_to_half; | |
199 }; | |
200 #pragma pack(pop) | |
201 | |
202 | |
203 | |
204 /* 242 */ | |
205 #pragma pack(push, 1) | |
206 struct RenderBillboardD3D | |
207 { | |
208 inline RenderBillboardD3D(): | |
209 opacity(Transparent), | |
210 field_90(-1), | |
211 sParentBillboardID(-1), | |
212 uNumVertices(4) | |
213 {} | |
214 | |
215 enum OpacityType: unsigned __int32 | |
216 { | |
217 Transparent = 0, | |
218 Opaque_1 = 1, | |
219 Opaque_2 = 2, | |
220 Opaque_3 = 3, | |
221 NoBlend = 0xFFFFFFFF | |
222 }; | |
223 | |
224 IDirect3DTexture2 *pTexture; | |
225 unsigned int uNumVertices; | |
226 RenderVertexD3D3 pQuads[4]; | |
227 float z_order; | |
228 OpacityType opacity; | |
229 int field_90; | |
230 int sZValue; | |
231 signed int sParentBillboardID; | |
232 }; | |
233 #pragma pack(pop) | |
234 | |
235 | |
236 | |
237 | |
238 #pragma pack(push, 1) | |
239 struct RenderD3D_aux | |
240 { | |
241 RenderD3D__DevInfo *pInfo; | |
242 RenderD3D_D3DDevDesc *ptr_4; | |
243 }; | |
244 #pragma pack(pop) | |
245 | |
246 | |
247 | |
248 /* 183 */ | |
249 #pragma pack(push, 1) | |
250 class RenderD3D | |
251 { | |
252 public: | |
253 RenderD3D(); | |
254 | |
255 void GetAvailableDevices(RenderD3D__DevInfo **pOutDevices); | |
256 void Release(); | |
257 bool CreateDevice(unsigned int uDeviceID, int bWindowed, OSWindow *window); | |
258 unsigned int GetDeviceCaps(); | |
259 void ClearTarget(unsigned int bClearColor, unsigned int uClearColor, unsigned int bClearDepth, float z_clear); | |
260 void Present(bool bForceBlit); | |
261 bool CreateTexture(unsigned int uTextureWidth, unsigned int uTextureHeight, IDirectDrawSurface4 **pOutSurface, IDirect3DTexture2 **pOutTexture, bool bAlphaChannel, bool bMipmaps, unsigned int uMinDeviceTexDim); | |
262 void HandleLostResources(); | |
263 | |
264 | |
265 unsigned int bWindowed; | |
266 int field_4; | |
267 int field_8; | |
268 HWND hWindow; | |
269 int field_10; | |
270 int field_14; | |
271 int field_18; | |
272 RenderD3D__DevInfo *pAvailableDevices; | |
273 IDirectDraw4 *pHost; | |
274 IDirect3D3 *pDirect3D; | |
275 IUnknown *pUnk; | |
276 IDirectDrawSurface4 *pBackBuffer; | |
277 IDirectDrawSurface4 *pFrontBuffer; | |
278 IDirectDrawSurface4 *pZBuffer; | |
279 IDirect3DDevice3 *pDevice; | |
280 IDirect3DViewport3 *pViewport; | |
281 int field_40; | |
282 int field_44; | |
283 char pErrorMessage[48]; | |
284 char field_78[208]; | |
285 }; | |
286 #pragma pack(pop) | |
287 extern struct RenderVertexD3D3 pVertices[50]; | |
288 | |
289 /* 182 */ | |
290 #pragma pack(push, 1) | |
291 | |
292 #pragma pack(pop) | |
293 | |
294 bool PauseGameDrawing(); | |
295 | |
296 extern struct IDirectDrawClipper *pDDrawClipper; | |
297 extern struct IRender *pRenderer; // idb | |
298 extern struct pUnkTerrain *Unks; | |
299 | |
300 | |
301 | |
302 /* 248 */ | |
303 #pragma pack(push, 1) | |
304 struct RenderBillboardTransform_local0 | |
305 { | |
306 void *pTarget; | |
307 int *pTargetZ; | |
308 int uScreenSpaceX; | |
309 int uScreenSpaceY; | |
310 int _screenspace_x_scaler_packedfloat; | |
311 int _screenspace_y_scaler_packedfloat; | |
312 char field_18[8]; | |
313 unsigned __int16 *pPalette; | |
314 unsigned __int16 *pPalette2; | |
315 union | |
316 { | |
317 int sZValue; | |
318 struct | |
319 { | |
320 unsigned short object_pid; | |
321 short zbuffer_depth; | |
322 }; | |
323 }; | |
324 unsigned int uFlags; // & 4 - mirror horizontally | |
325 unsigned int uTargetPitch; | |
326 unsigned int uViewportX; | |
327 unsigned int uViewportY; | |
328 unsigned int uViewportZ; | |
329 unsigned int uViewportW; | |
330 int field_44; | |
331 int sParentBillboardID; | |
332 int sTintColor; | |
333 }; | |
334 #pragma pack(pop) | |
335 | |
336 | |
337 | |
338 | |
339 extern int uNumDecorationsDrawnThisFrame; // weak | |
340 extern RenderBillboard pBillboardRenderList[500]; | |
341 extern unsigned int uNumBillboardsToDraw; | |
342 extern int uNumSpritesDrawnThisFrame; // weak | |
343 | |
344 | |
345 | |
346 | |
347 extern RenderVertexSoft array_507D30[50]; | |
2562
b8a56afc6ba1
new var no_actors, lights_flag, debug_lights, StationaryLights and MobileLights
Ritor1
parents:
2555
diff
changeset
|
348 extern RenderVertexSoft VertexRenderList[50]; |
2496 | 349 extern RenderVertexSoft array_73D150[20]; |
350 | |
351 extern RenderVertexD3D3 d3d_vertex_buffer[50]; | |
352 | |
353 | |
354 int ODM_NearClip(unsigned int uVertexID); // idb | |
355 int ODM_FarClip(unsigned int uNumVertices); |