using Godot; using System; using Rokojori.Extensions; namespace Rokojori { /** How an image layer reads a height out of a texture. The single-channel entries take the height from that channel and cover the whole rect at full weight. The paired entries take the height from the colour channel and the coverage from alpha, so a cut-out image only affects the map where it is opaque - which is what lets a stamped shape with transparent corners blend in instead of writing a square. Coverage is not the same thing as height: under Add and Subtract it scales the contribution, under Replace it is the crossfade back to what is underneath. That is the same split the circle's falloff already has. The int values are passed to HeightMapShape.gdshader as shape_image_channel - do not renumber without updating the shader. */ public enum HeightMapChannel { R = 0, G = 1, B = 2, A = 3, RA = 4, GA = 5, BA = 6 } public static class HeightMapChannelX { /** True for the paired entries, where alpha is read as coverage. */ public static bool UsesAlphaCoverage( this HeightMapChannel channel ) { return channel == HeightMapChannel.RA || channel == HeightMapChannel.GA || channel == HeightMapChannel.BA; } } }