/*public void ClearTerrain(Blocks MyBlocks) { for (int i = 0; i < MyBlocks.Size.x; i++) for (int j = 0; j < MyBlocks.Size.y; j++) for (int k = 0; k < MyBlocks.Size.z; k++) { MyBlocks.ClearBlockMesh(new Vector3(i,j,k)); } }*/ public void GenerateAllMeshes(MyMesh MeshData, Blocks MyBlocks) { //CreateSunlight (); MeshData.ClearMesh (); if (!IsSmoothTerrain) { // Just want to update any blocks that were changed and its surrounding ones // MyBlocks class keeps the mesh data stored in memory rather then remaking the meshes every time if (IsSubDivided) { //CreateMeshFromBlocksSubdivision (DefaultSubDivisionLevel); } else { CreateMeshFromBlocks (MyBlocks, MeshData); } for (int i = 0; i < MyBlocks.Size.x; i++) for (int j = 0; j < MyBlocks.Size.y; j++) for (int k = 0; k < MyBlocks.Size.z; k++) { if (MyBlocks.GetBlockType(new Vector3(i,j,k)) != 0) { MeshData.Add (MyBlocks.GetBlock(new Vector3(i,j,k)).GetBlockMesh()); } } CanUpdateMesh = true; } else { //CreateSmoothTerrain (); //UpdateMesh (); } }