Limits the minimum base skin color brightness for species with Hue coloration (#23605)
adds a minimum skin tone for hue skin colors (cherry picked from commit 43d1be51fb5e49c61c00aef441431f50890339ea)
This commit is contained in:
parent
5e3dd3cc22
commit
e7f53d8578
|
|
@ -5,6 +5,8 @@ public static class SkinColor
|
|||
public const float MaxTintedHuesSaturation = 0.1f;
|
||||
public const float MinTintedHuesLightness = 0.85f;
|
||||
|
||||
public const float MinHuesLightness = 0.175f;
|
||||
|
||||
public static Color ValidHumanSkinTone => Color.FromHsv(new Vector4(0.07f, 0.2f, 1f, 1f));
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -157,6 +159,28 @@ public static class SkinColor
|
|||
return Color.ToHsl(color).Y <= MaxTintedHuesSaturation && Color.ToHsl(color).Z >= MinTintedHuesLightness;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This takes in a color, and returns a color guaranteed to be above MinHuesLightness
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <returns>Either the color as-is if it's above MinHuesLightness, or the color with luminosity increased above MinHuesLightness</returns>
|
||||
public static Color MakeHueValid(Color color)
|
||||
{
|
||||
var manipulatedColor = Color.ToHsv(color);
|
||||
manipulatedColor.Z = Math.Max(manipulatedColor.Z, MinHuesLightness);
|
||||
return Color.FromHsv(manipulatedColor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify if this color is above a minimum luminosity
|
||||
/// </summary>
|
||||
/// <param name="color"></param>
|
||||
/// <returns>True if valid, false if not</returns>
|
||||
public static bool VerifyHues(Color color)
|
||||
{
|
||||
return Color.ToHsv(color).Z >= MinHuesLightness;
|
||||
}
|
||||
|
||||
public static bool VerifySkinColor(HumanoidSkinColor type, Color color)
|
||||
{
|
||||
return type switch
|
||||
|
|
@ -164,7 +188,7 @@ public static class SkinColor
|
|||
HumanoidSkinColor.HumanToned => VerifyHumanSkinTone(color),
|
||||
HumanoidSkinColor.TintedHues => VerifyTintedHues(color),
|
||||
HumanoidSkinColor.TintedHuesSkin => true, // DeltaV - Tone blending
|
||||
HumanoidSkinColor.Hues => true,
|
||||
HumanoidSkinColor.Hues => VerifyHues(color),
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
|
|
@ -176,6 +200,7 @@ public static class SkinColor
|
|||
HumanoidSkinColor.HumanToned => ValidHumanSkinTone,
|
||||
HumanoidSkinColor.TintedHues => ValidTintedHuesSkinTone(color),
|
||||
HumanoidSkinColor.TintedHuesSkin => ValidTintedHuesSkinTone(color), // DeltaV - Tone blending
|
||||
HumanoidSkinColor.Hues => MakeHueValid(color),
|
||||
_ => color
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue