Fix cloud colours

This commit is contained in:
Nick 2022-05-02 12:50:13 -04:00
parent b5c7fd7e28
commit 6779a66ecf

View File

@ -92,20 +92,29 @@ namespace NewHorizons.Builder.Atmosphere
cloudsBottomGO.transform.localScale = Vector3.one * (atmo.Size * 0.9f);
TessellatedSphereRenderer bottomTSR = cloudsBottomGO.AddComponent<TessellatedSphereRenderer>();
bottomTSR.tessellationMeshGroup = GameObject.Find("CloudsBottomLayer_GD").GetComponent<TessellatedSphereRenderer>().tessellationMeshGroup;
bottomTSR.tessellationMeshGroup = GameObject.Find("CloudsBottomLayer_QM").GetComponent<TessellatedSphereRenderer>().tessellationMeshGroup;
var bottomTSRMaterials = GameObject.Find("CloudsBottomLayer_QM").GetComponent<TessellatedSphereRenderer>().sharedMaterials;
var bottomTSRTempArray = new Material[bottomTSRMaterials.Length];
// It's a bit too green
var bottomColor = atmo.CloudTint.ToColor32();
bottomColor.g = (byte)(bottomColor.g * 0.5f);
for (int i = 0; i < bottomTSRMaterials.Length; i++)
// If they set a colour apply it to all the materials else keep the default QM one
if (atmo.CloudTint != null)
{
bottomTSRTempArray[i] = new Material(bottomTSRMaterials[i]);
bottomTSRTempArray[i].SetColor("_Color", bottomColor);
bottomTSRTempArray[i].SetColor("_TintColor", bottomColor);
}
var bottomColor = atmo.CloudTint.ToColor32();
var bottomTSRTempArray = new Material[2];
bottomTSRTempArray[0] = new Material(bottomTSRMaterials[0]);
bottomTSRTempArray[0].SetColor("_Color", bottomColor);
bottomTSRTempArray[0].SetColor("_TintColor", bottomColor);
bottomTSRTempArray[1] = new Material(bottomTSRMaterials[1]);
bottomTSR.sharedMaterials = bottomTSRTempArray;
}
else
{
bottomTSR.sharedMaterials = bottomTSRMaterials;
}
bottomTSR.maxLOD = 6;
bottomTSR.LODBias = 0;
bottomTSR.LODRadius = 1f;