Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
seperate logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sambaas committed Apr 10, 2024
1 parent eae0c37 commit d55beab
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
5 changes: 3 additions & 2 deletions TileBakeLibrary/CityJSONParsing/CityJSON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ private Surface ReadSurfaceVectors(JSONNode surfacenode, CityObject sourceCityOb
surf.innerRings.Add(verts);
}
else{
sourceCityObject.warnings += "- Holes in surface detected, but not supported. Ignoring holes.\n";
sourceCityObject.holeWarnings += "- Found a hole with less than 3 vertices, skipping this hole.\n";
}
}

Expand Down Expand Up @@ -432,7 +432,8 @@ public class CityObject
public string cityObjectType;
public string keyName = "";

public string warnings = "";
public string holeWarnings = "";
public string triangulationWarnings = "";

public CityObject()
{
Expand Down
10 changes: 6 additions & 4 deletions TileBakeLibrary/CityJSONToTileConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,10 +478,12 @@ private List<SubObject> CityJSONParseProcess(CityJSON cityJson, ConcurrentBag<st
CityObject cityObject = cityJson.LoadCityObjectByIndex(i, lod);
var subObject = ToSubObjectMeshData(cityObject);
if(!string.IsNullOrEmpty(cityObject.warnings))
{
warnings.Add(cityObject.keyName + ":\n" + cityObject.warnings);
}
//Collect warnings for log
if(!string.IsNullOrEmpty(cityObject.holeWarnings))
warnings.Add(cityObject.keyName + ":\n" + cityObject.holeWarnings);
if(!string.IsNullOrEmpty(cityObject.triangulationWarnings))
warnings.Add(cityObject.keyName + ":\n" + cityObject.holeWarnings);
cityObject = null;
Interlocked.Decrement(ref parsing);
Expand Down
18 changes: 8 additions & 10 deletions TileBakeLibrary/SubObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public void MergeSimilarVertices()
Vector2 uv = new Vector2(0,0);
int oldIndex = 0;
int newIndex = 0;


Dictionary<VertexNormalCombination,int> vertexNormalCombinations = new Dictionary<VertexNormalCombination,int>();
for (int i = 0; i < triangleIndices.Count; i++)
Expand Down Expand Up @@ -236,19 +235,18 @@ public List<SubObject> ClipSubobject(Vector2 size)
}
else
{
for (int y = localYmin; y < localYmax; y += (int)size.Y)
{
SubObject newSubobject = ClipMesh(columnMesh, x, y,size.Y);
if (newSubobject != null)
{
for (int y = localYmin; y < localYmax; y += (int)size.Y)
{
SubObject newSubobject = ClipMesh(columnMesh, x, y,size.Y);
if (newSubobject != null)
{

subObjects.Add(newSubobject);
}
}
subObjects.Add(newSubobject);
}
}
}
}


return subObjects;
}

Expand Down
2 changes: 1 addition & 1 deletion TileBakeLibrary/Triangulation/Poly2Mesh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ public static void CreateMeshData(Polygon polygon, out Vector3[] vertices, out V
{
Console.WriteLine("Failed to triangulate polygon: " + e.Message);
Console.WriteLine("With name: " + cityObject.keyName);
cityObject.warnings += "- Failed to triangulate polygon: " + e.Message + "\n";
cityObject.triangulationWarnings += "- Failed to triangulate polygon: " + e.Message + "\n";
return;
}
// Now, to get back to our original positions, use our code-to-position map. We do
Expand Down

0 comments on commit d55beab

Please sign in to comment.