#ifndef WATER_STANDARD_INPUT
#define WATER_STANDARD_INPUT
struct Attributes
{
    float4 positionOS   : POSITION;
    float4 color : COLOR;
    float3 normalOS     : NORMAL;
    float4 tangentOS    : TANGENT;
    float2 uv     : TEXCOORD0;
    UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
    float4 vertex : SV_POSITION;
    float3 positionWS : TEXCOORD0;
    float4 fogCoord : TEXCOORD1;
    float vPos : TEXCOORD2;
    float3 WorldSpaceNormal : TEXCOORD3;
    float3 WorldSpaceTangent : TEXCOORD4;
    float3 WorldSpaceBiTangent : TEXCOORD5;
    float4 color : COLOR;
    UNITY_VERTEX_INPUT_INSTANCE_ID
    UNITY_VERTEX_OUTPUT_STEREO
};
CBUFFER_START(UnityPerMaterial)
float4 _FoamTex_ST;
half4 _WaveParams;
half _NormalScale;
half4 _FoamParams;
float2 _NormalTex_ST;
half3 _SkyColor;
half3 _FresnelColor;
half4 _Specular;
half4 _SpecColor;
half3 _EnvShadow;
half4 _ShallowColor;
half4 _DeepColor;
float _ColorDepth;
float4 _Refraction;
float _ReflectionStrength;
float _FoamDepth;
float _NearAlpha;
half4 _CausticsVisuals;
half _CausticsDepth;
float _VertexColor;
half _FresnelMip;
CBUFFER_END 
TEXTURE2D(_ReflectionTex); SAMPLER(sampler_ReflectionTex); half4 _ReflectionTex_TexelSize;
TEXTURE2D(_FoamTex); SAMPLER(sampler_FoamTex); half4 _FoamTex_TexelSize;
TEXTURE2D(_NormalTex); SAMPLER(sampler_NormalTex); half4 _NormalTex_TexelSize;
SAMPLER(_CustomFunction_Sampler_Linear_Repeat);
v2f vert (Attributes v)
{
    v2f o;
    UNITY_SETUP_INSTANCE_ID(v);
    UNITY_TRANSFER_INSTANCE_ID(v, o);
    UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    VertexPositionInputs vertexInput = GetVertexPositionInputs(v.positionOS.xyz);
    o.vertex = vertexInput.positionCS;
    o.positionWS = vertexInput.positionWS;	
    VertexNormalInputs normalInput = GetVertexNormalInputs(v.normalOS, v.tangentOS);
    o.WorldSpaceNormal =            normalInput.normalWS.xyz;
    o.WorldSpaceTangent =           normalInput.tangentWS.xyz;
    half tangentSign = v.tangentOS.w * unity_WorldTransformParams.w;
    o.WorldSpaceBiTangent =         cross(normalInput.normalWS.xyz, normalInput.tangentWS.xyz) * tangentSign;
    o.vPos= mul(UNITY_MATRIX_MV, v.positionOS).z;
    o.color = lerp(half4(1,1,1,1),v.color,_VertexColor);
    //o.fogCoord = vertexInput.positionCS.z;
    o.fogCoord = VolumetricFog_GetFogCoord(vertexInput.positionNDC, vertexInput.positionVS.z);
    return o;
}
struct Bindings_Water
{
    float3 WorldSpaceNormal;
    float3 WorldSpaceViewDirection;
    float3 WorldSpacePosition;
    float3 ViewSpacePosition;
    float3 AbsoluteWorldSpacePosition;
    float4 ScreenPosition;
};
struct SurfaceDescriptionInputs
{
    float3 WorldSpaceNormal;
    float3 ViewSpacePosition;
    float3 WorldSpacePosition;
    float3 AbsoluteWorldSpacePosition;
    float4 ScreenPosition;
    float vPos;
    float4 VertexColor;
};
struct SurfaceDescription
{
    half3 Color;
    half alpha;
};
SurfaceDescriptionInputs BuildSurfaceDescriptionInputs(v2f input)
{
    SurfaceDescriptionInputs output;
    ZERO_INITIALIZE(SurfaceDescriptionInputs, output);
    output.WorldSpaceNormal =            input.WorldSpaceNormal;
    output.WorldSpacePosition =          input.positionWS;
    output.ViewSpacePosition =           TransformWorldToView(input.positionWS);
    output.AbsoluteWorldSpacePosition =  GetAbsolutePositionWS(input.positionWS);
    output.ScreenPosition =              ComputeScreenPos(TransformWorldToHClip(input.positionWS), _ProjectionParams.x);
    output.vPos =                 input.vPos;
    output.VertexColor =                 input.color;
    return output;
}
#endif