mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fixed colour things
This commit is contained in:
parent
076161d157
commit
227c5ff221
@ -23,7 +23,7 @@ namespace NewHorizons.Atmosphere
|
||||
meshRenderer.material.SetFloat("_InnerRadius", atmosphereModule.Cloud != null ? atmosphereModule.Size : surfaceSize);
|
||||
meshRenderer.material.SetFloat("_OuterRadius", atmosphereModule.Size * 1.2f);
|
||||
if(atmosphereModule.AtmosphereTint != null)
|
||||
meshRenderer.material.SetColor("_SkyColor", atmosphereModule.AtmosphereTint.ToColor());
|
||||
meshRenderer.material.SetColor("_SkyColor", atmosphereModule.AtmosphereTint.ToColor32());
|
||||
}
|
||||
|
||||
atmo.SetActive(true);
|
||||
|
||||
@ -30,7 +30,7 @@ namespace NewHorizons.Atmosphere
|
||||
return;
|
||||
}
|
||||
|
||||
Color cloudTint = atmo.CloudTint == null ? Color.white : (Color)atmo.CloudTint.ToColor();
|
||||
Color cloudTint = atmo.CloudTint == null ? Color.white : (Color)atmo.CloudTint.ToColor32();
|
||||
|
||||
GameObject cloudsMainGO = new GameObject();
|
||||
cloudsMainGO.SetActive(false);
|
||||
@ -90,7 +90,7 @@ namespace NewHorizons.Atmosphere
|
||||
var bottomTSRTempArray = new Material[bottomTSRMaterials.Length];
|
||||
|
||||
// It's a bit too green
|
||||
var bottomColor = atmo.CloudTint.ToColor();
|
||||
var bottomColor = atmo.CloudTint.ToColor32();
|
||||
bottomColor.g = (byte)(bottomColor.g * 0.5f);
|
||||
for (int i = 0; i < bottomTSRMaterials.Length; i++)
|
||||
{
|
||||
|
||||
@ -38,12 +38,12 @@ namespace NewHorizons.Atmosphere
|
||||
PFC.fogExponent = 1f;
|
||||
PFC.fogColorRampTexture = dbPlanetaryFogController.fogColorRampTexture;
|
||||
PFC.fogColorRampIntensity = 1f;
|
||||
var adjustedColour = atmo.FogTint.ToColor();
|
||||
var adjustedColour = atmo.FogTint.ToColor32();
|
||||
adjustedColour.r = (byte)(adjustedColour.r * atmo.FogDensity);
|
||||
adjustedColour.g = (byte)(adjustedColour.g * atmo.FogDensity);
|
||||
adjustedColour.b = (byte)(adjustedColour.b * atmo.FogDensity);
|
||||
adjustedColour.a = (byte)(adjustedColour.a * atmo.FogDensity);
|
||||
PFC.fogTint = atmo.FogTint.ToColor();
|
||||
PFC.fogTint = atmo.FogTint.ToColor32();
|
||||
|
||||
GameObject lodFogGO = new GameObject("LODFogSphere");
|
||||
lodFogGO.SetActive(false);
|
||||
@ -55,7 +55,7 @@ namespace NewHorizons.Atmosphere
|
||||
|
||||
MeshRenderer lodMR = lodFogGO.AddComponent<MeshRenderer>();
|
||||
lodMR.material = new Material(brambleLODFog.GetComponent<MeshRenderer>().material);
|
||||
lodMR.material.color = atmo.FogTint.ToColor();
|
||||
lodMR.material.color = atmo.FogTint.ToColor32();
|
||||
lodMR.material.renderQueue = 1000;
|
||||
|
||||
/*
|
||||
|
||||
@ -111,7 +111,8 @@ namespace NewHorizons.Builder.Body
|
||||
}
|
||||
else if (funnelType == FunnelType.STAR)
|
||||
{
|
||||
lavaMaterial.SetFloat("_HeightScale", 1000);
|
||||
lavaMaterial.renderQueue = 2999;
|
||||
lavaMaterial.SetFloat("_HeightScale", 100000);
|
||||
AddDestructionVolumes(fluidVolume, DeathType.Energy);
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ namespace NewHorizons.Builder.Body
|
||||
|
||||
var cubeSphereMR = icosphere.AddComponent<MeshRenderer>();
|
||||
cubeSphereMR.material = new Material(Shader.Find("Standard"));
|
||||
cubeSphereMR.material.color = module.Color.ToColor();
|
||||
cubeSphereMR.material.color = module.Color.ToColor32();
|
||||
|
||||
var cubeSphereMC = icosphere.AddComponent<MeshCollider>();
|
||||
cubeSphereMC.sharedMesh = mesh;
|
||||
|
||||
@ -29,8 +29,8 @@ namespace NewHorizons.Builder.Body
|
||||
new Material(sandMaterials[1])
|
||||
};
|
||||
GameObject.Destroy(oldMR);
|
||||
sandMR.sharedMaterials[0].color = module.Tint.ToColor();
|
||||
sandMR.sharedMaterials[1].color = module.Tint.ToColor();
|
||||
sandMR.sharedMaterials[0].color = module.Tint.ToColor32();
|
||||
sandMR.sharedMaterials[1].color = module.Tint.ToColor32();
|
||||
}
|
||||
|
||||
var collider = GameObject.Instantiate(GameObject.Find("TowerTwin_Body/SandSphere_Draining/Collider"), sandGO.transform);
|
||||
|
||||
@ -70,11 +70,11 @@ namespace NewHorizons.Builder.Body
|
||||
PlanetaryFogController fog = sunAtmosphere.transform.Find("FogSphere").GetComponent<PlanetaryFogController>();
|
||||
if (starModule.Tint != null)
|
||||
{
|
||||
fog.fogTint = starModule.Tint.ToColor();
|
||||
fog.fogTint = starModule.Tint.ToColor32();
|
||||
sunAtmosphere.transform.Find("AtmoSphere").transform.localScale = Vector3.one * (starModule.Size + 1000) / starModule.Size;
|
||||
foreach (var lod in sunAtmosphere.transform.Find("AtmoSphere").GetComponentsInChildren<MeshRenderer>())
|
||||
{
|
||||
lod.material.SetColor("_SkyColor", starModule.Tint.ToColor());
|
||||
lod.material.SetColor("_SkyColor", starModule.Tint.ToColor32());
|
||||
lod.material.SetFloat("_InnerRadius", starModule.Size);
|
||||
lod.material.SetFloat("_OuterRadius", starModule.Size * 3f / 2f);
|
||||
}
|
||||
@ -107,9 +107,9 @@ namespace NewHorizons.Builder.Body
|
||||
if (lightColour == null && starModule.Tint != null)
|
||||
{
|
||||
// Lighten it a bit
|
||||
var r = Mathf.Clamp01(starModule.Tint.R * 1.5f / 255f);
|
||||
var g = Mathf.Clamp01(starModule.Tint.G * 1.5f / 255f);
|
||||
var b = Mathf.Clamp01(starModule.Tint.B * 1.5f / 255f);
|
||||
var r = Mathf.Clamp01(starModule.Tint.R * 1.5f);
|
||||
var g = Mathf.Clamp01(starModule.Tint.G * 1.5f);
|
||||
var b = Mathf.Clamp01(starModule.Tint.B * 1.5f);
|
||||
lightColour = new Color(r, g, b);
|
||||
}
|
||||
if (lightColour != null) light.color = (Color)lightColour;
|
||||
@ -126,9 +126,13 @@ namespace NewHorizons.Builder.Body
|
||||
var giantMaterial = sun.GetComponent<SunController>().GetValue<Material>("_endSurfaceMaterial");
|
||||
|
||||
surface.sharedMaterial = new Material(starModule.Size >= 3000 ? giantMaterial : mainSequenceMaterial);
|
||||
var mod = Mathf.Max(1f, 8f * starModule.SolarLuminosity) / 255f;
|
||||
surface.sharedMaterial.color = new Color(colour.r * mod, colour.g * mod, colour.b * mod);
|
||||
surface.sharedMaterial.SetTexture("_ColorRamp", ImageUtilities.TintImage(_colorOverTime, colour));
|
||||
var mod = Mathf.Max(0.5f, 2f * Mathf.Sqrt(starModule.SolarLuminosity));
|
||||
var adjustedColour = new Color(colour.r * mod, colour.g * mod, colour.b * mod);
|
||||
surface.sharedMaterial.color = adjustedColour;
|
||||
|
||||
Color.RGBToHSV(adjustedColour, out float H, out float S, out float V);
|
||||
var darkenedColor = Color.HSVToRGB(H, S, V * 0.125f);
|
||||
surface.sharedMaterial.SetTexture("_ColorRamp", ImageUtilities.LerpGreyscaleImage(_colorOverTime, adjustedColour, darkenedColor));
|
||||
}
|
||||
|
||||
if(starModule.SolarFlareTint != null)
|
||||
|
||||
@ -18,7 +18,6 @@ namespace NewHorizons.Builder.Body
|
||||
waterGO.layer = 15;
|
||||
waterGO.transform.parent = body.transform;
|
||||
waterGO.transform.localScale = new Vector3(waterSize, waterSize, waterSize);
|
||||
waterGO.DestroyAllComponents<SphereCollider>();
|
||||
|
||||
var GDTSR = GameObject.Find("Ocean_GD").GetComponent<TessellatedSphereRenderer>();
|
||||
|
||||
@ -38,7 +37,7 @@ namespace NewHorizons.Builder.Body
|
||||
tempArray[i] = new Material(GDSharedMaterials[i]);
|
||||
if (module.Tint != null)
|
||||
{
|
||||
tempArray[i].color = module.Tint.ToColor();
|
||||
tempArray[i].color = module.Tint.ToColor32();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,13 +35,13 @@ namespace NewHorizons.Builder.Orbital
|
||||
orbitLine = orbitGO.AddComponent<TrackingOrbitLine>();
|
||||
|
||||
var color = Color.white;
|
||||
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor();
|
||||
else if (config.Star != null) color = config.Star.Tint.ToColor();
|
||||
else if (config.Atmosphere != null && config.Atmosphere.CloudTint != null) color = config.Atmosphere.CloudTint.ToColor();
|
||||
if (config.Orbit.Tint != null) color = config.Orbit.Tint.ToColor32();
|
||||
else if (config.Star != null) color = config.Star.Tint.ToColor32();
|
||||
else if (config.Atmosphere != null && config.Atmosphere.CloudTint != null) color = config.Atmosphere.CloudTint.ToColor32();
|
||||
else if (config.Base.BlackHoleSize != 0 || config.Singularity != null) color = new Color(1f, 0.5f, 1f);
|
||||
else if (config.Base.WaterSize != 0) color = new Color(0.5f, 0.5f, 1f);
|
||||
else if (config.Base.LavaSize != 0) color = new Color(1f, 0.5f, 0.5f);
|
||||
else if (config.Atmosphere != null && config.Atmosphere.FogTint != null) color = config.Atmosphere.FogTint.ToColor();
|
||||
else if (config.Atmosphere != null && config.Atmosphere.FogTint != null) color = config.Atmosphere.FogTint.ToColor32();
|
||||
|
||||
var fade = isMoon;
|
||||
if (config.Base.IsSatellite)
|
||||
|
||||
@ -21,6 +21,22 @@ namespace NewHorizons.Utility
|
||||
return newImage;
|
||||
}
|
||||
|
||||
public static Texture2D LerpGreyscaleImage(Texture2D image, Color lightTint, Color darkTint)
|
||||
{
|
||||
var pixels = image.GetPixels();
|
||||
for (int i = 0; i < pixels.Length; i++)
|
||||
{
|
||||
pixels[i].r = Mathf.Lerp(darkTint.r, lightTint.r, pixels[i].r);
|
||||
pixels[i].g = Mathf.Lerp(darkTint.g, lightTint.g, pixels[i].g);
|
||||
pixels[i].b = Mathf.Lerp(darkTint.b, lightTint.b, pixels[i].b);
|
||||
}
|
||||
|
||||
var newImage = new Texture2D(image.width, image.height);
|
||||
newImage.SetPixels(pixels);
|
||||
newImage.Apply();
|
||||
return newImage;
|
||||
}
|
||||
|
||||
public static Texture2D LoadImage(string filepath)
|
||||
{
|
||||
Texture2D tex = new Texture2D(2, 2);
|
||||
|
||||
@ -17,6 +17,8 @@ namespace NewHorizons.Utility
|
||||
public int B { get; }
|
||||
public int A { get; }
|
||||
|
||||
public Color ToColor() => new Color(R / 255, G / 255, B / 255, A / 255);
|
||||
public Color32 ToColor32() => new Color(R, G, B, A);
|
||||
|
||||
public Color ToColor() => new Color(R / 255f, G / 255f, B / 255f, A / 255f);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user