#ifndef URP_DEPTH_ONLY_INCLUDED
#define URP_DEPTH_ONLY_INCLUDED

//URP 相机深度PASS 使用
//tag:
/* 
Name "DepthOnly"
Tags{"LightMode" = "DepthOnly"}
*/

#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"

struct appdata
{
	float4 vertex : POSITION;
	float3 normal : NORMAL;
	float2 uv : TEXCOORD0;

};

struct v2f
{
	float4 vertex : SV_POSITION;
	float2 uv : TEXCOORD0;
};

v2f vertCutoff(appdata v)
{
	v2f o;
	float3 worldPos = TransformObjectToWorld(v.vertex);
	o.vertex = TransformWorldToHClip(worldPos);
	o.uv = v.uv;
	//o.uv = TRANSFORM_TEX(v.uv, _MainTex);
	return o;
}

float4 fragCutoff(v2f i) : SV_Target
{
	float4 col = tex2D(_MainTex, i.uv);
	clip(col.a - _Cutoff);

	//float4 col = SAMPLE_TEXTURE2D_X(_MainTex, TEXTURE2D_ARGS(_MainTex, sampler_MainTex), i.uv);

	//clip(SAMPLE_TEXTURE2D_X(_MainTex, TEXTURE2D_ARGS(_MainTex, sampler_MainTex), i.uv).a - _Cutoff);
	return 1;
}

v2f vert(appdata v)
{
	v2f o;
	float3 worldPos = TransformObjectToWorld(v.vertex);
	o.vertex = TransformWorldToHClip(worldPos);
	return o;
}

float4 frag(v2f i) : SV_Target
{
	return 1;
}

#endif