/*=============================================================================
	HitProxyVertexShader.hlsl: Vertex shader for rendering hit proxies.
	Copyright 1998-2010 Epic Games, Inc. All Rights Reserved.
=============================================================================*/

#include "Common.usf"
#include "Material.usf"
#include "VertexFactory.usf"

void Main(
	FVertexFactoryInput Input,
	out FVertexFactoryInterpolants FactoryInterpolants,
	out float4 PixelPosition : TEXCOORD6,
	out float4 CameraVectorOrVertexColor : TEXCOORD7,
	out float4 Position : POSITION
	)
{
	FVertexFactoryIntermediates VFIntermediates = GetVertexFactoryIntermediates(Input);
	float4	WorldPosition = VertexFactoryGetWorldPosition(Input, VFIntermediates);
	float3x3 TangentBasis = VertexFactoryGetTangentBasis(Input, VFIntermediates);

	FMaterialVertexParameters VertexParameters = GetMaterialVertexParameters(Input, VFIntermediates, WorldPosition.xyz, TangentBasis);
	WorldPosition.xyz += GetMaterialWorldPositionOffset(VertexParameters);

	Position = MulMatrix(ViewProjectionMatrix,WorldPosition);
	FactoryInterpolants = VertexFactoryGetInterpolants(Input, VFIntermediates);
#if WORLD_POS
	PixelPosition = WorldPosition;
#else
	PixelPosition = Position;
#endif

	CameraVectorOrVertexColor = 1;
#if PER_PIXEL_CAMERA_VECTOR
	CameraVectorOrVertexColor = VertexFactoryGetVertexColor(Input, VFIntermediates);
#else
	CameraVectorOrVertexColor.xyz = VertexFactoryWorldToTangentSpace(Input,VFIntermediates,TangentBasis,CameraPosition.xyz - WorldPosition.xyz * CameraPosition.w);
#endif
}
