diff LightmapBuilder.cpp @ 2316:25f771e528f0

Draw terrain
author Ritor1
date Wed, 19 Mar 2014 17:30:14 +0600
parents 90f56da08d76
children a59892f99d31
line wrap: on
line diff
--- a/LightmapBuilder.cpp	Wed Mar 19 10:09:42 2014 +0600
+++ b/LightmapBuilder.cpp	Wed Mar 19 17:30:14 2014 +0600
@@ -240,7 +240,7 @@
   if (!v11->uNumVertices)
     return true;
 
-  v45 = _45C6D6(uNumVertices, a9, v11);
+  v45 = _45C6D6(uNumVertices, a9, v11);//освещён ли фейс(есть ошибка)
   if ( v45 != uNumVertices && v45 > 0 )
     _45C4B9(uNumVertices, a9, v11);
   //v59 = v11->uNumVertices;
@@ -332,7 +332,7 @@
   double v17; // st6@24
   signed int v18; // edx@33
   int v20; // [sp+4h] [bp-1Ch]@3
-  int v21; // [sp+8h] [bp-18h]@8
+  //int v21; // [sp+8h] [bp-18h]@8
   float v22; // [sp+Ch] [bp-14h]@23
   float v23; // [sp+10h] [bp-10h]@20
   int v24; // [sp+14h] [bp-Ch]@1
@@ -340,6 +340,8 @@
   char v26; // [sp+1Eh] [bp-2h]@17
   char v27; // [sp+1Fh] [bp-1h]@17
 
+  __debugbreak();//Ritor1: needed cleaning
+
   v4 = pLightmap;
   v5 = 0;
   v6 = pLightmap->uNumVertices;
@@ -357,23 +359,20 @@
         || v7->vWorldPosition.y != v4->pVertices[v8].vWorldPosition.y
         || v7->vWorldPosition.z != v4->pVertices[v8].vWorldPosition.z )
       {
-        v10 = 0;
+        //v10 = 0;
         if ( a2 > 0 )
         {
-          v11 = (char *)&a3->vWorldPosition.z;
-          do
+          //v11 = (char *)&a3->vWorldPosition.z;
+          for ( v10 = 1; v10 <= a2; ++v10 )
           {
-            v21 = v10 + 1;
-            v12 = &a3[(v10 + 1) % a2];
-            if ( (*((float *)v11 - 2) != v12->vWorldPosition.x
-               || *((float *)v11 - 1) != v12->vWorldPosition.y
-               || *(float *)v11 != v12->vWorldPosition.z)
-              && v7->vWorldPosition.x == *((float *)v11 - 2)
-              && v7->vWorldPosition.y == *((float *)v11 - 1)
-              && v7->vWorldPosition.z == *(float *)v11
+            //v21 = v10 + 1;
+            v12 = &a3[v10 % a2];
+            if ((a3[v10].vWorldPosition.x != v12->vWorldPosition.x
+              || a3[v10].vWorldPosition.y != v12->vWorldPosition.y || a3[v10].vWorldPosition.z != v12->vWorldPosition.z)
+              && v7->vWorldPosition.x == a3[v10].vWorldPosition.x
+              && v7->vWorldPosition.y == a3[v10].vWorldPosition.y && v7->vWorldPosition.z == a3[v10].vWorldPosition.z
               && (v9->vWorldPosition.x != v12->vWorldPosition.x
-               || v9->vWorldPosition.y != v12->vWorldPosition.y
-               || v9->vWorldPosition.z != v12->vWorldPosition.z) )
+               || v9->vWorldPosition.y != v12->vWorldPosition.y || v9->vWorldPosition.z != v12->vWorldPosition.z) )
             {
               v13 = 0;
               v14 = 0;
@@ -384,11 +383,13 @@
               else
                 v15 = v9->vWorldPosition.x - v12->vWorldPosition.x;
               v23 = v15;
+
               if ( v9->vWorldPosition.y <= (double)v12->vWorldPosition.y )
                 v16 = v12->vWorldPosition.y - v9->vWorldPosition.y;
               else
                 v16 = v9->vWorldPosition.y - v12->vWorldPosition.y;
               v22 = v16;
+
               if ( v9->vWorldPosition.z <= (double)v12->vWorldPosition.z )
                 v17 = v12->vWorldPosition.z - v9->vWorldPosition.z;
               else
@@ -431,10 +432,10 @@
               }
               v7 = v25;
             }
-            ++v10;
-            v11 += 48;
+            //++v10;
+            //v11 += 48;
           }
-          while ( v21 < a2 );
+          //while ( v21 < a2 );
           v4 = pLightmap;
         }
       }
@@ -486,7 +487,7 @@
                   : pLightmap->pVertices[i].vWorldPosition.z - a3[j].vWorldPosition.z;
               if ( v11 < 2.0 )
               {
-                v12 = v9 + v11 + v10;
+                v12 = v9 + v11 + v10;//Ritor1: Ошибка: В ИДА сюда заходит в данже рядом с факелом, а у нас нет, причину не нашёл
                 if ( v12 < v16 )
                 {
                   v16 = v12;
@@ -611,15 +612,17 @@
   int a5; // [sp+2Ch] [bp-1Ch]@1
   float v19; // [sp+30h] [bp-18h]@1
   float v20; // [sp+34h] [bp-14h]@1
-  LightmapBuilder *thisa; // [sp+38h] [bp-10h]@1
+  //LightmapBuilder *thisa; // [sp+38h] [bp-10h]@1
   int v22; // [sp+3Ch] [bp-Ch]@1
   int *j; // [sp+40h] [bp-8h]@3
   int i; // [sp+44h] [bp-4h]@1
   int a3a; // [sp+58h] [bp+10h]@2
 
+  __debugbreak();//Ritor1: needed cleaning
+
   *(float *)&a5 = 0.0;
   v19 = 0.0;
-  thisa = this;
+  //thisa = this;
   v20 = 0.0;
   result = _45CBD4(a3, a4, dword_69B010.data(), &v22);
   for ( i = 0; i < v22; result = i )