Skip to content

Commit

Permalink
add option tileset_version + updating dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
bertt committed Oct 15, 2024
1 parent 8b14560 commit c7e92d9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ Tool parameters:
--use_i3dm (optional - default false) Use I3dm format - only first model will be processed (false creates Cmpt)
--boundingvolume_heights (option - default: 0,10) - Tile boundingVolume heights (min, max) in meters. The heights will be added to the z_min and z_max values of the input geometries.
--tileset_version (optional - default "") - Tileset version
```

# Docker

See https://hub.docker.com/r/geodan/i3dm.export
Expand Down
4 changes: 4 additions & 0 deletions src/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public class Options

[Option("boundingvolume_heights", Required = false, Default = "0,10", HelpText = "Tile boundingVolume heights (min, max) in meters")]
public string BoundingVolumeHeights { get; set; }

[Option("tileset_version", Required = false, Default = "", HelpText = "Tileset version")]
public string TilesetVersion { get; set; }

}


Expand Down
7 changes: 6 additions & 1 deletion src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ static void Main(string[] args)
SqlMapper.AddTypeHandler(new JArrayTypeHandler());

var version = Assembly.GetExecutingAssembly().GetName().Version;
var tilesetVersion = o.TilesetVersion;

var stopWatch = new Stopwatch();
stopWatch.Start();

Console.WriteLine("Tool: I3dm.export");
Console.WriteLine("Version: " + version);
if (!tilesetVersion.Equals(string.Empty))
{
Console.WriteLine($"Tileset version: {tilesetVersion}");
}
Console.WriteLine($"Exporting instances from {o.Table}...");
Console.WriteLine($"Use GPU instancing: {o.UseGpuInstancing}");

Expand Down Expand Up @@ -133,7 +138,7 @@ static void Main(string[] args)
var subtreeLevels = subtreeFiles.Count > 1 ? ((Tile)subtreeFiles.ElementAt(1).Key).Z : 2;
var availableLevels = tiles.Max(t => t.Z) + 1;

var tilesetjson = TreeSerializer.ToImplicitTileset(rootBoundingVolumeRegion, o.GeometricError, availableLevels, subtreeLevels, version, (bool)o.UseGpuInstancing, (bool)o.UseI3dm);
var tilesetjson = TreeSerializer.ToImplicitTileset(rootBoundingVolumeRegion, o.GeometricError, availableLevels, subtreeLevels, version, (bool)o.UseGpuInstancing, (bool)o.UseI3dm, tilesetVersion);
var file = $"{o.Output}{Path.AltDirectorySeparatorChar}tileset.json";
Console.WriteLine($"Subtree files written: {subtreeFiles.Count}");
Console.WriteLine("SubtreeLevels: " + subtreeLevels);
Expand Down
4 changes: 3 additions & 1 deletion src/Tileset/TilesetClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace i3dm.export.Tileset;

public class TileSet
{
public Asset asset { get; set; }
public double geometricError { get; set; }
public Root root { get; set; }
public Asset asset { get; set; }
}

public class Child : ICloneable
Expand Down Expand Up @@ -76,4 +76,6 @@ public class Asset
public string generator { get; set; }

public string version { get; set; }

public string tilesetVersion { get; set; }
}
6 changes: 5 additions & 1 deletion src/TreeSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ namespace i3dm.export;

public static class TreeSerializer
{
public static string ToImplicitTileset(double[] box, double geometricError, int availableLevels, int subtreeLevels, Version version, bool useGpuInstancing = false, bool useI3dm = false)
public static string ToImplicitTileset(double[] box, double geometricError, int availableLevels, int subtreeLevels, Version version, bool useGpuInstancing = false, bool useI3dm = false, string tilesetVersion = "")
{
var tileset = new TileSet
{
asset = new Asset() { version = "1.1", generator = $"i3dm.export {version}" },
geometricError = geometricError
};
if (!tilesetVersion.Equals(string.Empty))
{
tileset.asset.tilesetVersion = tilesetVersion;
}
var root = GetRoot(geometricError, box, "ADD");
var extension = useGpuInstancing ? "glb" : "cmpt";
if(useI3dm)
Expand Down

0 comments on commit c7e92d9

Please sign in to comment.