Compare commits
	
		
			No commits in common. "2ecf17400ea8d1afea9a875d53f263517fa2d3a3" and "b8c16a1ffccf62d57d305a60cc494626bd5c57ef" have entirely different histories.
		
	
	
		
			2ecf17400e
			...
			b8c16a1ffc
		
	
		| 
						 | 
					@ -1,5 +1,3 @@
 | 
				
			||||||
using Serilog;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace KeepersCompound.LGS.Database.Chunks;
 | 
					namespace KeepersCompound.LGS.Database.Chunks;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public record LinkId
 | 
					public record LinkId
 | 
				
			||||||
| 
						 | 
					@ -98,7 +96,7 @@ public class LinkChunk : IChunk, IMergable
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if (links.Count != count)
 | 
					        if (links.Count != count)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Log.Information("Trimming excess Links in GAM: {StartCount} -> {EndCount}", count, links.Count);
 | 
					            Console.WriteLine($"Trimmed links: {count} -> {links.Count}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        links.AddRange(((LinkChunk)other).links);
 | 
					        links.AddRange(((LinkChunk)other).links);
 | 
				
			||||||
| 
						 | 
					@ -164,7 +162,7 @@ public class LinkDataMetaProp : IChunk, IMergable
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (linkData.Count != count)
 | 
					        if (linkData.Count != count)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Log.Information("Trimming excess LinkData in GAM: {StartCount} -> {EndCount}", count, linkData.Count);
 | 
					            Console.WriteLine($"Trimmed link data: {count} -> {linkData.Count}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        linkData.AddRange(((LinkDataMetaProp)other).linkData);
 | 
					        linkData.AddRange(((LinkDataMetaProp)other).linkData);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,8 +7,4 @@
 | 
				
			||||||
    <Nullable>enable</Nullable>
 | 
					    <Nullable>enable</Nullable>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					 | 
				
			||||||
    <PackageReference Include="Serilog" Version="4.2.0" />
 | 
					 | 
				
			||||||
  </ItemGroup>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
</Project>
 | 
					</Project>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,9 +14,6 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <PackageReference Include="DotMake.CommandLine" Version="1.8.8" />
 | 
					    <PackageReference Include="DotMake.CommandLine" Version="1.8.8" />
 | 
				
			||||||
    <PackageReference Include="Serilog" Version="4.2.0" />
 | 
					 | 
				
			||||||
    <PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
 | 
					 | 
				
			||||||
    <PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
 | 
					 | 
				
			||||||
    <PackageReference Include="TinyEmbree" Version="1.0.3" />
 | 
					    <PackageReference Include="TinyEmbree" Version="1.0.3" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,6 @@ using System.Numerics;
 | 
				
			||||||
using KeepersCompound.LGS;
 | 
					using KeepersCompound.LGS;
 | 
				
			||||||
using KeepersCompound.LGS.Database;
 | 
					using KeepersCompound.LGS.Database;
 | 
				
			||||||
using KeepersCompound.LGS.Database.Chunks;
 | 
					using KeepersCompound.LGS.Database.Chunks;
 | 
				
			||||||
using Serilog;
 | 
					 | 
				
			||||||
using TinyEmbree;
 | 
					using TinyEmbree;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace KeepersCompound.Lightmapper;
 | 
					namespace KeepersCompound.Lightmapper;
 | 
				
			||||||
| 
						 | 
					@ -192,28 +191,10 @@ public class LightMapper
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        var infinite = 0;
 | 
					        var infinite = _lights.Count(light => light.Radius == float.MaxValue);
 | 
				
			||||||
        foreach (var light in _lights)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if (light.Radius != float.MaxValue)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                continue;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (light.ObjId != -1)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                Log.Warning("Infinite light from object {Id}", light.ObjId);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                Log.Warning("Infinite light from brush near {Position}", light.Position);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            infinite++;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        if (infinite > 0)
 | 
					        if (infinite > 0)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Log.Warning("Mission contains {Count} infinite lights", infinite);
 | 
					            Console.WriteLine($"WARNING: Infinite radius lights found: {infinite}/{_lights.Count}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					@ -240,7 +221,6 @@ public class LightMapper
 | 
				
			||||||
            R2 = float.MaxValue,
 | 
					            R2 = float.MaxValue,
 | 
				
			||||||
            LightTableIndex = lightTable.LightCount,
 | 
					            LightTableIndex = lightTable.LightCount,
 | 
				
			||||||
            SpotlightInnerAngle = -1f,
 | 
					            SpotlightInnerAngle = -1f,
 | 
				
			||||||
            ObjId = -1,
 | 
					 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        _lights.Add(light);
 | 
					        _lights.Add(light);
 | 
				
			||||||
| 
						 | 
					@ -503,7 +483,7 @@ public class LightMapper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (cell.LightIndexCount > 97)
 | 
					            if (cell.LightIndexCount > 97)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Log.Warning("Cell {Id} sees too many lights ({Count})", i, cell.LightIndices[0]);
 | 
					                // Console.WriteLine($"WARNING: Too many lights in cell at ({cell.SphereCenter}): {cell.LightIndexCount - 1} / 96");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -525,10 +505,10 @@ public class LightMapper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (overLit > 0)
 | 
					            if (overLit > 0)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                Log.Warning("{Count}/{CellCount} cells are overlit. Overlit cells can cause Object/Light Gem lighting issues.", overLit, worldRep.Cells.Length);
 | 
					                Console.WriteLine($"WARNING: Overlit cells detected: {overLit}/{worldRep.Cells.Length}");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Log.Information("Max cell lights found ({Count}/96)", maxLights);
 | 
					            Console.WriteLine($"MaxLights: {maxLights} / 96");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,31 +1,11 @@
 | 
				
			||||||
using DotMake.CommandLine;
 | 
					using DotMake.CommandLine;
 | 
				
			||||||
using Serilog;
 | 
					 | 
				
			||||||
using Serilog.Sinks.SystemConsole.Themes;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace KeepersCompound.Lightmapper;
 | 
					namespace KeepersCompound.Lightmapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
internal static class Program
 | 
					internal static class Program
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private static void ConfigureLogger()
 | 
					    public static async Task<int> Main(string[] args) =>
 | 
				
			||||||
    {
 | 
					        await Cli.RunAsync<LightCommand>(args);
 | 
				
			||||||
        const string outputTemplate = "{Timestamp:HH:mm:ss.fff} [{Level}] {Message:lj}{NewLine}{Exception}";
 | 
					 | 
				
			||||||
        var logPath = $"{AppDomain.CurrentDomain.BaseDirectory}/logs/{DateTime.Now:yyyyMMdd_HHmmss}.log";
 | 
					 | 
				
			||||||
        var config = new LoggerConfiguration();
 | 
					 | 
				
			||||||
#if DEBUG
 | 
					 | 
				
			||||||
        config.MinimumLevel.Debug();
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        Log.Logger = config
 | 
					 | 
				
			||||||
            .WriteTo.Console(theme: AnsiConsoleTheme.Sixteen, outputTemplate: outputTemplate)
 | 
					 | 
				
			||||||
            .WriteTo.File(logPath, outputTemplate: outputTemplate)
 | 
					 | 
				
			||||||
            .CreateLogger();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    public static async Task<int> Main(string[] args)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        ConfigureLogger();
 | 
					 | 
				
			||||||
        return await Cli.RunAsync<LightCommand>(args);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[CliCommand(Description = "Compute lightmaps for a NewDark .MIS/.COW")]
 | 
					[CliCommand(Description = "Compute lightmaps for a NewDark .MIS/.COW")]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
using System.Diagnostics;
 | 
					using System.Diagnostics;
 | 
				
			||||||
using Serilog;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace KeepersCompound.Lightmapper;
 | 
					namespace KeepersCompound.Lightmapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +32,7 @@ public static class Timing
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        foreach (var (stagename, time) in _stages)
 | 
					        foreach (var (stagename, time) in _stages)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            Log.Information("Timing {StageName}: {Time:g}", stagename, time);
 | 
					            Console.WriteLine($"[{stagename}]: {time:g}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue