纹理与颜色组合绘制标签,支持 HDR 属性的颜色绘制

用法

TAC(string):接受一个颜色属性名作为参数,如果没有,则此标签的绘制行为和 MT 一致

代码示例

Shader "BZGUITest/TACDrawer"
{
    Properties
    {
        [TAC(_C)]_T("MainTex", 2D) = "White"{}
        [HDR]_C("SecondColor", Color) = (1,2,3,4)
    }
    SubShader
    {
        Tags { "RenderType"="Opaque" }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            // make fog work
            #include "UnityCG.cginc"

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };


            v2f vert (appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                UNITY_TRANSFER_FOG(o,o.vertex);
                return o;
            }

            fixed4 frag (v2f i) : SV_Target
            {
                return half4(0.618,0.5,0.2,1);
            }
            ENDCG
        }
    }
      CustomEditor "BZTA.BZShaderGUI"
}