mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
oops
This commit is contained in:
parent
f57ca63f71
commit
a44cea387d
@ -18,45 +18,50 @@ namespace NewHorizons.Builder.General
|
|||||||
|
|
||||||
var light = lightGO.GetComponent<Light>();
|
var light = lightGO.GetComponent<Light>();
|
||||||
/*
|
/*
|
||||||
* R is inner radius
|
* R is inner radius
|
||||||
* G is shell (1 for shell, 0 for no shell)
|
* G is shell (1 for shell, 0 for no shell)
|
||||||
* B is always 1
|
* B is always 1
|
||||||
* A is falloff exponent
|
* A is falloff exponent
|
||||||
*/
|
*/
|
||||||
|
|
||||||
light.intensity = config.intensity;
|
light.intensity = config.intensity;
|
||||||
light.range = config.outerRadius ?? surfaceSize * 2;
|
light.range = config.outerRadius ?? surfaceSize * 2;
|
||||||
var innerRadius = config.innerRadius ?? surfaceSize;
|
var innerRadius = config.innerRadius ?? surfaceSize;
|
||||||
innerRadius = Mathf.Sqrt(innerRadius / light.range);
|
innerRadius = Mathf.Sqrt(innerRadius / light.range);
|
||||||
var shell = config.isShell ? 1f : 0f;
|
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)
|
if (config.tint != null)
|
||||||
{
|
{
|
||||||
var tint = config.tint.ToColor();
|
var tint = config.tint.ToColor();
|
||||||
var key = $"AmbientLight_QM > tint {tint}";
|
var key = $"AmbientLight_QM > tint {tint}";
|
||||||
if (ImageUtilities.CheckGeneratedTexture(key, out var existingTexture)) light.cookie = existingTexture;
|
if (ImageUtilities.CheckGeneratedTexture(key, out var existingTexture))
|
||||||
|
|
||||||
var baseCubemap = Main.NHPrivateAssetBundle.LoadAsset<Cubemap>("AmbientLight_QM");
|
|
||||||
var cubemap = new Cubemap(baseCubemap.width, baseCubemap.format, baseCubemap.mipmapCount != 1);
|
|
||||||
cubemap.name = key;
|
|
||||||
cubemap.wrapMode = baseCubemap.wrapMode;
|
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
{
|
||||||
var cubemapFace = (CubemapFace)i;
|
light.cookie = existingTexture;
|
||||||
var sourceColors = baseCubemap.GetPixels(cubemapFace);
|
}
|
||||||
var newColors = new Color[sourceColors.Length];
|
else
|
||||||
for (int j = 0; j < sourceColors.Length; j++)
|
{
|
||||||
{
|
var baseCubemap = Main.NHPrivateAssetBundle.LoadAsset<Cubemap>("AmbientLight_QM");
|
||||||
var grey = sourceColors[j].grayscale * 2; // looks nicer with multiplier
|
var cubemap = new Cubemap(baseCubemap.width, baseCubemap.format, baseCubemap.mipmapCount != 1);
|
||||||
newColors[j] = new Color(grey, grey, grey) * tint;
|
cubemap.name = key;
|
||||||
}
|
cubemap.wrapMode = baseCubemap.wrapMode;
|
||||||
cubemap.SetPixels(newColors, cubemapFace);
|
for (int i = 0; i < 6; i++)
|
||||||
|
{
|
||||||
|
var cubemapFace = (CubemapFace)i;
|
||||||
|
var sourceColors = baseCubemap.GetPixels(cubemapFace);
|
||||||
|
var newColors = new Color[sourceColors.Length];
|
||||||
|
for (int j = 0; j < sourceColors.Length; j++)
|
||||||
|
{
|
||||||
|
var grey = sourceColors[j].grayscale * 2; // looks nicer with multiplier
|
||||||
|
newColors[j] = new Color(grey, grey, grey) * tint;
|
||||||
|
}
|
||||||
|
cubemap.SetPixels(newColors, cubemapFace);
|
||||||
|
}
|
||||||
|
cubemap.Apply();
|
||||||
|
ImageUtilities.TrackGeneratedTexture(key, cubemap);
|
||||||
|
|
||||||
|
light.cookie = cubemap;
|
||||||
}
|
}
|
||||||
cubemap.Apply();
|
|
||||||
ImageUtilities.TrackGeneratedTexture(key, cubemap);
|
|
||||||
|
|
||||||
light.cookie = cubemap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return light;
|
return light;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user