feat: support 'Active Apply Color Space' for linear color space

This commit is contained in:
mob-sakai
2023-11-08 20:24:20 +09:00
parent 2b8d3b1385
commit 45c56bbd85
3 changed files with 38 additions and 12 deletions

View File

@@ -6,6 +6,25 @@ using Object = UnityEngine.Object;
namespace Coffee.UIParticleExtensions
{
public static class Color32Extensions
{
private static byte[] s_LinearToGammaLut;
public static byte LinearToGamma(this byte self)
{
if (s_LinearToGammaLut == null)
{
s_LinearToGammaLut = new byte[256];
for (var i = 0; i < 256; i++)
{
s_LinearToGammaLut[i] = (byte)(Mathf.LinearToGammaSpace(i / 255f) * 255f);
}
}
return s_LinearToGammaLut[self];
}
}
public static class Vector3Extensions
{
public static Vector3 Inverse(this Vector3 self)