Allow specifying all corners for ImGui gradients. (#247)

This commit is contained in:
Skyth (Asilkan)
2025-01-30 23:25:19 +03:00
committed by GitHub
parent 70f042d11f
commit 21c1d36836
6 changed files with 25 additions and 9 deletions

View File

@@ -6,8 +6,10 @@ struct PushConstants
{
float2 BoundsMin;
float2 BoundsMax;
uint GradientTop;
uint GradientBottom;
uint GradientTopLeft;
uint GradientTopRight;
uint GradientBottomRight;
uint GradientBottomLeft;
uint ShaderModifier;
uint Texture2DDescriptorIndex;
float2 InverseDisplaySize;

View File

@@ -165,7 +165,9 @@ float4 main(in Interpolators interpolators) : SV_Target
}
else
{
color *= lerp(DecodeColor(g_PushConstants.GradientTop), DecodeColor(g_PushConstants.GradientBottom), smoothstep(0.0, 1.0, factor.y));
float4 top = lerp(DecodeColor(g_PushConstants.GradientTopLeft), DecodeColor(g_PushConstants.GradientTopRight), smoothstep(0.0, 1.0, factor.x));
float4 bottom = lerp(DecodeColor(g_PushConstants.GradientBottomLeft), DecodeColor(g_PushConstants.GradientBottomRight), smoothstep(0.0, 1.0, factor.x));
color *= lerp(top, bottom, smoothstep(0.0, 1.0, factor.y));
}
}