final text background fix

This commit is contained in:
DCFApixels 2025-02-28 12:38:59 +08:00
parent 63f94fd7a8
commit 435c522b0c
2 changed files with 3 additions and 16 deletions

View File

@ -80,11 +80,8 @@ namespace DCFApixels
if (!(WorldToGUIPointWithDepth(camera, item.Value.Position).z < 0f))
{
Rect rect = WorldPointToSizedRect(camera, item.Value.Position, _labelDummy, _labelStyle);
Color backgroundColor = item.Value.Settings.BackgroundColor * GlobalColor;
backgroundMaterial.SetColor(ColorPropertyID, backgroundColor);
Graphics.DrawTexture(rect, _whiteTexture, backgroundMaterial);
Graphics.DrawTexture(rect, _whiteTexture, new Rect(0, 0, 1, 1), 0, 0, 0, 0, backgroundColor, backgroundMaterial, -1);
GUI.color = item.Color * GlobalColor;
style.Draw(rect, _labelDummy, false, false, false, false);
}

View File

@ -1,9 +1,5 @@
Shader "DCFApixels/DebugX/TextBackground"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
@ -25,7 +21,6 @@ Shader "DCFApixels/DebugX/TextBackground"
{
float4 vertex : POSITION;
float4 color : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
@ -34,24 +29,19 @@ Shader "DCFApixels/DebugX/TextBackground"
float4 color : COLOR;
};
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_DEFINE_INSTANCED_PROP(float4, _Color)
UNITY_INSTANCING_BUFFER_END(Props)
float4 _DebugX_GlobalColor;
v2f vert (appdata_t v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
o.vertex = UnityObjectToClipPos(v.vertex);
o.color = v.color * UNITY_ACCESS_INSTANCED_PROP(Props, _Color) * _DebugX_GlobalColor;
o.color = v.color * _DebugX_GlobalColor;
return o;
}
float4 frag (v2f i) : SV_Target
{
return i.color * float4(1, 1, 1, 2);
return i.color;
}
ENDCG
}