Profile the rectpacking
This commit is contained in:
parent
20a0796410
commit
42cc08363e
|
@ -277,7 +277,12 @@ public partial class Mission : Node3D
|
||||||
|
|
||||||
private static Texture BuildLightmapTexture(WorldRep.Cell[] cells, PackingRectangle[] packingRects, Dictionary<int, LightmapRectData> rectDataMap, Dictionary<int, MeshSurfaceData> surfaceDataMap)
|
private static Texture BuildLightmapTexture(WorldRep.Cell[] cells, PackingRectangle[] packingRects, Dictionary<int, LightmapRectData> rectDataMap, Dictionary<int, MeshSurfaceData> surfaceDataMap)
|
||||||
{
|
{
|
||||||
RectanglePacker.Pack(packingRects, out var bounds);
|
var bounds = Timing.TimeStage("RectPack", () =>
|
||||||
|
{
|
||||||
|
RectanglePacker.Pack(packingRects, out var bounds);
|
||||||
|
return bounds;
|
||||||
|
});
|
||||||
|
GD.Print($"Creating lightmap with bounds: ({bounds.Width}, {bounds.Height})");
|
||||||
var image = Image.CreateEmpty((int)bounds.Width, (int)bounds.Height, false, Image.Format.Rgba8);
|
var image = Image.CreateEmpty((int)bounds.Width, (int)bounds.Height, false, Image.Format.Rgba8);
|
||||||
foreach (var rect in packingRects)
|
foreach (var rect in packingRects)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue