/*============================================================================= Copyright 1998-2007 Epic Games, Inc. All Rights Reserved. =============================================================================*/ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // struct FVertexFactoryInput struct FVertexFactoryInput { float4 Position : POSITION; half3 TangentX : TANGENT; half3 TangentY : BINORMAL; half3 TangentZ : NORMAL; float4 WindInfo : BLENDINDICES; #if NUM_MATERIAL_TEXCOORDS float2 TexCoords[NUM_MATERIAL_TEXCOORDS] : TEXCOORD0; #endif float LODHint : TEXCOORD1; #if NEEDS_VERTEX_LIGHTMAP float4 LightMapA : TEXCOORD5; float4 LightMapB : TEXCOORD6; float4 LightMapC : TEXCOORD7; #elif NEEDS_SIMPLE_VERTEX_LIGHTMAP float4 LightMapA : TEXCOORD5; #endif }; #include "SpeedTreeVertexFactoryBase.usf" ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CalcWorldPosition float4 CalcWorldPosition(float4x4 Transform, FVertexFactoryInput Input) { return MulMatrix(Transform, WindEffect(Input.Position, Input.WindInfo)); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // VertexFactoryGetWorldPosition float4 VertexFactoryGetWorldPosition(FVertexFactoryInput Input, out FVertexFactoryInterpolants Interpolants) { VertexFactoryGetWorldPositionBase(Input, Interpolants); return CalcWorldPosition(LocalToWorld, Input); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // VertexFactoryGetWorldPosition (for depth-only pass) float4 VertexFactoryGetWorldPositionOnly(FVertexFactoryInput Input) { return CalcWorldPosition(LocalToWorld, Input); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // VertexFactoryGetPreviousWorldPosition float4 VertexFactoryGetPreviousWorldPosition(FVertexFactoryInput Input, out FVertexFactoryInterpolants Interpolants) { VertexFactoryGetWorldPositionBase(Input, Interpolants); return CalcWorldPosition(PreviousLocalToWorld, Input); } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // GetWorldTangentBasis half3x3 GetWorldTangentBasis(FVertexFactoryInput Input) { // WindEffect also rotates the tangent vectors into world-space. return half3x3( WindEffect(half4(TangentBias(Input.TangentX.xyz),0),Input.WindInfo).xyz, WindEffect(half4(TangentBias(Input.TangentY.xyz),0),Input.WindInfo).xyz, WindEffect(half4(TangentBias(Input.TangentZ.xyz),0),Input.WindInfo).xyz ); }