您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
80 行
1.5 KiB
80 行
1.5 KiB
Shader "UIWidgets/GUITexture"
|
|
{
|
|
Properties { _MainTex ("Texture", any) = "" {} }
|
|
|
|
CGINCLUDE
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma target 2.0
|
|
|
|
#include "UnityCG.cginc"
|
|
|
|
struct appdata_t {
|
|
float4 vertex : POSITION;
|
|
fixed4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_INPUT_INSTANCE_ID
|
|
};
|
|
|
|
struct v2f {
|
|
float4 vertex : SV_POSITION;
|
|
fixed4 color : COLOR;
|
|
float2 texcoord : TEXCOORD0;
|
|
UNITY_VERTEX_OUTPUT_STEREO
|
|
};
|
|
|
|
sampler2D _MainTex;
|
|
|
|
uniform float4 _MainTex_ST;
|
|
|
|
v2f vert (appdata_t v)
|
|
{
|
|
v2f o;
|
|
UNITY_SETUP_INSTANCE_ID(v);
|
|
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
|
o.color = v.color;
|
|
o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
|
|
return o;
|
|
}
|
|
|
|
fixed4 frag (v2f i) : SV_Target
|
|
{
|
|
return 2.0f * tex2D(_MainTex, i.texcoord) * i.color;
|
|
}
|
|
ENDCG
|
|
|
|
SubShader {
|
|
|
|
Tags { "RenderType"="Overlay" }
|
|
|
|
Lighting Off
|
|
Blend One OneMinusSrcAlpha, One OneMinusSrcAlpha
|
|
Cull Off
|
|
ZWrite Off
|
|
ZTest Always
|
|
|
|
Pass {
|
|
CGPROGRAM
|
|
ENDCG
|
|
}
|
|
}
|
|
|
|
SubShader {
|
|
|
|
Tags { "RenderType"="Overlay" }
|
|
|
|
Lighting Off
|
|
Blend One OneMinusSrcAlpha
|
|
Cull Off
|
|
ZWrite Off
|
|
ZTest Always
|
|
|
|
Pass {
|
|
CGPROGRAM
|
|
ENDCG
|
|
}
|
|
}
|
|
|
|
Fallback off
|
|
}
|