源战役客户端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

81 righe
1.3 KiB

  1. 
  2. Shader "SuYou/Lightmap_Diffuse" {
  3. Properties {
  4. _MainTex ("Base", 2D) = "white" {}
  5. }
  6. CGINCLUDE
  7. sampler2D _MainTex;
  8. ENDCG
  9. SubShader {
  10. Tags { "RenderType"="Opaque" }
  11. Pass {
  12. CGPROGRAM
  13. #pragma vertex vert
  14. #pragma fragment frag
  15. #pragma multi_compile_fog
  16. #pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON
  17. #include "UnityCG.cginc"
  18. struct appdata_t {
  19. float4 vertex : POSITION;
  20. float2 texcoord : TEXCOORD0;
  21. float2 texcoord1 : TEXCOORD1;
  22. };
  23. struct v2f
  24. {
  25. half4 pos : SV_POSITION;
  26. half2 uv : TEXCOORD0;
  27. #ifdef LIGHTMAP_ON
  28. half2 uv2 : TEXCOORD1;
  29. #endif
  30. UNITY_FOG_COORDS(2)
  31. };
  32. float4 _MainTex_ST;
  33. v2f vert (appdata_t v)
  34. {
  35. v2f o;
  36. o.pos = UnityObjectToClipPos (v.vertex);
  37. #ifdef LIGHTMAP_ON
  38. o.uv = v.texcoord;
  39. o.uv2 = v.texcoord1 * unity_LightmapST.xy + unity_LightmapST.zw;
  40. #else
  41. o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
  42. #endif
  43. UNITY_TRANSFER_FOG(o,o.pos);
  44. return o;
  45. }
  46. fixed4 frag (v2f i) : COLOR0
  47. {
  48. fixed4 tex = tex2D (_MainTex, i.uv);
  49. #ifdef LIGHTMAP_ON
  50. fixed3 lm = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap,i.uv2));
  51. tex.rgb *= lm;
  52. #endif
  53. UNITY_APPLY_FOG(i.fogCoord, tex);
  54. return tex;
  55. }
  56. ENDCG
  57. }
  58. }
  59. FallBack Off
  60. }