12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- Shader "XGame/TestTime"
- {
- Properties
- {
- _MainTex ("Texture", 2D) = "white" {}
- _ScrollY ("Scroll Speed", Range(0, 1)) = 1
- _MoveTime("Move Time", float) = 0
- }
- SubShader
- {
- Tags { "RenderType"="Opaque" }
- LOD 100
- Pass
- {
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- // make fog work
- // #pragma multi_compile_fog
-
- #include "UnityCG.cginc"
- struct appdata
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- };
- struct v2f
- {
- float2 uv : TEXCOORD0;
- float4 vertex : POSITION;
- };
- sampler2D _MainTex;
- float4 _MainTex_ST;
- float _ScrollY;
- float _MoveTime;
-
- v2f vert (appdata v)
- {
- v2f o;
- // v.vertex.y = sin(v.vertex.x+_Time.y);
- o.vertex = UnityObjectToClipPos(v.vertex);
- o.uv = v.uv + float2(0, _ScrollY * _MoveTime);
- return o;
- }
-
- fixed4 frag (v2f i) : SV_Target
- {
- fixed4 col = tex2D(_MainTex, i.uv);
- return col;
- }
- ENDCG
- }
- }
- }
|