This commit is contained in:
JohnCorby 2023-04-24 18:28:54 -07:00
parent f57ca63f71
commit a44cea387d

View File

@ -29,14 +29,18 @@ namespace NewHorizons.Builder.General
var innerRadius = config.innerRadius ?? surfaceSize;
innerRadius = Mathf.Sqrt(innerRadius / light.range);
var shell = config.isShell ? 1f : 0f;
light.color = new Color(innerRadius, shell, 1f, 0.0225f/*from timber hearth*/);
light.color = new Color(innerRadius, shell, 1f, 0.0225f /*from timber hearth*/);
if (config.tint != null)
{
var tint = config.tint.ToColor();
var key = $"AmbientLight_QM > tint {tint}";
if (ImageUtilities.CheckGeneratedTexture(key, out var existingTexture)) light.cookie = existingTexture;
if (ImageUtilities.CheckGeneratedTexture(key, out var existingTexture))
{
light.cookie = existingTexture;
}
else
{
var baseCubemap = Main.NHPrivateAssetBundle.LoadAsset<Cubemap>("AmbientLight_QM");
var cubemap = new Cubemap(baseCubemap.width, baseCubemap.format, baseCubemap.mipmapCount != 1);
cubemap.name = key;
@ -58,6 +62,7 @@ namespace NewHorizons.Builder.General
light.cookie = cubemap;
}
}
return light;
}