Files
com.misaki.art-tools/Editor/AssetsHelpers/Enums/TextureChannel.cs
2025-01-23 23:56:11 +09:00

32 lines
739 B
C#

using System;
namespace Misaki.ArtToolEditor
{
internal enum TextureChannel
{
None,
R,
G,
B,
A
}
internal static class TextureChannelHelpers
{
private static readonly ArgumentException _channelNoneException = new("Channel is none");
public static int ToColorIndex(this TextureChannel channel)
{
return channel switch
{
TextureChannel.None => throw _channelNoneException,
TextureChannel.R => 0,
TextureChannel.G => 1,
TextureChannel.B => 2,
TextureChannel.A => 3,
_ => throw _channelNoneException
};
}
}
}