Compare commits
No commits in common. "261d5fe399bf0c52458a1e36f38df06edde183ad" and "e213b3ea262d9950dd6636d5597ea11fe639c645" have entirely different histories.
261d5fe399
...
e213b3ea26
|
@ -221,11 +221,7 @@ public partial class Mission : Node3D
|
|||
}
|
||||
}
|
||||
|
||||
var lightmapTexture = Timing.TimeStage("Build Lightmap", () =>
|
||||
{
|
||||
return BuildLightmapTexture(cells, packingRects.ToArray(), rectDataMap, surfaceDataMap);
|
||||
});
|
||||
|
||||
var lightmapTexture = BuildLightmapTexture(cells, packingRects.ToArray(), rectDataMap, surfaceDataMap);
|
||||
foreach (var (textureId, surface) in surfaceDataMap)
|
||||
{
|
||||
if (surface.Empty)
|
||||
|
@ -277,12 +273,7 @@ public partial class Mission : Node3D
|
|||
|
||||
private static Texture BuildLightmapTexture(WorldRep.Cell[] cells, PackingRectangle[] packingRects, Dictionary<int, LightmapRectData> rectDataMap, Dictionary<int, MeshSurfaceData> surfaceDataMap)
|
||||
{
|
||||
var bounds = Timing.TimeStage("RectPack", () =>
|
||||
{
|
||||
RectanglePacker.Pack(packingRects, out var bounds, PackingHints.FindBest, 0);
|
||||
return bounds;
|
||||
});
|
||||
GD.Print($"Creating lightmap with bounds: ({bounds.Width}, {bounds.Height})");
|
||||
RectanglePacker.Pack(packingRects, out var bounds);
|
||||
var image = Image.CreateEmpty((int)bounds.Width, (int)bounds.Height, false, Image.Format.Rgba8);
|
||||
foreach (var rect in packingRects)
|
||||
{
|
||||
|
|
|
@ -12,13 +12,4 @@ public static class Timing
|
|||
watch.Stop();
|
||||
Godot.GD.Print($"[{stagename}]: {watch.Elapsed:g}");
|
||||
}
|
||||
|
||||
public static T TimeStage<T>(string stagename, Func<T> action)
|
||||
{
|
||||
var watch = Stopwatch.StartNew();
|
||||
var value = action();
|
||||
watch.Stop();
|
||||
Godot.GD.Print($"[{stagename}]: {watch.Elapsed:g}");
|
||||
return value;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue