diff Render.cpp @ 2316:25f771e528f0

Draw terrain
author Ritor1
date Wed, 19 Mar 2014 17:30:14 +0600
parents 8193a64c7461
children 133882370e83
line wrap: on
line diff
--- a/Render.cpp	Wed Mar 19 10:09:42 2014 +0600
+++ b/Render.cpp	Wed Mar 19 17:30:14 2014 +0600
@@ -264,11 +264,56 @@
     }
   }
 //--------------------------------------------------------------------------------------------------------------------
-
-  //
-  for (unsigned int z = 0; z < 127; ++z)
-  {
-    for (unsigned int x = 0; x < 127; ++x)
+  int direction = pGame->pIndoorCameraD3D->sRotationY / 256;//direction of the camera(напрвление камеры), не могу округлить :(
+  //0-East(B)
+  //1-NorthEast(CB)
+  //2-North(C)
+  //3-WestNorth(CЗ)
+  //4-West(З)
+  //5-SouthWest(ЮЗ)
+  //6-South(Ю)
+  //7-SouthEast(ЮВ)
+  int Start_X, End_X, Start_Z, End_Z;
+  switch ( direction )
+  {
+    case 0://East(B)
+      Start_X = pODMRenderParams->uMapGridCellX, End_X = 127;
+      Start_Z = 0, End_Z = 127;
+      break;
+    case 1://NorthEast(CB)
+      Start_X = 0,/*pODMRenderParams->uMapGridCellX - 1,*/ End_X = 127;
+      Start_Z = 0, End_Z = pODMRenderParams->uMapGridCellZ;
+      break;
+    case 2://North(C)
+      Start_X = 0, End_X = 127;
+      Start_Z = 0, End_Z = pODMRenderParams->uMapGridCellZ;
+      break;
+    case 3://WestNorth(CЗ)
+      Start_X = 0, End_X = pODMRenderParams->uMapGridCellX + 1;
+      Start_Z = 0, End_Z = 127;//pODMRenderParams->uMapGridCellZ + 2;
+      break;
+    case 4://West(З)
+      Start_X = 0, End_X = pODMRenderParams->uMapGridCellX + 1;
+      Start_Z = 0, End_Z = 127;
+      break;
+    case 5://SouthWest(ЮЗ)
+      Start_X = 0, End_X = 127;//pODMRenderParams->uMapGridCellX + 2;
+      Start_Z = pODMRenderParams->uMapGridCellZ - 1, End_Z = 127;
+      break;
+    case 6://South(Ю)
+      Start_X = 0, End_X = 127;
+      Start_Z = pODMRenderParams->uMapGridCellZ - 1, End_Z = 127;
+      break;
+    case 7://SouthEast(ЮВ)
+      Start_X = pODMRenderParams->uMapGridCellX, End_X = 127;
+      Start_Z = 0,/*pODMRenderParams->uMapGridCellZ,*/ End_Z = 127;
+      break;
+    default:
+      __debugbreak();//Ritor1: error
+  }
+  for (unsigned int z = Start_Z; z < End_Z; ++z)
+  {
+    for (unsigned int x = Start_X; x < End_X; ++x)
     {
       pTilePolygon = &array_77EC08[pODMRenderParams->uNumPolygons];
       pTilePolygon->flags = 0;