//Initialize the Lot Steps values... for scanTerra() will not change the nextStart here. //For loading mesh vertices from file we change the Vector3 nextStart for 1st only time here public void InitializeLotStepVal( ref Vector3 nextStart, SubDivider subDivide, List <Vector3> wholeMalla, Vector3[] Vertices, ref float lotStepX, ref float lotStepZ, int inPolyDiv = 0, int polyX = 0, int polyZ = 0) { if (nextStart == wholeMalla[0] && polyX != 0) { subDivide.SubDivideLot(ref nextStart, polyX, polyZ, StepX, StepZ, inPolyDiv, Vertices); } if (lotStepZ == 0) { lotStepZ = wholeMalla[0].z - nextStart.z; lotStepX = wholeMalla[0].x - nextStart.x; //print(lotStepZ + "lotStepZ." + lotStepX + "lotStepX"); //print(wholeMalla[0] + "wholeMalla." + nextStart + "nextStart"); } }
/// <summary> /// Scan all the terrain and will return the lot vertexs.. will do the sequence /// too to scan all the terrain /// </summary> /// <param name="inPolyDiv">how many div ex 5x5 a real poly will have</param> /// <returns>List Vector3 with a Lot full of fake vertices</returns> List <Vector3> ScanTerraRetLotVertex(int inPolyDiv /*ex 5x5 inside the polygon*/, int polyX, int polyZ) { isTerraScanning = true; List <Vector3> lot = new List <Vector3>(); if (nextStart.x < wholeMalla[1].x) { if (lotStepX == 0) { iniTerr.InitializeLotStepVal(ref nextStart, subDivide, wholeMalla, Vertices, ref lotStepX, ref lotStepZ); } if (nextStart != wholeMalla[0]) { print("nextStart != wholeMalla[0]"); nextStart.z = zLot; } lotStart = nextStart;//nextstart get updated once goes into tht method lot = subDivide.SubDivideLot(ref nextStart, polyX, polyZ, iniTerr.StepX, iniTerr.StepZ, inPolyDiv, Vertices); lotEnd = nextStart; Malla.XLotColumns++; } if (nextStart.x >= wholeMalla[1].x) { Malla.IsXLotColumnsLocked = true; zLot = zLot - lotStepZ; nextStart.x = wholeMalla[0].x; Malla.ZLotRows++; } if (nextStart.z - 0.1f <= wholeMalla[3].z) { lastRowCounter++; if (lastRowCounter == Malla.XLotColumns) { isTerraScanning = false; IsLoading = false; Malla.IsZLotRowsLocked = true; } } return(lot); }