diff stru10.cpp @ 1319:2ddb0af0f437

m
author Ritor1
date Fri, 28 Jun 2013 11:34:09 +0600
parents 66c625fd1113
children a109bb203e28
line wrap: on
line diff
--- a/stru10.cpp	Wed Jun 26 14:22:02 2013 +0600
+++ b/stru10.cpp	Fri Jun 28 11:34:09 2013 +0600
@@ -184,35 +184,29 @@
     }
   }
 
-
+  RenderVertexSoft v1; // [sp+30Ch] [bp-54h]@24
+  v1.vWorldPosition.x = (float)pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]].x;
+  v1.vWorldPosition.y = (float)pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]].y;
+  v1.vWorldPosition.z = (float)pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]].z;
+  memcpy(&pOutVertices[0], &v1, sizeof(RenderVertexSoft));
 
-  auto p1 = &pIndoor->pVertices[pFace->pVertexIDs[x_min_idx]];
-  RenderVertexSoft v1; // [sp+30Ch] [bp-54h]@24
-  v1.vWorldPosition.x = (float)p1->x;
-  v1.vWorldPosition.y = (float)p1->y;
-  v1.vWorldPosition.z = (float)p1->z;
-  memcpy(pOutVertices + 0, &v1, sizeof(RenderVertexSoft));
-
-  auto p2 = &pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]];
   RenderVertexSoft v2; // [sp+30Ch] [bp-54h]@24
-  v2.vWorldPosition.x = (float)p2->x;
-  v2.vWorldPosition.y = (float)p2->y;
-  v2.vWorldPosition.z = (float)p2->z;
-  memcpy(pOutVertices + 1, &v2, sizeof(RenderVertexSoft));
+  v2.vWorldPosition.x = (float)pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]].x;
+  v2.vWorldPosition.y = (float)pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]].y;
+  v2.vWorldPosition.z = (float)pIndoor->pVertices[pFace->pVertexIDs[y_min_idx]].z;
+  memcpy(&pOutVertices[1], &v2, sizeof(RenderVertexSoft));
 
-  auto p3 = &pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]];
   RenderVertexSoft v3; // [sp+30Ch] [bp-54h]@24
-  v3.vWorldPosition.x = (float)p3->x;
-  v3.vWorldPosition.y = (float)p3->y;
-  v3.vWorldPosition.z = (float)p3->z;
-  memcpy(pOutVertices + 2, &v3, sizeof(RenderVertexSoft));
+  v3.vWorldPosition.x = (float)pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]].x;
+  v3.vWorldPosition.y = (float)pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]].y;
+  v3.vWorldPosition.z = (float)pIndoor->pVertices[pFace->pVertexIDs[x_max_idx]].z;
+  memcpy(&pOutVertices[2], &v3, sizeof(RenderVertexSoft));
 
-  auto p4 = &pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]];
   RenderVertexSoft v4; // [sp+30Ch] [bp-54h]@24
-  v4.vWorldPosition.x = (double)p4->x;
-  v4.vWorldPosition.y = (double)p4->y;
-  v4.vWorldPosition.z = (double)p4->z;
-  memcpy(pOutVertices + 3, &v4, sizeof(RenderVertexSoft));
+  v4.vWorldPosition.x = (double)pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]].x;
+  v4.vWorldPosition.y = (double)pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]].y;
+  v4.vWorldPosition.z = (double)pIndoor->pVertices[pFace->pVertexIDs[y_max_idx]].z;
+  memcpy(&pOutVertices[3], &v4, sizeof(RenderVertexSoft));
 }
 
 
@@ -259,7 +253,7 @@
   switch (pFace->uPolygonType)
   {
     case POLYGON_VerticalWall:
-      a1.x = -pFace->pFacePlane.vNormal.y;
+      a1.x = -pFace->pFacePlane.vNormal.y;// направление полигона
       a1.y = pFace->pFacePlane.vNormal.x;
       a1.z = 0.0f;
       a1.Normalize();
@@ -300,12 +294,12 @@
   }
   if (pFace->uAttributes & 0x0200)
   {
-    face_center_x = (pFaceLimits[0].vWorldPosition.x + pFaceLimits[2].vWorldPosition.x) / 2;
+    face_center_x = (pFaceLimits[0].vWorldPosition.x + pFaceLimits[2].vWorldPosition.x) / 2;// центр полигона
     face_center_y = (pFaceLimits[0].vWorldPosition.y + pFaceLimits[2].vWorldPosition.y) / 2;
     face_center_z = (pFaceLimits[1].vWorldPosition.z + pFaceLimits[3].vWorldPosition.z) / 2;
 
-    a3 = face_center_x - pFaceLimits[0].vWorldPosition.x;
-    var_8 = face_center_z - pFaceLimits[1].vWorldPosition.z;
+    a3 = face_center_x - pFaceLimits[0].vWorldPosition.x;//от центра до верхнего края
+    var_8 = face_center_z - pFaceLimits[1].vWorldPosition.z;// высота от центра
 
     if (pFace->uPolygonType == POLYGON_VerticalWall)
       a3 /= a1.x;
@@ -771,7 +765,7 @@
 {
   RenderVertexSoft pLimits[4]; // [sp+Ch] [bp-C0h]@1
 
-  CalcPolygonLimits(pFace, pLimits);
+  CalcPolygonLimits(pFace, pLimits);//определение границ портала
   //if ( byte_4D864C && pGame->uFlags & GAME_FLAGS_1_DRAW_BLV_DEBUGS)
  //   pGame->pIndoorCameraD3D->debug_outline_sw(pLimits, 4, 0xFF1E1E, 0.000099999997);
   if (CalcFaceBounding(pFace, pLimits, 4, pOutBounding))