Mercurial > mm7
annotate LightmapBuilder.cpp @ 2245:8817c398b792
for RasterLine2D
author | Ritor1 |
---|---|
date | Tue, 25 Feb 2014 20:02:06 +0600 |
parents | 6ab7d7c112bb |
children | 47bcb700b74b aff7a7b072b7 |
rev | line source |
---|---|
0 | 1 #include "LightmapBuilder.h" |
2 #include "Game.h" | |
3 #include "stru314.h" | |
4 #include "Outdoor.h" | |
1277 | 5 #include "Outdoor_stuff.h" |
0 | 6 #include "Log.h" |
1545 | 7 #include "ErrorHandling.h" |
0 | 8 |
1262 | 9 #include "Lights.h" |
1016 | 10 |
0 | 11 #include "mm7_data.h" |
12 | |
13 | |
14 | |
1016 | 15 #include "stru9.h" |
0 | 16 |
17 | |
18 | |
19 | |
20 LightsStack_StationaryLight_ *pStationaryLightsStack = new LightsStack_StationaryLight_; | |
21 //StationaryLight pStationaryLights[400]; | |
22 //int uNumStationaryLightsApplied; // weak | |
23 LightsStack_MobileLight_ *pMobileLightsStack = new LightsStack_MobileLight_; | |
24 //MobileLight pMobileLights[400]; | |
25 //int uNumMobileLightsApplied; | |
26 | |
27 | |
28 | |
29 | |
30 | |
31 //----- (0045DF13) -------------------------------------------------------- | |
32 Lightmap::Lightmap() | |
33 { | |
34 field_C18 = 0; | |
35 } | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 //----- (0045BB06) -------------------------------------------------------- | |
42 LightmapBuilder::LightmapBuilder() | |
43 { | |
44 } | |
45 | |
46 | |
47 | |
48 | |
49 | |
50 //----- (0045BC07) -------------------------------------------------------- | |
51 bool LightmapBuilder::ApplyLights(stru320 *a2, stru154 *a3, unsigned int uNumVertices, RenderVertexSoft *a5, IndoorCameraD3D_Vec4 *a6, char uClipFlag) | |
52 { | |
53 Vec3_int_ pos; // [sp+2Ch] [bp-40h]@21 | |
54 RenderVertexSoft *a9; // [sp+68h] [bp-4h]@8 | |
55 | |
56 if (!uNumVertices) | |
57 return false; | |
58 | |
59 static RenderVertexSoft static_69B140[64]; | |
60 | |
61 a9 = a5; | |
62 if (a6) | |
63 { | |
64 for (uint i = 0; i < uNumVertices; ++i) | |
65 memcpy(static_69B140 + i, a5 + i, sizeof(RenderVertexSoft)); | |
66 | |
687 | 67 //__debugbreak(); |
2245 | 68 if (pGame->pIndoorCameraD3D->_437376(a3, static_69B140, &uNumVertices) == 1) |
0 | 69 { |
70 if ( !uNumVertices ) | |
71 return false; | |
72 a9 = static_69B140; | |
73 } | |
74 } | |
75 | |
76 static stru314 static_69B110; | |
77 static_69B110.field_4.x = a3->face_plane.vNormal.x; | |
78 static_69B110.field_4.y = a3->face_plane.vNormal.y; | |
79 static_69B110.field_4.z = a3->face_plane.vNormal.z; | |
80 static_69B110.dist = a3->face_plane.dist; | |
2245 | 81 if (!pGame->pIndoorCameraD3D->GetFacetOrientation(a3->polygonType, &static_69B110.field_4, |
82 &static_69B110.field_10, &static_69B110.field_1C)) | |
0 | 83 { |
84 MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:119", 0); | |
85 ExitProcess(0); | |
86 } | |
87 | |
88 for (uint i = 0; i < a2->uNumLightsApplied; ++i) | |
89 { | |
90 pos.x = a2->_blv_lights_xs[i]; | |
91 pos.y = a2->_blv_lights_ys[i]; | |
92 pos.z = a2->_blv_lights_zs[i]; | |
93 | |
94 uint uColorR = (uint)floorf(a2->_blv_lights_rs[i] * 255.0 + 0.5f) & 0xFF, | |
95 uColorG = (uint)floorf(a2->_blv_lights_gs[i] * 255.0 + 0.5f) & 0xFF, | |
96 uColorB = (uint)floorf(a2->_blv_lights_bs[i] * 255.0 + 0.5f) & 0xFF; | |
97 uint uColor = (uColorR << 16) | (uColorG << 8) | uColorB; | |
98 if (!uColor) | |
99 uColor = 0x00FFFFF; | |
100 | |
2245 | 101 if (!_45BE86_build_light_polygon(&pos, a2->_blv_lights_radii[i], uColor, a2->_blv_lights_light_dot_faces[i], |
102 a2->_blv_lights_types[i], &static_69B110, uNumVertices, a9, uClipFlag) ) | |
0 | 103 { |
104 MessageBoxW(nullptr, L"Error: Failed to build light polygon", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:138", 0); | |
105 } | |
106 } | |
107 return true; | |
108 } | |
109 | |
110 //----- (0045BE86) -------------------------------------------------------- | |
111 bool LightmapBuilder::_45BE86_build_light_polygon(Vec3_int_ *pos, float radius, unsigned int uColorMask, float dot_dist, int uLightType, stru314 *a7, unsigned int uNumVertices, RenderVertexSoft *a9, char uClipFlag) | |
112 { | |
113 Lightmap *v11; // edi@3 | |
114 double v17; // st7@5 | |
115 double v24; // st7@6 | |
116 int v31; // eax@8 | |
117 int v32; // ebx@8 | |
118 unsigned int v33; // ecx@8 | |
119 int v34; // edx@9 | |
120 int v35; // edx@11 | |
121 unsigned int v36; // edx@13 | |
122 int v37; // ecx@14 | |
123 double v38; // st7@14 | |
124 double v39; // st7@16 | |
125 double v40; // st7@16 | |
126 int v45; // eax@24 | |
127 int v53; // [sp-8h] [bp-54h]@34 | |
128 | |
129 if (fabsf(radius) < 1e-6f) | |
130 return true; | |
131 | |
132 v11 = uLightType & 1 ? &std__vector_000004[std__vector_000004_size] : | |
133 &std__vector_183808[std__vector_183808_size]; | |
134 flt_3C8C24 = radius - dot_dist; | |
135 flt_3C8C28 = sqrt((radius + dot_dist) * (radius - dot_dist)); | |
136 flt_3C8C2C_lightmaps_brightness = 1.0 - (radius - flt_3C8C28) / radius; | |
137 v11->field_C08 = (double)pos->x - dot_dist * a7->field_4.x; | |
138 v11->field_C0A = (double)pos->y - dot_dist * a7->field_4.y; | |
139 v11->field_C0C = (double)pos->z - dot_dist * a7->field_4.z; | |
140 | |
141 v17 = radius * flt_3C8C2C_lightmaps_brightness; | |
142 flt_3C8C30 = v17; | |
143 flt_3C8C0C = v17 * a7->field_10.x; | |
144 flt_3C8C10 = v17 * a7->field_10.y; | |
145 flt_3C8C14 = v17 * a7->field_10.z; | |
146 flt_3C8C18 = v17 * a7->field_1C.x; | |
147 flt_3C8C1C = v17 * a7->field_1C.y; | |
148 flt_3C8C20 = v17 * a7->field_1C.z; | |
149 | |
150 /* | |
151 v11->pVertices[0].vWorldPosition.x = v11->field_C08 - flt_3C8C18 + flt_3C8C0C; | |
152 v11->pVertices[0].vWorldPosition.y = v11->field_C0A - flt_3C8C1C + flt_3C8C10; | |
153 v11->pVertices[0].vWorldPosition.z = v11->field_C0C - flt_3C8C20 + flt_3C8C14; | |
154 v11->pVertices[0].u = 0.0; | |
155 v11->pVertices[0].v = 0.0; | |
156 | |
157 v11->pVertices[1].vWorldPosition.x = v11->field_C08 - flt_3C8C18 - flt_3C8C0C; | |
158 v11->pVertices[1].vWorldPosition.y = v11->field_C0A - flt_3C8C1C - flt_3C8C10; | |
159 v11->pVertices[1].vWorldPosition.z = v11->field_C0C - flt_3C8C20 - flt_3C8C14; | |
160 v11->pVertices[1].u = 0.0; | |
161 v11->pVertices[1].v = 1.0; | |
162 | |
163 v11->pVertices[2].vWorldPosition.x = v11->field_C08 + flt_3C8C18 - flt_3C8C0C; | |
164 v11->pVertices[2].vWorldPosition.y = v11->field_C0A + flt_3C8C1C - flt_3C8C10; | |
165 v11->pVertices[2].vWorldPosition.z = v11->field_C0C + flt_3C8C20 - flt_3C8C14; | |
166 v11->pVertices[2].u = 1.0; | |
167 v11->pVertices[2].v = 1.0; | |
168 | |
169 v11->pVertices[3].vWorldPosition.x = v11->field_C08 + flt_3C8C18 + flt_3C8C0C; | |
170 v11->pVertices[3].vWorldPosition.y = v11->field_C0A + flt_3C8C1C + flt_3C8C10; | |
171 v11->pVertices[3].vWorldPosition.z = v11->field_C0C + flt_3C8C20 + flt_3C8C14; | |
172 v11->pVertices[3].u = 1.0; | |
173 v11->pVertices[3].v = 0.0; | |
174 */ | |
175 | |
176 for (uint i = 0; i < 4; ++i) | |
177 { | |
178 v11->pVertices[i].vWorldPosition.x = v11->field_C08 - flt_3C8C18 + flt_3C8C0C; | |
179 v11->pVertices[i].vWorldPosition.y = v11->field_C0A - flt_3C8C1C + flt_3C8C10; | |
180 v11->pVertices[i].vWorldPosition.z = v11->field_C0C - flt_3C8C20 + flt_3C8C14; | |
181 v11->pVertices[i].u = 0.0; | |
182 v11->pVertices[i].v = 0.0; | |
183 | |
184 v24 = a7->field_4.y * v11->pVertices[i].vWorldPosition.y | |
185 + a7->field_4.z * v11->pVertices[i].vWorldPosition.z | |
186 + a7->field_4.x * v11->pVertices[i].vWorldPosition.x | |
187 + a7->dist; | |
188 | |
189 v11->pVertices[i].vWorldPosition.x -= v24 * a7->field_4.x; | |
190 v11->pVertices[i].vWorldPosition.y -= v24 * a7->field_4.y; | |
191 v11->pVertices[i].vWorldPosition.z -= v24 * a7->field_4.z; | |
192 } | |
193 | |
194 v11->uColorMask = uColorMask; | |
195 v11->uNumVertices = 4; | |
196 | |
197 if (~pGame->uFlags2 & 4) | |
198 v11->fBrightness = flt_3C8C2C_lightmaps_brightness; | |
199 else | |
200 { | |
201 Vec3_float_ a1; // [sp+2Ch] [bp-20h]@8 | |
202 a1.x = (double)pos->x - v11->field_C08; | |
203 a1.y = (double)pos->y - v11->field_C0A; | |
204 a1.z = (double)pos->z - v11->field_C0C; | |
205 a1.Normalize(); | |
206 | |
207 auto dist_x = abs(pos->x - v11->field_C08), //v31 | |
208 dist_y = abs(pos->y - v11->field_C0A), //v32 arg0a | |
209 dist_z = abs(pos->z - v11->field_C0C); //v33 _v64 | |
2235
6ab7d7c112bb
adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents:
2155
diff
changeset
|
210 v38 = int_get_vector_length(dist_x, dist_y, dist_z); |
0 | 211 if (v38 > radius) |
212 return true; | |
213 //radius = (1 / radius) * v38; | |
214 if ( uLightType & 4 ) | |
215 { | |
216 //v59 = (void *)v37; | |
217 //uLightType = flt_4D86CC; | |
218 //v58 = v37; | |
219 v39 = fabs(a1.x * a7->field_4.x + a1.z * a7->field_4.z + a1.y * a7->field_4.y); | |
220 v40 = v39 * 1.0 * flt_4D86CC; | |
221 | |
222 v11->fBrightness = v40 - (1 / radius) * v38 * v40; | |
223 } | |
224 else if ( uLightType & 8 ) | |
225 { | |
226 v40 = 1.0 * 1.0; | |
227 v11->fBrightness = v40 - (1 / radius) * v38; | |
228 } | |
229 else | |
230 { | |
231 MessageBoxW(nullptr, L"Invalid light type!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:277", 0); | |
232 } | |
233 } | |
234 | |
235 if (!pGame->pStru9Instance->_4980B9(a9, uNumVertices, | |
236 a7->field_4.x, a7->field_4.y, a7->field_4.z, | |
237 v11->pVertices, &v11->uNumVertices)) | |
238 return false; | |
239 | |
240 //v44 = &v11->uNumVertices; | |
241 if (!v11->uNumVertices) | |
242 return true; | |
243 | |
244 v45 = _45C6D6(uNumVertices, a9, v11); | |
245 if ( v45 != uNumVertices && v45 > 0 ) | |
246 _45C4B9(uNumVertices, a9, v11); | |
247 //v59 = v11->uNumVertices; | |
248 //v46 = (RenderVertexSoft *)pLightmapVertices_; | |
249 pGame->pIndoorCameraD3D->ViewTransform(v11->pVertices, v11->uNumVertices); | |
250 //v59 = 0; | |
251 //v58 = v11->uNumVertices; | |
252 pGame->pIndoorCameraD3D->Project(v11->pVertices, v11->uNumVertices, 0); | |
253 | |
254 unsigned int _a4 = 0; | |
255 if ( !(uClipFlag & 1) ) | |
256 _a4 = 1; | |
257 else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
258 { | |
259 if ( uClipFlag & 2 ) | |
260 { | |
261 //v59 = &a4; | |
262 //v58 = (unsigned int)field_3C8C34; | |
263 //v57 = *v44; | |
264 pGame->pIndoorCameraD3D->_436CDC_mess_with_lightmap__clipflag_2(v11->pVertices, v11->uNumVertices, field_3C8C34, &_a4); | |
265 | |
266 //v59 = v44; | |
267 //v58 = (unsigned int)field_3C8C34; | |
268 //v57 = (int)v46; | |
269 //v56 = a4; | |
270 pGame->pIndoorCameraD3D->_437143(_a4, v11->pVertices, field_3C8C34, &v11->uNumVertices); | |
271 } | |
272 else if ( uClipFlag & 4 ) | |
273 { | |
274 //v59 = &a4; | |
275 //v58 = (unsigned int)field_3C8C34; | |
276 //v57 = *v44; | |
277 pGame->pIndoorCameraD3D->_436F09_mess_with_lightmap__clipflag_4(v11->pVertices, v11->uNumVertices, field_3C8C34, &_a4); | |
278 | |
279 //v59 = v44; | |
280 //v58 = (unsigned int)field_3C8C34; | |
281 //v57 = (int)v46; | |
282 //v56 = a4; | |
283 pGame->pIndoorCameraD3D->_437143(_a4, v11->pVertices, field_3C8C34, &v11->uNumVertices); | |
284 } | |
285 else | |
286 MessageBoxW(nullptr, L"Undefined clip flag specified", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:330", 0); | |
287 } | |
288 else | |
289 MessageBoxW(nullptr, L"Lightpoly builder native indoor clipping not implemented", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:335", 0); | |
290 | |
291 if (_a4) | |
292 { | |
293 if (uLightType & 1) | |
294 { | |
295 //v48 = (char *)&std__vector_000004_size; | |
296 //v49 = std__vector_000004_size; | |
297 //v51 = __OFSUB__(std__vector_000004_size, 511); | |
298 //v50 = std__vector_000004_size - 511 < 0; | |
299 if (std__vector_000004_size < 512 - 1) | |
300 ++std__vector_000004_size; | |
301 } | |
302 else | |
303 { | |
304 //v48 = (char *)&std__vector_183808_size; | |
305 //v49 = std__vector_183808_size; | |
306 //v51 = __OFSUB__(std__vector_183808_size, 767); | |
307 //v50 = std__vector_183808_size - 767 < 0; | |
308 if (std__vector_183808_size < 768 - 1) | |
309 ++std__vector_183808_size; | |
310 } | |
311 //if ( v50 ^ v51 ) | |
312 // *(unsigned int *)v48 = v49 + 1; | |
313 } | |
314 return true; | |
315 } | |
316 | |
317 //----- (0045C4B9) -------------------------------------------------------- | |
318 int LightmapBuilder::_45C4B9(int a2, RenderVertexSoft *a3, Lightmap *pLightmap) | |
319 { | |
320 Lightmap *v4; // edi@1 | |
321 int v5; // eax@1 | |
322 signed int v6; // ecx@1 | |
323 RenderVertexSoft *v7; // ebx@2 | |
324 int v8; // edx@3 | |
325 RenderVertexSoft *v9; // esi@3 | |
326 int v10; // eax@6 | |
327 char *v11; // edi@7 | |
328 RenderVertexSoft *v12; // ecx@8 | |
329 char v13; // bl@17 | |
330 signed int v14; // edx@17 | |
331 double v15; // st6@18 | |
332 double v16; // st6@21 | |
333 double v17; // st6@24 | |
334 signed int v18; // edx@33 | |
335 int v20; // [sp+4h] [bp-1Ch]@3 | |
336 int v21; // [sp+8h] [bp-18h]@8 | |
337 float v22; // [sp+Ch] [bp-14h]@23 | |
338 float v23; // [sp+10h] [bp-10h]@20 | |
339 int v24; // [sp+14h] [bp-Ch]@1 | |
340 RenderVertexSoft *v25; // [sp+18h] [bp-8h]@2 | |
341 char v26; // [sp+1Eh] [bp-2h]@17 | |
342 char v27; // [sp+1Fh] [bp-1h]@17 | |
343 | |
344 v4 = pLightmap; | |
345 v5 = 0; | |
346 v6 = pLightmap->uNumVertices; | |
347 v24 = 0; | |
348 if ( v6 > 0 ) | |
349 { | |
350 v7 = pLightmap->pVertices; | |
351 v25 = pLightmap->pVertices; | |
352 do | |
353 { | |
354 v20 = v5 + 1; | |
355 v8 = (v5 + 1) % v6; | |
356 v9 = &v4->pVertices[v8]; | |
357 if ( v7->vWorldPosition.x != v9->vWorldPosition.x | |
358 || v7->vWorldPosition.y != v4->pVertices[v8].vWorldPosition.y | |
359 || v7->vWorldPosition.z != v4->pVertices[v8].vWorldPosition.z ) | |
360 { | |
361 v10 = 0; | |
362 if ( a2 > 0 ) | |
363 { | |
364 v11 = (char *)&a3->vWorldPosition.z; | |
365 do | |
366 { | |
367 v21 = v10 + 1; | |
368 v12 = &a3[(v10 + 1) % a2]; | |
369 if ( (*((float *)v11 - 2) != v12->vWorldPosition.x | |
370 || *((float *)v11 - 1) != v12->vWorldPosition.y | |
371 || *(float *)v11 != v12->vWorldPosition.z) | |
372 && v7->vWorldPosition.x == *((float *)v11 - 2) | |
373 && v7->vWorldPosition.y == *((float *)v11 - 1) | |
374 && v7->vWorldPosition.z == *(float *)v11 | |
375 && (v9->vWorldPosition.x != v12->vWorldPosition.x | |
376 || v9->vWorldPosition.y != v12->vWorldPosition.y | |
377 || v9->vWorldPosition.z != v12->vWorldPosition.z) ) | |
378 { | |
379 v13 = 0; | |
380 v14 = 0; | |
381 v27 = 0; | |
382 v26 = 0; | |
383 if ( v9->vWorldPosition.x <= (double)v12->vWorldPosition.x ) | |
384 v15 = v12->vWorldPosition.x - v9->vWorldPosition.x; | |
385 else | |
386 v15 = v9->vWorldPosition.x - v12->vWorldPosition.x; | |
387 v23 = v15; | |
388 if ( v9->vWorldPosition.y <= (double)v12->vWorldPosition.y ) | |
389 v16 = v12->vWorldPosition.y - v9->vWorldPosition.y; | |
390 else | |
391 v16 = v9->vWorldPosition.y - v12->vWorldPosition.y; | |
392 v22 = v16; | |
393 if ( v9->vWorldPosition.z <= (double)v12->vWorldPosition.z ) | |
394 v17 = v12->vWorldPosition.z - v9->vWorldPosition.z; | |
395 else | |
396 v17 = v9->vWorldPosition.z - v12->vWorldPosition.z; | |
397 if ( v23 < 1.0 ) | |
398 { | |
399 v13 = 1; | |
400 v14 = 1; | |
401 } | |
402 if ( v22 < 1.0 ) | |
403 { | |
404 v27 = 1; | |
405 ++v14; | |
406 } | |
407 if ( v17 < 1.0 ) | |
408 { | |
409 v26 = 1; | |
410 ++v14; | |
411 } | |
412 if ( v14 > 1 ) | |
413 { | |
414 v18 = 0; | |
415 if ( v13 && v9->vWorldPosition.x != v12->vWorldPosition.x ) | |
416 { | |
417 v18 = 1; | |
418 v9->vWorldPosition.x = v12->vWorldPosition.x; | |
419 } | |
420 if ( v27 && v9->vWorldPosition.y != v12->vWorldPosition.y ) | |
421 { | |
422 ++v18; | |
423 v9->vWorldPosition.y = v12->vWorldPosition.y; | |
424 } | |
425 if ( v26 && v9->vWorldPosition.z != v12->vWorldPosition.z ) | |
426 { | |
427 ++v18; | |
428 v9->vWorldPosition.z = v12->vWorldPosition.z; | |
429 } | |
430 if ( v18 > 0 ) | |
431 ++v24; | |
432 } | |
433 v7 = v25; | |
434 } | |
435 ++v10; | |
436 v11 += 48; | |
437 } | |
438 while ( v21 < a2 ); | |
439 v4 = pLightmap; | |
440 } | |
441 } | |
442 v5 = v20; | |
443 v6 = v4->uNumVertices; | |
444 ++v7; | |
445 v25 = v7; | |
446 } | |
447 while ( v20 < v6 ); | |
448 } | |
449 return v24; | |
450 } | |
451 | |
452 //----- (0045C6D6) -------------------------------------------------------- | |
453 int LightmapBuilder::_45C6D6(int a2, RenderVertexSoft *a3, Lightmap *pLightmap) | |
454 { | |
455 signed int v6; // esi@1 | |
456 double v9; // st7@6 | |
457 double v10; // st6@10 | |
458 double v11; // st5@14 | |
459 double v12; // st7@17 | |
460 int v15; // [sp+Ch] [bp-8h]@1 | |
461 float v16; // [sp+10h] [bp-4h]@1 | |
462 | |
463 v6 = -1; | |
464 v16 = 3.4028235e38; | |
465 v15 = 0; | |
466 if ( (signed int)pLightmap->uNumVertices > 0 ) | |
467 { | |
2245 | 468 for ( uint i = 0; i < (signed int)pLightmap->uNumVertices; ++i ) |
0 | 469 { |
470 if ( a2 > 0 ) | |
471 { | |
2245 | 472 for ( uint j = 0; j < a2; ++j ) |
0 | 473 { |
2245 | 474 if ( pLightmap->pVertices[i].vWorldPosition.x <= (double)a3[j].vWorldPosition.x ) |
475 v9 = a3[j].vWorldPosition.x - pLightmap->pVertices[i].vWorldPosition.x; | |
0 | 476 else |
2245 | 477 v9 = pLightmap->pVertices[i].vWorldPosition.x - a3[j].vWorldPosition.x; |
0 | 478 if ( v9 < 2.0 ) |
479 { | |
2245 | 480 v10 = pLightmap->pVertices[i].vWorldPosition.y <= (double)a3[j].vWorldPosition.y |
481 ? a3[j].vWorldPosition.y - pLightmap->pVertices[i].vWorldPosition.y | |
482 : pLightmap->pVertices[i].vWorldPosition.y - a3[j].vWorldPosition.y; | |
0 | 483 if ( v10 < 2.0 ) |
484 { | |
2245 | 485 v11 = pLightmap->pVertices[i].vWorldPosition.z <= (double)a3[j].vWorldPosition.z |
486 ? a3[j].vWorldPosition.z - pLightmap->pVertices[i].vWorldPosition.z | |
487 : pLightmap->pVertices[i].vWorldPosition.z - a3[j].vWorldPosition.z; | |
0 | 488 if ( v11 < 2.0 ) |
489 { | |
490 v12 = v9 + v11 + v10; | |
491 if ( v12 < v16 ) | |
492 { | |
493 v16 = v12; | |
2245 | 494 v6 = j; |
0 | 495 } |
496 } | |
497 } | |
498 } | |
499 } | |
500 if ( v6 != -1 ) | |
501 { | |
502 ++v15; | |
2245 | 503 pLightmap->pVertices[i].vWorldPosition.x = a3[v6].vWorldPosition.x; |
504 pLightmap->pVertices[i].vWorldPosition.y = a3[v6].vWorldPosition.y; | |
505 pLightmap->pVertices[i].vWorldPosition.z = a3[v6].vWorldPosition.z; | |
0 | 506 } |
507 } | |
508 v6 = -1; | |
509 v16 = 3.4028235e38; | |
510 } | |
511 } | |
512 return v15; | |
513 } | |
514 | |
515 //----- (0045C7F6) -------------------------------------------------------- | |
516 bool LightmapBuilder::ApplyLights_IndoorFace(unsigned int uFaceID) | |
517 { | |
1980 | 518 BLVFace* pFace = &pIndoor->pFaces[uFaceID]; |
519 BLVSector* pSector = &pIndoor->pSectors[pFace->uSectorID]; | |
0 | 520 |
521 stru_F8AD28.uCurrentAmbientLightLevel = (stru_F8AD28.uDefaultAmbientLightLevel + pSector->uMinAmbientLightLevel) << 16; | |
522 | |
523 uint uNumLightsApplied = 0; | |
524 for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) | |
525 { | |
526 if (uNumLightsApplied >= 20) | |
527 break; | |
528 | |
529 ApplyLight_BLV((StationaryLight *)(pMobileLightsStack->pLights + i), pFace, &uNumLightsApplied, true, 0); | |
530 } | |
531 | |
532 for (uint i = 0; i < pSector->uNumLights; ++i) | |
533 { | |
534 if (uNumLightsApplied >= 20 ) | |
535 break; | |
536 | |
1980 | 537 BLVLightMM7* pLight = &pIndoor->pLights[pSector->pLights[i]]; |
0 | 538 if (~pLight->uAtributes & 0x08) |
2154 | 539 ApplyLight_BLV((StationaryLight *)pLight, pFace, &uFaceID, false, &_4E94D0_light_type); |
0 | 540 } |
541 | |
542 for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
543 { | |
544 if (uNumLightsApplied >= 20) | |
545 break; | |
546 | |
2154 | 547 ApplyLight_BLV(pStationaryLightsStack->pLights + i, pFace, &uNumLightsApplied, false, &_4E94D0_light_type); |
0 | 548 } |
549 | |
550 stru_F8AD28.uNumLightsApplied = uNumLightsApplied; | |
551 return true; | |
552 } | |
553 | |
554 //----- (0045C911) -------------------------------------------------------- | |
555 bool LightmapBuilder::ApplyLight_BLV(StationaryLight *pLight, BLVFace *a2, unsigned int *pSlot, bool bLightBackfaces, char *a5) | |
556 { | |
557 double v13; // st7@8 | |
558 | |
559 if (!pLight->uRadius) | |
560 return false; | |
561 | |
562 if (pLight->vPosition.x > a2->pBounding.x1 - pLight->uRadius && | |
563 pLight->vPosition.x < a2->pBounding.x2 + pLight->uRadius && | |
564 pLight->vPosition.y > a2->pBounding.y1 - pLight->uRadius && | |
565 pLight->vPosition.y < a2->pBounding.y2 + pLight->uRadius && | |
566 pLight->vPosition.z > a2->pBounding.z1 - pLight->uRadius && | |
567 pLight->vPosition.z < a2->pBounding.z2 + pLight->uRadius) | |
568 { | |
569 v13 = (double)pLight->vPosition.z * a2->pFacePlane.vNormal.z + | |
570 (double)pLight->vPosition.y * a2->pFacePlane.vNormal.y + | |
571 (double)pLight->vPosition.x * a2->pFacePlane.vNormal.x + | |
572 a2->pFacePlane.dist; | |
573 if ((bLightBackfaces || v13 >= 0.0f) && fabsf(v13) <= pLight->uRadius) | |
574 { | |
1980 | 575 unsigned int slot = *pSlot; |
0 | 576 |
577 stru_F8AD28._blv_lights_radii[slot] = pLight->uRadius; | |
578 stru_F8AD28._blv_lights_inv_radii[slot] = 65536 / pLight->uRadius; | |
579 stru_F8AD28._blv_lights_xs[slot] = pLight->vPosition.x; | |
580 stru_F8AD28._blv_lights_ys[slot] = pLight->vPosition.y; | |
581 stru_F8AD28._blv_lights_zs[slot] = pLight->vPosition.z; | |
582 stru_F8AD28._blv_lights_rs[slot] = (double)pLight->uLightColorR / 255.0f; | |
583 stru_F8AD28._blv_lights_gs[slot] = (double)pLight->uLightColorG / 255.0f; | |
584 stru_F8AD28._blv_lights_bs[slot] = (double)pLight->uLightColorB / 255.0f; | |
585 stru_F8AD28._blv_lights_light_dot_faces[slot] = abs((int)floorf(v13 + 0.5f)); | |
586 stru_F8AD28._blv_lights_types[slot] = pLight->uLightType; | |
587 | |
588 *pSlot += 1; | |
589 return true; | |
590 } | |
591 } | |
592 | |
593 return false; | |
594 } | |
595 | |
596 //----- (0045CA88) -------------------------------------------------------- | |
597 int LightmapBuilder::_45CA88(stru320 *a2, RenderVertexSoft *a3, int a4, Vec3_float_ *pNormal) | |
598 { | |
599 int result; // eax@1 | |
600 stru320 *v6; // ecx@2 | |
601 RenderVertexSoft *v7; // ebx@2 | |
602 double v8; // st7@2 | |
603 double v9; // st6@2 | |
604 char *v10; // eax@3 | |
605 double v11; // st7@5 | |
606 __int64 v12; // ST2C_8@5 | |
607 float v13; // edx@5 | |
608 int v14; // eax@5 | |
609 float v15; // ST10_4@5 | |
610 Vec3_float_ v16; // ST00_12@5 | |
611 double v17; // st7@5 | |
612 int a5; // [sp+2Ch] [bp-1Ch]@1 | |
613 float v19; // [sp+30h] [bp-18h]@1 | |
614 float v20; // [sp+34h] [bp-14h]@1 | |
615 LightmapBuilder *thisa; // [sp+38h] [bp-10h]@1 | |
616 int v22; // [sp+3Ch] [bp-Ch]@1 | |
617 int *j; // [sp+40h] [bp-8h]@3 | |
618 int i; // [sp+44h] [bp-4h]@1 | |
619 int a3a; // [sp+58h] [bp+10h]@2 | |
620 | |
621 *(float *)&a5 = 0.0; | |
622 v19 = 0.0; | |
623 thisa = this; | |
624 v20 = 0.0; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1089
diff
changeset
|
625 result = _45CBD4(a3, a4, dword_69B010.data(), &v22); |
0 | 626 for ( i = 0; i < v22; result = i ) |
627 { | |
628 v6 = a2; | |
629 a3a = 0; | |
630 v7 = &a3[dword_69B010[i]]; | |
631 v8 = v7->vWorldPosition.z; | |
632 v9 = v7->vWorldPosition.y; | |
633 *(float *)&a5 = v7->vWorldPosition.x; | |
634 v19 = v9; | |
635 v20 = v8; | |
636 v7->flt_2C = 0.0; | |
637 if ( a2->uNumLightsApplied > 0 ) | |
638 { | |
639 v10 = (char *)a2->_blv_lights_ys; | |
640 for ( j = a2->_blv_lights_ys; ; v10 = (char *)j ) | |
641 { | |
642 v11 = (double)*((signed int *)v10 - 60); | |
643 LODWORD(v12) = *((unsigned int *)v10 - 20); | |
644 HIDWORD(v12) = *(unsigned int *)v10; | |
645 LODWORD(v13) = *((unsigned int *)v10 + 60); | |
646 v14 = a3a; | |
647 LOBYTE(v14) = v6->_blv_lights_types[a3a]; | |
648 v15 = v11; | |
649 *(_QWORD *)&v16.x = v12; | |
650 v16.z = v13; | |
651 v17 = _45CC0C_light(v16/*COERCE_VEC3_FLOAT_(v16.x)*/, 1.0, v15, pNormal, *(float *)&a5/*COERCE_FLOAT(&a5)*/, v14) | |
652 + v7->flt_2C; | |
653 ++a3a; | |
654 ++j; | |
655 v7->flt_2C = v17; | |
656 if ( a3a >= a2->uNumLightsApplied ) | |
657 break; | |
658 v6 = a2; | |
659 } | |
660 } | |
661 ++i; | |
662 } | |
663 return result; | |
664 } | |
665 | |
666 //----- (0045CB89) -------------------------------------------------------- | |
667 int LightmapBuilder::_45CB89(RenderVertexSoft *a1, int a2) | |
668 { | |
669 int v3; // edx@1 | |
670 int result; // eax@2 | |
671 char *v5; // ecx@2 | |
672 double v6; // st7@4 | |
673 __int16 v7; // fps@4 | |
674 char v8; // c0@4 | |
675 char v9; // c2@4 | |
676 char v10; // c3@4 | |
677 double v11; // st7@5 | |
678 double v12; // st7@6 | |
679 __int16 v13; // fps@6 | |
680 char v14; // c0@6 | |
681 char v15; // c2@6 | |
682 char v16; // c3@6 | |
683 | |
684 v3 = a2; | |
685 if ( a2 > 0 ) | |
686 { | |
687 HIWORD(result) = HIWORD(a1); | |
688 v5 = (char *)&a1->flt_2C; | |
689 do | |
690 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
691 __debugbreak(); // warning C4700: uninitialized local variable 'v7' used |
0 | 692 if ( *(float *)v5 < 0.0 |
693 || (v6 = *(float *)v5, /*UNDEF(v7),*/ v8 = 1.0 < v6, v9 = 0, v10 = 1.0 == v6, LOWORD(result) = v7, v6 <= 1.0) ) | |
694 { | |
695 v12 = *(float *)v5; | |
696 //UNDEF(v13); | |
697 v14 = 0.0 < v12; | |
698 v15 = 0; | |
699 v16 = 0.0 == v12; | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
700 __debugbreak(); // warning C4700: uninitialized local variable 'v13' used |
0 | 701 LOWORD(result) = v13; |
702 if ( v12 >= 0.0 ) | |
703 v11 = *(float *)v5; | |
704 else | |
705 v11 = 0.0; | |
706 } | |
707 else | |
708 { | |
709 v11 = 1.0; | |
710 } | |
711 *(float *)v5 = v11; | |
712 v5 += 48; | |
713 --v3; | |
714 } | |
715 while ( v3 ); | |
716 } | |
717 return result; | |
718 } | |
719 | |
720 //----- (0045CBD4) -------------------------------------------------------- | |
721 int LightmapBuilder::_45CBD4(RenderVertexSoft *a2, int a3, int *a4, int *a5) | |
722 { | |
723 int result; // eax@1 | |
724 int v6; // edx@1 | |
725 int v7; // ecx@2 | |
726 int v8; // esi@2 | |
727 | |
728 result = (int)a5; | |
729 v6 = 0; | |
730 for ( *a5 = 0; v6 < a3; ++v6 ) | |
731 { | |
732 v7 = *a5; | |
733 v8 = 0; | |
734 if ( *a5 <= 0 ) | |
735 { | |
736 LABEL_5: | |
737 a4[v7] = v6; | |
738 ++*a5; | |
739 } | |
740 else | |
741 { | |
742 while ( a4[v8] != v6 ) | |
743 { | |
744 ++v8; | |
745 if ( v8 >= v7 ) | |
746 goto LABEL_5; | |
747 } | |
748 } | |
749 } | |
750 return result; | |
751 } | |
752 | |
753 //----- (0045CC0C) -------------------------------------------------------- | |
754 double LightmapBuilder::_45CC0C_light(Vec3_float_ a1, float a2, float a3, Vec3_float_ *pNormal, float a5, int uLightType) | |
755 { | |
756 float v7; // esi@1 | |
757 int v8; // eax@1 | |
758 int v9; // ebx@1 | |
759 unsigned int v10; // ecx@1 | |
760 int v11; // edx@2 | |
761 int v12; // edx@4 | |
762 unsigned int v13; // edx@6 | |
763 double v14; // st7@7 | |
764 double result; // st7@8 | |
765 double v16; // st7@9 | |
766 int v17; // esi@9 | |
767 const char *v18; // ecx@9 | |
768 double v19; // st7@10 | |
769 double v20; // st7@10 | |
770 std::string v21; // [sp-10h] [bp-40h]@13 | |
771 const char *v22[6]; // [sp+0h] [bp-30h]@10 | |
772 double v23; // [sp+18h] [bp-18h]@1 | |
773 double v24; // [sp+20h] [bp-10h]@1 | |
774 int v25; // [sp+28h] [bp-8h]@1 | |
775 int v26; // [sp+2Ch] [bp-4h]@1 | |
776 | |
777 v7 = a5; | |
778 LODWORD(a5) = *(unsigned int *)(LODWORD(a5) + 8); | |
779 //v24 = a5 + 6.7553994e15; | |
780 v26 = floorf(a5 + 0.5f);//LODWORD(v24); | |
781 LODWORD(a5) = *(unsigned int *)(LODWORD(v7) + 4); | |
782 //v24 = a5 + 6.7553994e15; | |
783 auto _v24 = floorf(a5 + 0.5f); | |
784 LODWORD(a5) = *(unsigned int *)LODWORD(v7); | |
785 //v23 = a5 + 6.7553994e15; | |
786 auto _v23 = floorf(a5 + 0.5f); | |
787 //*(_QWORD *)((char *)&v24 + 4) = __PAIR__(LODWORD(v24), LODWORD(v23)); | |
788 v26 = abs((signed)LODWORD(a1.z) - v26); | |
789 //v25 = abs((signed)LODWORD(a1.y) - (signed)LODWORD(v24)); | |
790 //v8 = abs((int)a1.x - (signed)LODWORD(v23)); | |
791 v25 = abs((signed)LODWORD(a1.y) - (signed)_v24); | |
792 v8 = abs((int)a1.x - (signed)_v23); | |
2235
6ab7d7c112bb
adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents:
2155
diff
changeset
|
793 v14 = int_get_vector_length(v26, v25, v8); |
0 | 794 if ( v14 <= a3 ) |
795 { | |
796 a5 = v14 / a3; | |
797 v16 = (double)(signed int)a1.x; | |
798 *(float *)&v23 = (double)SLODWORD(a1.y); | |
799 LODWORD(a1.x) = *(unsigned int *)LODWORD(v7); | |
800 v17 = LODWORD(v7) + 4; | |
801 *((float *)&v23 + 1) = (double)SLODWORD(a1.z); | |
802 LODWORD(a1.y) = *(unsigned int *)v17; | |
803 LODWORD(a1.z) = *(unsigned int *)(v17 + 4); | |
804 a3 = *((float *)&v23 + 1) - a1.z; | |
805 a1.z = a3; | |
806 a1.x = v16 - a1.x; | |
807 a1.y = (float)v23 - a1.y; | |
808 a1.Normalize(); | |
809 if ( uLightType & 4 ) | |
810 { | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1394
diff
changeset
|
811 __debugbreak(); // warning C4700: uninitialized local variable 'v18' used |
0 | 812 v22[1] = v18; |
813 uLightType = dword_4D86D8; | |
814 v22[0] = v18; | |
815 v19 = fabs(a1.z * pNormal->z + a1.y * pNormal->y + a1.x * pNormal->x); | |
816 v20 = v19 * *(float *)&uLightType * a2; | |
817 } | |
818 else | |
819 { | |
820 if ( uLightType & 8 ) | |
821 { | |
822 v20 = 1.3 * a2; | |
823 } | |
824 else | |
825 { | |
826 MessageBoxW(nullptr, L"Invalid light type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:783", 0); | |
827 v20 = *(float *)&uLightType; | |
828 } | |
829 } | |
830 result = v20 - a5 * v20; | |
831 } | |
832 else | |
833 { | |
834 result = 0.0; | |
835 } | |
836 return result; | |
837 } | |
838 // 4D86D8: using guessed type int dword_4D86D8; | |
839 | |
840 //----- (0045CDB7) -------------------------------------------------------- | |
841 bool LightmapBuilder::ApplyLights_OutdoorFace(ODMFace *pFace) | |
842 { | |
843 int v2; // esi@1 | |
844 int v3; // eax@1 | |
845 MobileLight *pMobileLight; // ebx@2 | |
846 int v5; // esi@5 | |
847 StationaryLight *pStationaryLight; // ebx@6 | |
848 bool result; // eax@9 | |
849 LightmapBuilder *thisa; // [sp+Ch] [bp-8h]@1 | |
850 int pSlot; // [sp+10h] [bp-4h]@1 | |
851 | |
852 v2 = 0; | |
853 thisa = this; | |
854 v3 = stru_F8AD28.uDefaultAmbientLightLevel + pFace->uShadeType; | |
855 pSlot = 0; | |
856 stru_F8AD28.uCurrentAmbientLightLevel = v3 << 16; | |
857 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
858 { | |
859 pMobileLight = pMobileLightsStack->pLights; | |
860 do | |
861 { | |
862 if ( pSlot >= 20 ) | |
863 break; | |
864 ApplyLight_ODM((StationaryLight *)pMobileLight, pFace, (unsigned int *)&pSlot, 1); | |
865 ++v2; | |
866 ++pMobileLight; | |
867 } | |
868 while ( v2 < pMobileLightsStack->uNumLightsActive ); | |
869 } | |
870 v5 = 0; | |
871 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
872 { | |
873 pStationaryLight = pStationaryLightsStack->pLights; | |
874 do | |
875 { | |
876 if ( pSlot >= 20 ) | |
877 break; | |
878 ApplyLight_ODM(pStationaryLight, pFace, (unsigned int *)&pSlot, 0); | |
879 ++v5; | |
880 ++pStationaryLight; | |
881 } | |
882 while ( v5 < pStationaryLightsStack->uNumLightsActive ); | |
883 } | |
884 result = pSlot; | |
885 stru_F8AD28.uNumLightsApplied = pSlot; | |
886 return true; | |
887 } | |
888 | |
889 //----- (0045CE50) -------------------------------------------------------- | |
890 bool LightmapBuilder::ApplyLight_ODM(StationaryLight *pLight, ODMFace *pFace, unsigned int *pSlot, char a4) | |
891 { | |
892 int result; // eax@0 | |
893 signed int v6; // ebx@1 | |
894 int v7; // ecx@2 | |
895 int v8; // esi@4 | |
896 int v9; // edx@6 | |
897 int v10; // ecx@8 | |
898 int v11; // eax@11 | |
899 unsigned int v12; // ebx@11 | |
2153 | 900 //RenderD3D *v13; // ecx@11 |
0 | 901 char v14; // dl@11 |
902 | |
62 | 903 //__debugbreak(); |
0 | 904 |
905 v6 = pLight->uRadius; | |
906 if ( v6 > 0 | |
907 && (result = (int)pFace, v7 = pLight->vPosition.x, v7 > pFace->pBoundingBox.x1 - v6) | |
908 && v7 < v6 + pFace->pBoundingBox.x2 | |
909 && (v8 = pLight->vPosition.y, v8 > pFace->pBoundingBox.y1 - v6) | |
910 && v8 < v6 + pFace->pBoundingBox.y2 | |
911 && (v9 = pLight->vPosition.z, v9 > pFace->pBoundingBox.z1 - v6) | |
912 && v9 < v6 + pFace->pBoundingBox.z2 | |
913 && ((v10 = (pFace->pFacePlane.dist | |
914 + pLight->vPosition.x * pFace->pFacePlane.vNormal.x | |
915 + v8 * pFace->pFacePlane.vNormal.y | |
916 + v9 * pFace->pFacePlane.vNormal.z) >> 16, | |
917 a4) | |
918 || v10 >= 0) | |
919 && v10 <= v6 ) | |
920 { | |
921 stru_F8AD28._blv_lights_radii[*pSlot] = v6; | |
922 stru_F8AD28._blv_lights_inv_radii[*pSlot] = 65536 / v6; | |
923 stru_F8AD28._blv_lights_xs[*pSlot] = pLight->vPosition.x; | |
924 stru_F8AD28._blv_lights_ys[*pSlot] = pLight->vPosition.y; | |
925 stru_F8AD28._blv_lights_zs[*pSlot] = pLight->vPosition.z; | |
926 stru_F8AD28._blv_lights_rs[*pSlot] = (double)pLight->uLightColorR * 0.0039215689; | |
927 stru_F8AD28._blv_lights_gs[*pSlot] = (double)pLight->uLightColorG * 0.0039215689; | |
928 stru_F8AD28._blv_lights_bs[*pSlot] = (double)pLight->uLightColorB * 0.0039215689; | |
929 v11 = abs(v10); | |
930 v12 = pRenderer->bUsingSpecular; | |
931 stru_F8AD28._blv_lights_light_dot_faces[*pSlot] = v11; | |
932 stru_F8AD28._blv_lights_types[*pSlot] = pLight->uLightType; | |
2153 | 933 //v13 = pRenderer->pRenderD3D; |
0 | 934 v14 = stru_F8AD28._blv_lights_types[*pSlot]; |
2154 | 935 if ( /*pRenderer->pRenderD3D &&*/ v12 && v14 & 4 ) |
0 | 936 v14 = _4E94D2_light_type; |
937 stru_F8AD28._blv_lights_types[*pSlot] = v14; | |
938 result = 4 * *pSlot; | |
2153 | 939 if ( /*v13*/true && v12 ) |
0 | 940 { |
941 if ( stru_F8AD28._blv_lights_types[*pSlot] & 4 ) | |
942 { | |
943 *(float *)((char *)stru_F8AD28._blv_lights_rs + result) = *(float *)((char *)stru_F8AD28._blv_lights_rs + result) | |
944 * 0.33000001; | |
945 *(float *)((char *)stru_F8AD28._blv_lights_gs + result) = *(float *)((char *)stru_F8AD28._blv_lights_gs + result) | |
946 * 0.33000001; | |
947 *(float *)((char *)stru_F8AD28._blv_lights_bs + result) = *(float *)((char *)stru_F8AD28._blv_lights_bs + result) | |
948 * 0.33000001; | |
949 } | |
950 } | |
951 ++*pSlot; | |
952 LOBYTE(result) = 1; | |
953 } | |
954 else | |
955 { | |
956 LOBYTE(result) = 0; | |
957 } | |
958 return result; | |
959 } | |
960 // 4E94D2: using guessed type char _4E94D2_light_type; | |
961 | |
962 //----- (0045D036) -------------------------------------------------------- | |
86 | 963 bool LightmapBuilder::StackLights_TerrainFace(Vec3_float_ *pNormal, float *a2, RenderVertexSoft *a3, unsigned int uStripType, bool bLightBackfaces) |
0 | 964 { |
86 | 965 /*int v6; // esi@1 |
0 | 966 //LightmapBuilder *v7; // edi@1 |
967 MobileLight *v8; // ebx@2 | |
968 int v9; // esi@5 | |
969 StationaryLight *v10; // ebx@6 | |
970 //bool result; // eax@9 | |
971 unsigned int a7; // [sp+Ch] [bp-4h]@1 | |
972 | |
973 v6 = 0; | |
974 //v7 = this; | |
975 a7 = 0; | |
976 stru_F8AD28.uCurrentAmbientLightLevel = pOutdoor->field_CBC_terrain_triangles_shade_type; | |
977 if ( pMobileLightsStack->uNumLightsActive > 0 ) | |
978 { | |
979 v8 = pMobileLightsStack->pLights; | |
980 do | |
981 { | |
982 if ( (signed int)a7 >= 20 ) | |
983 break; | |
984 StackLight_TerrainFace((StationaryLight *)v8, pNormal, a3, a1, uStripType, bLightBackfaces, &a7); | |
985 ++v6; | |
986 ++v8; | |
987 } | |
988 while ( v6 < pMobileLightsStack->uNumLightsActive ); | |
989 } | |
990 v9 = 0; | |
991 if ( pStationaryLightsStack->uNumLightsActive > 0 ) | |
992 { | |
993 v10 = pStationaryLightsStack->pLights; | |
994 do | |
995 { | |
996 if ( (signed int)a7 >= 20 ) | |
997 break; | |
998 StackLight_TerrainFace(v10, pNormal, a3, a1, uStripType, bLightBackfaces, &a7); | |
999 ++v9; | |
1000 ++v10; | |
1001 } | |
1002 while ( v9 < pStationaryLightsStack->uNumLightsActive ); | |
1003 } | |
1004 | |
1005 stru_F8AD28.uNumLightsApplied = a7; | |
86 | 1006 return true;*/ |
1007 // bool __stdcall sub_45D036(struct Vec3<float> *pNormal, int a2, struct RenderVertex *a3, int a4, signed int X) | |
1008 //{ | |
1009 float v6; // ebx@2 | |
1010 unsigned int v10; // [sp+Ch] [bp-4h]@1 | |
1011 int i; | |
1012 | |
1013 v10 = 0; | |
638 | 1014 stru_F8AD28.uCurrentAmbientLightLevel = pOutdoor->max_terrain_dimming_level; |
86 | 1015 for (i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) |
1016 { | |
1017 if ( v10 >= 20 ) | |
1018 break; | |
1019 StackLight_TerrainFace((StationaryLight *)&pMobileLightsStack->pLights[i], pNormal, a2, a3, uStripType, bLightBackfaces, &v10); | |
1020 } | |
1021 | |
1022 for (i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) | |
1023 { | |
1024 if ( v10 >= 20 ) | |
1025 break; | |
1026 StackLight_TerrainFace(&pStationaryLightsStack->pLights[i], pNormal, a2, a3, uStripType, bLightBackfaces, &v10); | |
1027 } | |
1028 | |
1029 stru_F8AD28.uNumLightsApplied = v10; | |
0 | 1030 return true; |
86 | 1031 |
0 | 1032 } |
1033 // 519AB4: using guessed type int uNumStationaryLightsApplied; | |
1034 | |
1035 //----- (0045D0D5) -------------------------------------------------------- | |
1036 bool LightmapBuilder::StackLight_TerrainFace(StationaryLight *pLight, Vec3_float_ *pNormal, float *a3, RenderVertexSoft *a1, unsigned int uStripType, int X, unsigned int *pSlot) | |
1037 { | |
1038 StationaryLight *v8; // edi@1 | |
1039 bool result; // eax@1 | |
1040 unsigned int v10; // esi@2 | |
1041 RenderVertexSoft *v11; // ebx@2 | |
1042 float v12; // eax@3 | |
1043 float v13; // eax@4 | |
1044 double v14; // st7@11 | |
1045 double maxz; // st7@11 | |
1046 double v16; // st7@11 | |
1047 double v17; // st6@11 | |
1048 __int16 v18; // fps@11 | |
1049 char v19; // c0@11 | |
1050 char v20; // c2@11 | |
1051 char v21; // c3@11 | |
1052 double v22; // st6@12 | |
1053 __int16 v23; // fps@12 | |
1054 char v24; // c0@12 | |
1055 char v25; // c2@12 | |
1056 char v26; // c3@12 | |
1057 double v27; // st7@13 | |
1058 double v28; // st6@13 | |
1059 __int16 v29; // fps@13 | |
1060 char v30; // c0@13 | |
1061 char v31; // c2@13 | |
1062 char v32; // c3@13 | |
1063 double v33; // st6@14 | |
1064 __int16 v34; // fps@14 | |
1065 char v35; // c0@14 | |
1066 char v36; // c2@14 | |
1067 char v37; // c3@14 | |
1068 double v38; // st7@15 | |
1069 double v39; // st6@15 | |
1070 __int16 v40; // fps@15 | |
1071 char v41; // c0@15 | |
1072 char v42; // c2@15 | |
1073 char v43; // c3@15 | |
1074 double v44; // st6@16 | |
1075 __int16 v45; // fps@16 | |
1076 char v46; // c0@16 | |
1077 char v47; // c2@16 | |
1078 char v48; // c3@16 | |
1079 Vec3_float_ *v49; // esi@17 | |
1080 double v50; // st7@17 | |
1081 double v51; // st6@17 | |
1082 signed int v52; // ecx@17 | |
1083 unsigned int *v53; // esi@18 | |
1084 int v54; // eax@18 | |
1085 unsigned int v55; // ebx@18 | |
2154 | 1086 //RenderD3D *v56; // ecx@18 |
0 | 1087 char v57; // dl@18 |
1088 std::string v58; // [sp-18h] [bp-38h]@10 | |
1089 const char *v59; // [sp-8h] [bp-28h]@10 | |
1090 signed int v60; // [sp-4h] [bp-24h]@10 | |
1091 double v61; // [sp+Ch] [bp-14h]@11 | |
1092 float minz; // [sp+14h] [bp-Ch]@11 | |
1093 int v63; // [sp+18h] [bp-8h]@1 | |
1094 float v64; // [sp+1Ch] [bp-4h]@5 | |
1095 | |
1096 v8 = pLight; | |
1097 result = pLight->uRadius; | |
1098 v63 = pLight->uRadius; | |
1099 if ( result <= 0 ) | |
86 | 1100 return 0; |
1101 //v10 = uStripType; | |
0 | 1102 v11 = a1; |
1103 if ( uStripType == 4 ) | |
1104 { | |
1105 pLight = (StationaryLight *)LODWORD(a1->vWorldPosition.x); | |
1106 v12 = a1[3].vWorldPosition.x; | |
1107 } | |
1108 else | |
1109 { | |
1110 if ( uStripType != 3 ) | |
1111 { | |
1112 MessageBoxW(nullptr, L"Uknown strip type detected!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:981", 0); | |
1113 goto LABEL_11; | |
1114 } | |
1115 if ( (unsigned char)X ) | |
1116 { | |
1117 pLight = (StationaryLight *)LODWORD(a1->vWorldPosition.x); | |
1118 uStripType = LODWORD(a1[2].vWorldPosition.x); | |
1119 a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); | |
1120 v13 = v11[2].vWorldPosition.y; | |
1121 goto LABEL_5; | |
1122 } | |
1123 pLight = (StationaryLight *)LODWORD(a1[1].vWorldPosition.x); | |
1124 v12 = a1[2].vWorldPosition.x; | |
1125 } | |
1126 uStripType = LODWORD(v12); | |
1127 a1 = (RenderVertexSoft *)LODWORD(a1[1].vWorldPosition.y); | |
1128 v13 = v11->vWorldPosition.y; | |
1129 LABEL_5: | |
1130 v64 = v13; | |
1131 LABEL_11: | |
86 | 1132 //v60 = v10; |
0 | 1133 v59 = (const char *)v11; |
86 | 1134 v60 = uStripType; |
1135 minz = pGame->pIndoorCameraD3D->GetPolygonMinZ(v11, uStripType); | |
1136 maxz = pGame->pIndoorCameraD3D->GetPolygonMaxZ(v11, uStripType); | |
0 | 1137 result = v8->vPosition.x; |
1138 *((float *)&v61 + 1) = maxz; | |
1139 v16 = (double)result; | |
1140 *(float *)&X = (double)v63; | |
1141 v17 = *(float *)&pLight - *(float *)&X; | |
1142 //UNDEF(v18); | |
86 | 1143 //v19 = v16 < v17; |
0 | 1144 v20 = 0; |
86 | 1145 //v21 = v16 == v17; |
1146 /* BYTE1(result) = HIBYTE(v18); | |
0 | 1147 if ( v16 <= v17 |
1148 || (v22 = *(float *)&X + *(float *)&uStripType, | |
1149 //UNDEF(v23), | |
1150 v24 = v16 < v22, | |
1151 v25 = 0, | |
1152 v26 = v16 == v22, | |
1153 BYTE1(result) = HIBYTE(v23), | |
1154 v16 >= v22) | |
1155 || (result = v8->vPosition.y, | |
1156 pLight = (StationaryLight *)v8->vPosition.y, | |
1157 v27 = (double)(signed int)pLight, | |
1158 v28 = *(float *)&a1 - *(float *)&X, | |
1159 //UNDEF(v29), | |
1160 v30 = v27 < v28, | |
1161 v31 = 0, | |
1162 v32 = v27 == v28, | |
1163 BYTE1(result) = HIBYTE(v29), | |
1164 v27 <= v28) | |
1165 || (v33 = *(float *)&X + v64, | |
1166 //UNDEF(v34), | |
1167 v35 = v27 < v33, | |
1168 v36 = 0, | |
1169 v37 = v27 == v33, | |
1170 BYTE1(result) = HIBYTE(v34), | |
1171 v27 >= v33) | |
1172 || (result = v8->vPosition.z, | |
1173 pLight = (StationaryLight *)v8->vPosition.z, | |
1174 v38 = (double)(signed int)pLight, | |
1175 v39 = minz - *(float *)&X, | |
1176 //UNDEF(v40), | |
1177 v41 = v38 < v39, | |
1178 v42 = 0, | |
1179 v43 = v38 == v39, | |
1180 BYTE1(result) = HIBYTE(v40), | |
1181 v38 <= v39) | |
1182 || (v44 = *(float *)&X + *((float *)&v61 + 1), | |
1183 //UNDEF(v45), | |
1184 v46 = v38 < v44, | |
1185 v47 = 0, | |
1186 v48 = v38 == v44, | |
1187 BYTE1(result) = HIBYTE(v45), | |
1188 v38 >= v44) | |
1189 || (v49 = pNormal, | |
1190 Vec3_float_::NegDot(&v11->vWorldPosition, pNormal, a3), | |
1191 X = v8->vPosition.y, | |
1192 v50 = (double)X * v49->y, | |
1193 X = v8->vPosition.z, | |
1194 v51 = (double)X * v49->z, | |
1195 X = v8->vPosition.x, | |
1196 *(float *)&a3 = v50 + v51 + (double)X * v49->x + *a3, | |
1197 v61 = *(float *)&a3 + 6.7553994e15, | |
1198 result = LODWORD(v61), | |
1199 X = LODWORD(v61), | |
1200 v52 = v63, | |
86 | 1201 SLODWORD(v61) > v63) )*/ |
1202 if (0) | |
1203 return 0; | |
0 | 1204 v53 = pSlot; |
1205 v60 = X; | |
1206 stru_F8AD28._blv_lights_radii[*pSlot] = v63; | |
86 | 1207 stru_F8AD28._blv_lights_inv_radii[*v53] = 65536 / v63; |
0 | 1208 stru_F8AD28._blv_lights_xs[*v53] = v8->vPosition.x; |
1209 stru_F8AD28._blv_lights_ys[*v53] = v8->vPosition.y; | |
1210 stru_F8AD28._blv_lights_zs[*v53] = v8->vPosition.z; | |
1211 a3 = (float *)v8->uLightColorR; | |
86 | 1212 stru_F8AD28._blv_lights_rs[*v53] = (double)(signed int)a3 * 0.003921568859368563; |
0 | 1213 a3 = (float *)v8->uLightColorG; |
86 | 1214 stru_F8AD28._blv_lights_gs[*v53] = (double)(signed int)a3 * 0.003921568859368563; |
0 | 1215 a3 = (float *)v8->uLightColorB; |
86 | 1216 stru_F8AD28._blv_lights_bs[*v53] = (double)(signed int)a3 * 0.003921568859368563; |
0 | 1217 v54 = abs(v60); |
1218 v55 = pRenderer->bUsingSpecular; | |
1219 stru_F8AD28._blv_lights_light_dot_faces[*v53] = v54; | |
1220 stru_F8AD28._blv_lights_types[*v53] = v8->uLightType; | |
2154 | 1221 //v56 = pRenderer->pRenderD3D; |
0 | 1222 v57 = stru_F8AD28._blv_lights_types[*v53]; |
2154 | 1223 if ( /*pRenderer->pRenderD3D &&*/ v55 && v57 & 4 ) |
0 | 1224 v57 = _4E94D2_light_type; |
1225 stru_F8AD28._blv_lights_types[*v53] = v57; | |
1226 result = 4 * *v53; | |
2154 | 1227 if ( /*v56 &&*/ v55 ) |
0 | 1228 { |
1229 if ( stru_F8AD28._blv_lights_types[*v53] & 4 ) | |
1230 { | |
1231 *(float *)((char *)stru_F8AD28._blv_lights_rs + result) = *(float *)((char *)stru_F8AD28._blv_lights_rs + result) | |
86 | 1232 * 0.3300000131130219; |
0 | 1233 *(float *)((char *)stru_F8AD28._blv_lights_gs + result) = *(float *)((char *)stru_F8AD28._blv_lights_gs + result) |
86 | 1234 * 0.3300000131130219; |
0 | 1235 *(float *)((char *)stru_F8AD28._blv_lights_bs + result) = *(float *)((char *)stru_F8AD28._blv_lights_bs + result) |
86 | 1236 * 0.3300000131130219; |
0 | 1237 } |
1238 } | |
1239 ++*v53; | |
86 | 1240 return 1; |
0 | 1241 } |
1242 | |
1243 //----- (0045D698) -------------------------------------------------------- | |
1244 bool LightmapBuilder::DrawDebugOutlines(char bit_one_for_list1__bit_two_for_list2) | |
1245 { | |
1246 bool result; // eax@1 | |
1247 LightmapBuilder *v3; // esi@1 | |
1248 RenderVertexSoft *v4; // edi@3 | |
1249 RenderVertexSoft *v5; // edi@7 | |
1250 IndoorCameraD3D *thisa; // [sp+10h] [bp-8h]@1 | |
1251 bool v7; // [sp+14h] [bp-4h]@2 | |
1252 bool a2a; // [sp+20h] [bp+8h]@6 | |
1253 | |
1254 result = (bool)pGame->pIndoorCameraD3D; | |
1255 v3 = this; | |
1256 thisa = pGame->pIndoorCameraD3D; | |
1257 if ( bit_one_for_list1__bit_two_for_list2 & 1 ) | |
1258 { | |
1259 v7 = 0; | |
1260 if ( (signed int)this->std__vector_000004_size > 0 ) | |
1261 { | |
1262 v4 = this->std__vector_000004[0].pVertices; | |
1263 do | |
1264 { | |
1265 pGame->pIndoorCameraD3D->debug_outline_sw(v4, *((unsigned int *)v4 - 1), 0xFF00u, 0.0); | |
1266 ++v7; | |
1267 v4 = (RenderVertexSoft *)((char *)v4 + 3100); | |
1268 result = v7; | |
1269 } | |
1270 while ( v7 < (signed int)v3->std__vector_000004_size ); | |
1271 } | |
1272 } | |
1273 if ( bit_one_for_list1__bit_two_for_list2 & 2 ) | |
1274 { | |
1275 a2a = 0; | |
1276 if ( (signed int)v3->std__vector_183808_size > 0 ) | |
1277 { | |
1278 v5 = v3->std__vector_183808[0].pVertices; | |
1279 do | |
1280 { | |
1281 pGame->pIndoorCameraD3D->debug_outline_sw(v5, *((unsigned int *)v5 - 1), 0xC04000u, 0.00019999999); | |
1282 ++a2a; | |
1283 v5 = (RenderVertexSoft *)((char *)v5 + 3100); | |
1284 result = a2a; | |
1285 } | |
1286 while ( a2a < (signed int)v3->std__vector_183808_size ); | |
1287 } | |
1288 } | |
1289 LOBYTE(result) = 1; | |
1290 return result; | |
1291 } | |
1292 | |
1293 //----- (0045D73F) -------------------------------------------------------- | |
1394 | 1294 void LightmapBuilder::DrawLightmapsType(int type) |
0 | 1295 { |
1394 | 1296 if (type == 2) |
1297 Draw_183808_Lightmaps(); | |
0 | 1298 } |
1299 | |
1300 //----- (0045D74F) -------------------------------------------------------- | |
1394 | 1301 bool LightmapBuilder::DrawLightmaps(int *indices) |
0 | 1302 { |
1390 | 1303 //char v3; // zf@1 |
0 | 1304 IDirect3DDevice3 *v4; // eax@2 |
1305 HRESULT v5; // eax@2 | |
1306 //char *v6; // eax@2 | |
2155 | 1307 //struct IDirect3DTexture2 *v7; // edi@4 |
0 | 1308 HRESULT v8; // eax@8 |
1309 HRESULT v9; // eax@8 | |
1310 HRESULT v10; // eax@8 | |
1311 HRESULT v11; // eax@8 | |
1312 HRESULT v12; // eax@8 | |
1394 | 1313 //int *v13; // eax@8 |
1390 | 1314 //float v14; // ecx@15 |
1315 //IDirect3DDevice3 *v15; // eax@21 | |
1316 //HRESULT v16; // eax@21 | |
1317 //IDirect3DDevice3 *v17; // eax@21 | |
1318 //HRESULT v18; // eax@21 | |
1319 //IDirect3DDevice3 *v19; // eax@21 | |
1320 //HRESULT v20; // eax@21 | |
1321 //IDirect3DDevice3 *v21; // eax@21 | |
1322 //HRESULT v22; // eax@21 | |
0 | 1323 //IDirect3DDevice3 *v23; // eax@23 |
1324 std::string v25; // [sp+44h] [bp-44h]@12 | |
1325 signed int v26; // [sp+48h] [bp-40h]@21 | |
1326 signed int v27; // [sp+4Ch] [bp-3Ch]@21 | |
1327 Lightmap *v28; // [sp+50h] [bp-38h]@2 | |
1328 int v29; // [sp+54h] [bp-34h]@2 | |
1329 //float v30; // [sp+58h] [bp-30h]@2 | |
1394 | 1330 Vec3_float_ arg4; |
1331 //int arg4; // [sp+68h] [bp-20h]@8 | |
1332 //float v32; // [sp+6Ch] [bp-1Ch]@8 | |
1333 //float v33; // [sp+70h] [bp-18h]@8 | |
0 | 1334 int v34; // [sp+74h] [bp-14h]@19 |
1335 int v35; // [sp+78h] [bp-10h]@2 | |
1394 | 1336 //int *v36; // [sp+7Ch] [bp-Ch]@10 |
1390 | 1337 //int a1; // [sp+80h] [bp-8h]@12 |
1338 //float v38; // [sp+84h] [bp-4h]@1 | |
0 | 1339 |
1390 | 1340 if (std__vector_000004_size == 0) |
2155 | 1341 return true; |
1342 | |
1343 if (byte_4D864C && pGame->uFlags & GAME_FLAGS_1_01_lightmap_related) | |
1344 return true; | |
1394 | 1345 |
2155 | 1346 pRenderer->BeginLightmaps(); |
1394 | 1347 |
1348 arg4.x = 1.0f; | |
1349 arg4.y = 1.0f; | |
1350 arg4.z = 1.0f; | |
1351 if (indices) | |
0 | 1352 { |
1980 | 1353 for (int* i = indices; *i != -1; ++i) |
0 | 1354 { |
1394 | 1355 v28 = &std__vector_000004[*i]; |
2155 | 1356 if ( !pRenderer->DrawLightmap(v28, &arg4, 0.0) ) |
1545 | 1357 Error("Invalid lightmap detected! (%u)", *i); |
0 | 1358 } |
1359 } | |
1360 else | |
1361 { | |
1980 | 1362 for (unsigned int i = 0; i < std__vector_000004_size; ++i) |
0 | 1363 { |
1980 | 1364 Lightmap* _a1 = &std__vector_000004[(int)i]; |
2155 | 1365 if ( !pRenderer->DrawLightmap(_a1, &arg4, 0.0) ) |
1366 Error("Invalid lightmap detected! (%u)", i); | |
0 | 1367 } |
1368 } | |
1394 | 1369 |
2155 | 1370 pRenderer->EndLightmaps(); |
1371 | |
1394 | 1372 return true; |
0 | 1373 } |
1374 | |
1375 | |
1376 //----- (0045DA56) -------------------------------------------------------- | |
1394 | 1377 bool LightmapBuilder::DoDraw_183808_Lightmaps(float z_bias) |
0 | 1378 { |
1379 Vec3_float_ v; // [sp+Ch] [bp-1Ch]@2 | |
1380 v.z = 1.0; | |
1381 v.y = 1.0; | |
1382 v.x = 1.0; | |
1383 | |
1384 for (uint i = 0; i < std__vector_183808_size; ++i) | |
2155 | 1385 if (!pRenderer->DrawLightmap(std__vector_183808 + i, &v, z_bias)) |
1386 Error("Invalid lightmap detected! (%u)", i); | |
0 | 1387 |
1388 return true; | |
1389 } | |
1390 | |
1391 //----- (0045DAE8) -------------------------------------------------------- | |
2155 | 1392 bool Render::DrawLightmap(Lightmap *pLightmap, Vec3_float_ *pColorMult, float z_bias) |
0 | 1393 { |
1394 double v10; // st7@4 | |
1395 double v14; // st7@7 | |
1396 __int16 v15; // fps@8 | |
1397 double v18; // st3@8 | |
1398 signed int v24; // [sp-1Ch] [bp-670h]@13 | |
1399 const char *v25; // [sp-18h] [bp-66Ch]@13 | |
1400 int v26; // [sp-14h] [bp-668h]@13 | |
1401 RenderVertexD3D3 a2[32]; // [sp+0h] [bp-654h]@7 | |
1402 | |
1403 | |
1404 if (pLightmap->uNumVertices < 3) | |
1405 { | |
1406 Log::Warning(L"Lightmap uNumVertices < 3"); | |
1407 return false; | |
1408 } | |
1409 | |
1410 uint uLightmapColorMaskR = (pLightmap->uColorMask >> 16) & 0xFF; | |
1411 uint uLightmapColorR = floorf(uLightmapColorMaskR * pLightmap->fBrightness * pColorMult->x + 0.5f); | |
1412 | |
1413 uint uLightmapColorMaskG = (pLightmap->uColorMask >> 8) & 0xFF; | |
1414 uint uLightmapColorG = floorf(uLightmapColorMaskG * pLightmap->fBrightness * pColorMult->y + 0.5f); | |
1415 | |
1416 uint uLightmapColorMaskB = pLightmap->uColorMask & 0xFF; | |
1417 uint uLightmapColorB = floorf(uLightmapColorMaskB * pLightmap->fBrightness * pColorMult->z + 0.5f); | |
1418 | |
1419 uint uLightmapColor = uLightmapColorB | (uLightmapColorMaskG << 8) | (uLightmapColorMaskR << 16); | |
1420 | |
1421 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
1637 | 1422 v10 = (double)pODMRenderParams->shading_dist_mist; |
0 | 1423 else |
1424 v10 = 16192.0; | |
1425 v14 = 1.0 / v10; | |
1426 | |
1427 for (uint i = 0; i < pLightmap->uNumVertices; ++i) | |
1428 { | |
1429 v18 = 1.0 - 1.0 / (v14 * pLightmap->pVertices[i].vWorldViewPosition.x * 1000.0); | |
1430 if (fabsf(z_bias) < 1e-5f) | |
1431 { | |
1432 v18 = v18 - z_bias; | |
1433 if (v18 < 0.000099999997) | |
1434 v18 = 0.000099999997; | |
1435 } | |
1436 | |
1437 a2[i].pos.x = pLightmap->pVertices[i].vWorldViewProjX; | |
1438 a2[i].pos.z = v18; | |
1439 a2[i].pos.y = pLightmap->pVertices[i].vWorldViewProjY; | |
1440 a2[i].rhw = 1.0 / pLightmap->pVertices[i].vWorldViewPosition.x; | |
1441 a2[i].diffuse = uLightmapColor; | |
1442 a2[i].specular = 0; | |
1443 a2[i].texcoord.x = pLightmap->pVertices[i].u; | |
1444 a2[i].texcoord.y = pLightmap->pVertices[i].v; | |
1445 } | |
1446 | |
1447 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1448 v24 = D3DDP_DONOTLIGHT | D3DDP_DONOTCLIP | D3DDP_DONOTUPDATEEXTENTS; | |
1449 else | |
1450 v24 = D3DDP_DONOTLIGHT; | |
1451 | |
1452 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, | |
1453 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, | |
1454 a2, | |
1455 pLightmap->uNumVertices, | |
1456 v24)); | |
1457 | |
1458 return true; | |
1459 } | |
1460 | |
1461 //----- (0045DCA9) -------------------------------------------------------- | |
1394 | 1462 void LightmapBuilder::Draw_183808_Lightmaps() |
0 | 1463 { |
1464 if (!std__vector_183808_size) | |
1465 return; | |
1466 | |
2155 | 1467 pRenderer->BeginLightmaps2(); |
0 | 1468 |
1394 | 1469 DoDraw_183808_Lightmaps(0.00050000002); |
0 | 1470 |
2155 | 1471 pRenderer->EndLightmaps2(); |
0 | 1472 } |