Mercurial > mm7
diff LightmapBuilder.cpp @ 2245:8817c398b792
for RasterLine2D
author | Ritor1 |
---|---|
date | Tue, 25 Feb 2014 20:02:06 +0600 |
parents | 6ab7d7c112bb |
children | 47bcb700b74b aff7a7b072b7 |
line wrap: on
line diff
--- a/LightmapBuilder.cpp Mon Feb 24 16:54:21 2014 +0600 +++ b/LightmapBuilder.cpp Tue Feb 25 20:02:06 2014 +0600 @@ -65,10 +65,7 @@ memcpy(static_69B140 + i, a5 + i, sizeof(RenderVertexSoft)); //__debugbreak(); - if (pGame->pIndoorCameraD3D->_437376( - a3, - static_69B140, - &uNumVertices) == 1) + if (pGame->pIndoorCameraD3D->_437376(a3, static_69B140, &uNumVertices) == 1) { if ( !uNumVertices ) return false; @@ -81,11 +78,8 @@ static_69B110.field_4.y = a3->face_plane.vNormal.y; static_69B110.field_4.z = a3->face_plane.vNormal.z; static_69B110.dist = a3->face_plane.dist; - if (!pGame->pIndoorCameraD3D->GetFacetOrientation( - a3->polygonType, - &static_69B110.field_4, - &static_69B110.field_10, - &static_69B110.field_1C)) + if (!pGame->pIndoorCameraD3D->GetFacetOrientation(a3->polygonType, &static_69B110.field_4, + &static_69B110.field_10, &static_69B110.field_1C)) { MessageBoxW(nullptr, L"Error: Failed to get the facet orientation", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:119", 0); ExitProcess(0); @@ -104,16 +98,8 @@ if (!uColor) uColor = 0x00FFFFF; - if (!_45BE86_build_light_polygon( - &pos, - a2->_blv_lights_radii[i], - uColor, - a2->_blv_lights_light_dot_faces[i], - a2->_blv_lights_types[i], - &static_69B110, - uNumVertices, - a9, - uClipFlag) ) + if (!_45BE86_build_light_polygon(&pos, a2->_blv_lights_radii[i], uColor, a2->_blv_lights_light_dot_faces[i], + a2->_blv_lights_types[i], &static_69B110, uNumVertices, a9, uClipFlag) ) { MessageBoxW(nullptr, L"Error: Failed to build light polygon", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Light.cpp:138", 0); } @@ -466,76 +452,62 @@ //----- (0045C6D6) -------------------------------------------------------- int LightmapBuilder::_45C6D6(int a2, RenderVertexSoft *a3, Lightmap *pLightmap) { - Lightmap *v4; // edi@1 - signed int v5; // ebx@1 signed int v6; // esi@1 - RenderVertexSoft *v7; // ecx@2 - char *v8; // edx@4 double v9; // st7@6 double v10; // st6@10 double v11; // st5@14 double v12; // st7@17 - RenderVertexSoft *v13; // eax@21 int v15; // [sp+Ch] [bp-8h]@1 float v16; // [sp+10h] [bp-4h]@1 - int pLightmapa; // [sp+24h] [bp+10h]@3 - v4 = pLightmap; - v5 = 0; v6 = -1; v16 = 3.4028235e38; v15 = 0; if ( (signed int)pLightmap->uNumVertices > 0 ) { - v7 = pLightmap->pVertices; - do + for ( uint i = 0; i < (signed int)pLightmap->uNumVertices; ++i ) { - pLightmapa = 0; if ( a2 > 0 ) { - v8 = (char *)&a3->vWorldPosition.z; - do + for ( uint j = 0; j < a2; ++j ) { - if ( v7->vWorldPosition.x <= (double)*((float *)v8 - 2) ) - v9 = *((float *)v8 - 2) - v7->vWorldPosition.x; + if ( pLightmap->pVertices[i].vWorldPosition.x <= (double)a3[j].vWorldPosition.x ) + v9 = a3[j].vWorldPosition.x - pLightmap->pVertices[i].vWorldPosition.x; else - v9 = v7->vWorldPosition.x - *((float *)v8 - 2); + v9 = pLightmap->pVertices[i].vWorldPosition.x - a3[j].vWorldPosition.x; if ( v9 < 2.0 ) { - v10 = v7->vWorldPosition.y <= (double)*((float *)v8 - 1) ? *((float *)v8 - 1) - v7->vWorldPosition.y : v7->vWorldPosition.y - *((float *)v8 - 1); + v10 = pLightmap->pVertices[i].vWorldPosition.y <= (double)a3[j].vWorldPosition.y + ? a3[j].vWorldPosition.y - pLightmap->pVertices[i].vWorldPosition.y + : pLightmap->pVertices[i].vWorldPosition.y - a3[j].vWorldPosition.y; if ( v10 < 2.0 ) { - v11 = v7->vWorldPosition.z <= (double)*(float *)v8 ? *(float *)v8 - v7->vWorldPosition.z : v7->vWorldPosition.z - *(float *)v8; + v11 = pLightmap->pVertices[i].vWorldPosition.z <= (double)a3[j].vWorldPosition.z + ? a3[j].vWorldPosition.z - pLightmap->pVertices[i].vWorldPosition.z + : pLightmap->pVertices[i].vWorldPosition.z - a3[j].vWorldPosition.z; if ( v11 < 2.0 ) { v12 = v9 + v11 + v10; if ( v12 < v16 ) { v16 = v12; - v6 = pLightmapa; + v6 = j; } } } } - ++pLightmapa; - v8 += 48; } - while ( pLightmapa < a2 ); if ( v6 != -1 ) { - v13 = &a3[v6]; ++v15; - v7->vWorldPosition.x = v13->vWorldPosition.x; - v7->vWorldPosition.y = v13->vWorldPosition.y; - v7->vWorldPosition.z = v13->vWorldPosition.z; + pLightmap->pVertices[i].vWorldPosition.x = a3[v6].vWorldPosition.x; + pLightmap->pVertices[i].vWorldPosition.y = a3[v6].vWorldPosition.y; + pLightmap->pVertices[i].vWorldPosition.z = a3[v6].vWorldPosition.z; } } v6 = -1; - ++v5; - ++v7; v16 = 3.4028235e38; } - while ( v5 < (signed int)v4->uNumVertices ); } return v15; }