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
Loads a cityjson (*.json or *.city.json) file and provides acces to its
vertices, appearance.
vertices, appearance, materials, etc.
### No dependencies to Unity!
- This can se used in any C# project.
......@@ -21,6 +21,22 @@ cj.Materials
// Vertices
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:
......
......@@ -19,7 +19,23 @@ cj.Geometries
cj.Materials
// 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
List<int> geometryIndices = new List<int>();
// Output
string path;
string title;
string crs;
string referenceDate;
......@@ -76,6 +75,7 @@ namespace Wander
Dictionary<string, int> errors = new Dictionary<string, int>();
// Output properties
public string Title => title;
public Dictionary<string, long> Timings => timings;
public Dictionary<string, int> Errors => errors;
public List<(long x, long y, long z)> Vertices => vertices;
......
{
"name": "com.wurwander.cityjson",
"version": "1.0.0",
"version": "1.0.1",
"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'",
"unity": "2021.3",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment