Add light objects to the light list

This commit is contained in:
Jarrod Doyle 2024-09-22 13:18:32 +01:00
parent e6d3489b11
commit 7c786a5f4c
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 24 additions and 2 deletions

View File

@ -38,9 +38,29 @@ class Program
radius = float.MaxValue radius = float.MaxValue
}); });
} }
} else if (brush.media == BrList.Brush.Media.Object)
{
var id = (int)brush.brushInfo;
var light = hierarchy.GetProperty<PropLight>(id, "P$Light");
var lightColor = hierarchy.GetProperty<PropLightColor>(id, "P$LightColo");
// TODO: object lights if (light != null)
{
lightColor ??= new PropLightColor { Hue = 0, Saturation = 0 };
lights.Add(new Light
{
position = brush.position,
color = HsbToRgb(lightColor.Hue, lightColor.Saturation, light.Brightness),
radius = light.Brightness,
});
}
else
{
Console.WriteLine($"no light prop apparently");
}
}
}
} }
// Build embree mesh // Build embree mesh
@ -60,6 +80,8 @@ class Program
var dir = Path.GetDirectoryName(misPath); var dir = Path.GetDirectoryName(misPath);
var filename = Path.GetFileNameWithoutExtension(misPath); var filename = Path.GetFileNameWithoutExtension(misPath);
mis.Save(Path.Join(dir, $"{filename}-lit.cow")); mis.Save(Path.Join(dir, $"{filename}-lit.cow"));
Console.WriteLine($"Lit {lights.Count} light");
} }
// Expects Hue to be 0-360, saturation 0-1, brightness 0-255 // Expects Hue to be 0-360, saturation 0-1, brightness 0-255