Skip to content
Snippets Groups Projects
Commit 0e2ea12d authored by Knuiman, Bart's avatar Knuiman, Bart
Browse files

readme update

parent 3704f5f5
No related branches found
No related tags found
No related merge requests found
## CityJson ## CityJson
Loads a cityjson (*.json or *.city.json) file and provides acces to its Loads a cityjson (*.json or *.city.json) file and provides acces to its
vertices, appearance. vertices, appearance, materials, etc.
### No dependencies to Unity! ### No dependencies to Unity!
- This can se used in any C# project. - This can se used in any C# project.
...@@ -21,6 +21,22 @@ cj.Materials ...@@ -21,6 +21,22 @@ cj.Materials
// Vertices // Vertices
var unityVertices = cj.Vertices.Select( v => new Vector3(v.x, v.z, v.y) ).ToArray(); var unityVertices = cj.Vertices.Select( v => new Vector3(v.x, v.z, v.y) ).ToArray();
for (int i=0; i<cj.CityObjects.Count;i++ )
{
var geom = cj.CityObjects[i].geometry;
Mesh m = new Mesh();
m.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
m.subMeshCount = geom.indices.Count;
m.SetVertices( unityVertices );
for ( int j=0; j<geom.indices.Count; j++)
{
m.SetTriangles( geom.indices[j], j );
}
m.RecalculateNormals();
m.Optimize();
m.UploadMeshData( true );
}
``` ```
### Important: ### Important:
......
...@@ -19,7 +19,23 @@ cj.Geometries ...@@ -19,7 +19,23 @@ cj.Geometries
cj.Materials cj.Materials
// Vertices // Vertices
var unityVertices = cj.Vertices.Select( v => new Vector3(v.x, v.z, v.y) ).ToArra var unityVertices = cj.Vertices.Select( v => new Vector3(v.x, v.z, v.y) ).ToArray();
for (int i=0; i<cj.CityObjects.Count;i++ )
{
var geom = cj.CityObjects[i].geometry;
Mesh m = new Mesh();
m.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
m.subMeshCount = geom.indices.Count;
m.SetVertices( unityVertices );
for ( int j=0; j<geom.indices.Count; j++)
{
m.SetTriangles( geom.indices[j], j );
}
m.RecalculateNormals();
m.Optimize();
m.UploadMeshData( true );
}
``` ```
......
...@@ -61,7 +61,6 @@ namespace Wander ...@@ -61,7 +61,6 @@ namespace Wander
List<int> geometryIndices = new List<int>(); List<int> geometryIndices = new List<int>();
// Output // Output
string path;
string title; string title;
string crs; string crs;
string referenceDate; string referenceDate;
...@@ -76,6 +75,7 @@ namespace Wander ...@@ -76,6 +75,7 @@ namespace Wander
Dictionary<string, int> errors = new Dictionary<string, int>(); Dictionary<string, int> errors = new Dictionary<string, int>();
// Output properties // Output properties
public string Title => title;
public Dictionary<string, long> Timings => timings; public Dictionary<string, long> Timings => timings;
public Dictionary<string, int> Errors => errors; public Dictionary<string, int> Errors => errors;
public List<(long x, long y, long z)> Vertices => vertices; public List<(long x, long y, long z)> Vertices => vertices;
......
{ {
"name": "com.wurwander.cityjson", "name": "com.wurwander.cityjson",
"version": "1.0.0", "version": "1.0.1",
"displayName": "CityJson", "displayName": "CityJson",
"description": "Provides a way to load CityJson and generate geometries with materials for direct engine use (Unity, Unreal). No dependencies to Unity or Unreal. Only 'System'", "description": "Provides a way to load CityJson and generate geometries with materials for direct engine use (Unity, Unreal). No dependencies to Unity or Unreal. Only 'System'",
"unity": "2021.3", "unity": "2021.3",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment