// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'

Shader "URP/Effects/Particle/FX_Particle_Add_Color_AnimTitle" {
Properties {
	[HDR]_Color("Color", Color) = (1,1,1,1)
	_MainTex ("Base (RGB)", 2D) = "white" {}
	_NumTexTiles("Num tex tiles",	Vector) = (4,4,0,0)
	_ReplaySpeed("Replay speed - FPS",float) = 20
}

SubShader {

	Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
	
	 Blend SrcAlpha One
	Cull Off Lighting Off ZWrite Off Fog { Color (0,0,0,0) }

	CGINCLUDE
	#include "UnityCG.cginc"
	sampler2D _MainTex;
	float4 _MainTex_ST;
	float4	_Color;
	float4	_NumTexTiles;
	float		_ReplaySpeed;
	
	struct v2f {
		float4 pos : SV_POSITION;
		float2 uv : TEXCOORD0;
		fixed4 col: COLOR;
	};
	
	v2f vert (appdata_full v)
	{
		v2f o;
		float2 uv = v.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
		float itime = floor((_Time.y) * _ReplaySpeed);
		float2	texTileSize = 1.f / _NumTexTiles.xy;		
		float2	tile = float2(itime,floor(itime /_NumTexTiles.x));
		tile = fmod(tile,_NumTexTiles.xy);
		
		o.pos= UnityObjectToClipPos(v.vertex);
		o.uv	= (uv + tile) * texTileSize.xy;
		o.col	=_Color * v.color;	
		return o;
	}
	ENDCG


	Pass {
		CGPROGRAM
		#pragma vertex vert
		#pragma fragment frag
		#pragma fragmentoption ARB_precision_hint_fastest		
		fixed4 frag (v2f i) : COLOR
		{
		float4 col = tex2D(_MainTex, i.uv.xy)* i.col;
			return col;
		}
		ENDCG 
	}	
}
}
