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