XGame-BMFont.shader 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2. Shader "XGame/Text Shader" {
  3. Properties {
  4. _MainTex ("Font Texture", 2D) = "white" {}
  5. _Color ("Text Color", Color) = (1,1,1,1)
  6. }
  7. SubShader {
  8. Tags {
  9. "Queue"="Transparent"
  10. "IgnoreProjector"="True"
  11. "RenderType"="Transparent"
  12. "PreviewType"="Plane"
  13. }
  14. Lighting Off Cull Off ZTest Always ZWrite Off
  15. Blend SrcAlpha OneMinusSrcAlpha
  16. Pass {
  17. CGPROGRAM
  18. #pragma vertex vert
  19. #pragma fragment frag
  20. #pragma multi_compile _ UNITY_SINGLE_PASS_STEREO STEREO_INSTANCING_ON STEREO_MULTIVIEW_ON
  21. #include "UnityCG.cginc"
  22. struct appdata_t {
  23. float4 vertex : POSITION;
  24. fixed4 color : COLOR;
  25. float2 texcoord : TEXCOORD0;
  26. UNITY_VERTEX_INPUT_INSTANCE_ID
  27. };
  28. struct v2f {
  29. float4 vertex : SV_POSITION;
  30. fixed4 color : COLOR;
  31. float2 texcoord : TEXCOORD0;
  32. UNITY_VERTEX_OUTPUT_STEREO
  33. };
  34. sampler2D _MainTex;
  35. uniform float4 _MainTex_ST;
  36. uniform fixed4 _Color;
  37. v2f vert (appdata_t v)
  38. {
  39. v2f o;
  40. UNITY_SETUP_INSTANCE_ID(v);
  41. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  42. o.vertex = UnityObjectToClipPos(v.vertex);
  43. o.color = v.color * _Color;
  44. o.texcoord = TRANSFORM_TEX(v.texcoord,_MainTex);
  45. return o;
  46. }
  47. fixed4 frag (v2f i) : SV_Target
  48. {
  49. fixed4 col = i.color;
  50. col *= tex2D(_MainTex, i.texcoord);
  51. return col;
  52. }
  53. ENDCG
  54. }
  55. }
  56. }