Files
UnrealEngineUWP/Engine/Shaders/LocalVertexFactoryCommon.usf
Matthew Griffin 6c75b4032c Merging //UE4/Release-4.11 to //UE4/Main (up to CL#2835147)
==========================
MAJOR FEATURES + CHANGES
==========================

Change 2817214 on 2016/01/06 by mason.seay
	Adjusted Walkable Slope Override for mesh

	#jira UE-24473

Change 2817384 on 2016/01/06 by Michael.Schoell
	Crash fix when selecting a variable node for a variable that is not owned by a Blueprint.

	#jira UE-24958 - Crash when getting the sequence player in level blueprint

Change 2817438 on 2016/01/06 by Max.Chen

	Sequencer: Add option to specify position of material name from the movie scene capture interface. For example, MovieCapture_{material}_{width}x{height}.{frame} will create files like this: MovieCapture_FinalImage_1920x1080.0010.exr

	#rb Andrew.Rodham
	#jira UE-24926

Change 2817459 on 2016/01/06 by Marc.Audy

	 PR #1679: Move MinRespawnDelay to virtual method AController::GetMinRespawnDelay() (Contributed by bozaro)
	#jira UE-22309

Change 2817472 on 2016/01/06 by Ben.Marsh

	Always run UHT in unattended mode from UBT; we don't want it opening any dialogs. Match3 is currently missing a plugin, and it's causing builds to time out.

Change 2817473 on 2016/01/06 by Marc.Audy

	 PR #1644: Improve "SpawnActor failed because the spawned actor IsPendingKill" error message (Contributed by slonopotamus)
	#jira UE-21911

Change 2817533 on 2016/01/06 by Lauren.Ridge

	Fixing Match3 not compiling in Debug (removed two checks on TileLibrary)

	#jira UE-25004

Change 2817625 on 2016/01/06 by Taizyd.Korambayil

	#jira UE-19659 Reimported Template Animations with Proper Skeletons

Change 2817647 on 2016/01/06 by Lukasz.Furman

	replaced ensure during initialization of blackboard based behavior tree task with log warning
	#ue4
	#jira UE-24448
	#rb Mieszko.Zielinski

Change 2817648 on 2016/01/06 by Lukasz.Furman

	fixed broken rendering component of navmesh actor after delete-undo operation
	#ue4
	#jira UE-24446
	#rb Mieszko.Zielinski

Change 2817688 on 2016/01/06 by Taizyd.Korambayil

	#jira UE-22347 Fixed Message Warnings on Startup

Change 2817815 on 2016/01/06 by Jamie.Dale

	Multiple fixes when editing right-to-left text

	- Text is now shaped over the entire line to allow rich-text and selected text to be shaped correctly across block boundaries.
	- Text layout highlights are now able to correctly handle bi-directional and right-to-left text.
	- Text picking can now handle bi-directional and right-to-left text.
	- Text picking can now pick the individual characters that make up a ligature glyph.
	- The caret now draws on the logical (rather than visual) side of the glyph (to handle right-to-left text).
	- Glyph clusters (multiple glyphs produced from a single character) are now treated as a single logical glyph.
	- Optimized some of the FShapedGlyphSequence to allow an early out once they've found and processed the start and end glyphs.

	#jira UE-25013

Change 2817828 on 2016/01/06 by Nick.Darnell

	Editor - Fixing the OpenLauncher call to be take a structure to allow us to customize it more, and to properly handle the silent command the way we're planning to handle it in the launcher.

	#jira UE-24563

Change 2818052 on 2016/01/06 by Nick.Darnell

	Editor - Adding another application check for the launcher to catch the current app name on mac.

	#jira UE-24563

Change 2818149 on 2016/01/06 by Taizyd.Korambayil

	#jira UE-19097 Adjusted FirstPerson Pawn, so that Camera doesnt clip the Arm Mesh

Change 2818360 on 2016/01/06 by Chris.Babcock

	Fix reading from ini sections not cached after build system changes for 4.11
	#jira UE-25027
	#ue4
	#android

Change 2818369 on 2016/01/06 by Ryan.Vance

	#jira UE-24976
	Adding tessellation support to instanced stereo

Change 2818999 on 2016/01/07 by Robert.Manuszewski

	UHT will no longer try to load game-only plugins.

	#jira UE-25032

	- Changed module type RuntimeNoProgram to RuntimeAndProgram so that bu default Runtime plugin modules won't be loaded by programs
	- Added better error message when UHT's PreInit fails

Change 2819064 on 2016/01/07 by Richard.Hinckley

	#jira UE-24694
	Fixing array usage in 4.11 stream.

Change 2819067 on 2016/01/07 by Ori.Cohen

	When editor tries to spawn a physics asset we automatically load the needed skeletal mesh

	#rb Matt.K
	#JIRA UE-24165
2016-01-22 08:13:18 -05:00

252 lines
7.0 KiB
Plaintext

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
LocalVertexFactoryCommon.usf: Local vertex factory common functionality
=============================================================================*/
// FVertexFactoryInterpolantsVSToPS is split into a PC and ES2 version, since the ES2 version has more restrictions on packing
// Then accessors are provided for each property which try to encapsulate the packing differences
#if FEATURE_LEVEL >= FEATURE_LEVEL_ES3_1
struct FVertexFactoryInterpolantsVSToPS
{
TANGENTTOWORLD_INTERPOLATOR_BLOCK
#if INTERPOLATE_VERTEX_COLOR
half4 Color : COLOR0;
#endif
#if USE_INSTANCING
// x = per-instance random, y = per-instance fade out amount, z = hide/show flag, w dither fade cutoff
float4 PerInstanceParams : COLOR1;
#endif
#if NUM_MATERIAL_TEXCOORDS
float4 TexCoords[(NUM_MATERIAL_TEXCOORDS+1)/2] : TEXCOORD0;
#elif USE_PARTICLE_SUBUVS
float4 TexCoords[1] : TEXCOORD0;
#endif
#if NEEDS_LIGHTMAP_COORDINATE
float4 LightMapCoordinate : TEXCOORD4;
#endif
#if INSTANCED_STEREO
nointerpolation uint PackedEyeIndex : PACKED_EYE_INDEX;
#endif
};
#if NUM_MATERIAL_TEXCOORDS || USE_PARTICLE_SUBUVS
float2 GetUV(FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex)
{
float4 UVVector = Interpolants.TexCoords[UVIndex / 2];
return UVIndex % 2 ? UVVector.zw : UVVector.xy;
}
void SetUV(inout FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex, float2 InValue)
{
FLATTEN
if (UVIndex % 2)
{
Interpolants.TexCoords[UVIndex / 2].zw = InValue;
}
else
{
Interpolants.TexCoords[UVIndex / 2].xy = InValue;
}
}
#endif
float4 GetColor(FVertexFactoryInterpolantsVSToPS Interpolants)
{
#if INTERPOLATE_VERTEX_COLOR
return Interpolants.Color;
#else
return 0;
#endif
}
void SetColor(inout FVertexFactoryInterpolantsVSToPS Interpolants, float4 InValue)
{
#if INTERPOLATE_VERTEX_COLOR
Interpolants.Color = InValue;
#endif
}
#if NEEDS_LIGHTMAP_COORDINATE
void GetLightMapCoordinates(FVertexFactoryInterpolantsVSToPS Interpolants, out float2 LightmapUV0, out float2 LightmapUV1)
{
LightmapUV0 = Interpolants.LightMapCoordinate.xy * float2( 1, 0.5 );
LightmapUV1 = LightmapUV0 + float2( 0, 0.5 );
}
float2 GetShadowMapCoordinate(FVertexFactoryInterpolantsVSToPS Interpolants)
{
return Interpolants.LightMapCoordinate.zw;
}
void SetLightMapCoordinate(inout FVertexFactoryInterpolantsVSToPS Interpolants, float2 InLightMapCoordinate, float2 InShadowMapCoordinate)
{
Interpolants.LightMapCoordinate.xy = InLightMapCoordinate;
Interpolants.LightMapCoordinate.zw = InShadowMapCoordinate;
}
#endif
float4 GetTangentToWorld2(FVertexFactoryInterpolantsVSToPS Interpolants)
{
return Interpolants.TangentToWorld2;
}
float4 GetTangentToWorld0(FVertexFactoryInterpolantsVSToPS Interpolants)
{
return Interpolants.TangentToWorld0;
}
void SetTangents(inout FVertexFactoryInterpolantsVSToPS Interpolants, float3 InTangentToWorld0, float3 InTangentToWorld2, float InTangentToWorldSign)
{
Interpolants.TangentToWorld0 = float4(InTangentToWorld0,0);
Interpolants.TangentToWorld2 = float4(InTangentToWorld2,InTangentToWorldSign);
}
#else // #if FEATURE_LEVEL >= FEATURE_LEVEL_ES3_1
#define NUM_PACKED_UVS (NUM_MATERIAL_TEXCOORDS > 1 ? 3 : 1)
#define USE_INTERPOLATOR_345 ((!MATERIAL_SHADINGMODEL_UNLIT) || USES_TRANSFORM_VECTOR || USES_DISTORTION)
/** Interpolants packed for ES2. All UVs are in the xy to ensure independent texture fetches. */
struct FVertexFactoryInterpolantsVSToPS
{
// Save one interpolator if the material is only using one UV
#if NUM_PACKED_UVS == 1
// UV0, normal xy
float4 PackedUVs[1] : TEXCOORD0;
#if INTERPOLATE_VERTEX_COLOR
// Only interpolate vertex color if needed by the material pixel shader
float4 Color : TEXCOORD1;
#endif
#else
// UV0, normal xy
// UV1, color xy
// UV2, color zw
float4 PackedUVs[3] : TEXCOORD0;
#endif
#if USE_INTERPOLATOR_345
// LightmapUV0, normal zw
float4 PackedInterpolator3 : TEXCOORD3;
// LightmapUV1, tangent xy
float4 PackedInterpolator4 : TEXCOORD4;
// ShadowmapUV, tangent zw
float4 PackedInterpolator5 : TEXCOORD5;
#endif
#if USE_INSTANCING
// x = per-instance random, y = per-instance fade out amount, z = hide/show flag, w dither fade cutoff
float4 PerInstanceParams : COLOR1;
#endif
#if INSTANCED_STEREO
nointerpolation uint PackedEyeIndex : PACKED_EYE_INDEX;
#endif
};
float2 GetUV(FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex)
{
return Interpolants.PackedUVs[UVIndex].xy;
}
void SetUV(inout FVertexFactoryInterpolantsVSToPS Interpolants, int UVIndex, float2 InValue)
{
Interpolants.PackedUVs[UVIndex].xy = InValue;
}
float4 GetColor(FVertexFactoryInterpolantsVSToPS Interpolants)
{
#if NUM_PACKED_UVS == 1
#if INTERPOLATE_VERTEX_COLOR
return Interpolants.Color;
#else
return 0;
#endif
#else
return float4(Interpolants.PackedUVs[1].zw, Interpolants.PackedUVs[2].zw);
#endif
}
void SetColor(inout FVertexFactoryInterpolantsVSToPS Interpolants, float4 InValue)
{
#if NUM_PACKED_UVS == 1
#if INTERPOLATE_VERTEX_COLOR
Interpolants.Color = InValue;
#endif
#else
Interpolants.PackedUVs[1].zw = InValue.xy;
Interpolants.PackedUVs[2].zw = InValue.zw;
#endif
}
void GetLightMapCoordinates(FVertexFactoryInterpolantsVSToPS Interpolants, out float2 LightmapUV0, out float2 LightmapUV1)
{
#if USE_INTERPOLATOR_345
LightmapUV0 = Interpolants.PackedInterpolator3.xy;
LightmapUV1 = Interpolants.PackedInterpolator4.xy;
#else
LightmapUV0 = LightmapUV1 = 0;
#endif
}
float2 GetShadowMapCoordinate(FVertexFactoryInterpolantsVSToPS Interpolants)
{
#if USE_INTERPOLATOR_345
return Interpolants.PackedInterpolator5.xy;
#else
return float2(0, 0);
#endif
}
void SetLightMapCoordinate(inout FVertexFactoryInterpolantsVSToPS Interpolants, float2 InLightMapCoordinate, float2 InShadowMapCoordinate)
{
#if USE_INTERPOLATOR_345
Interpolants.PackedInterpolator3.xy = InLightMapCoordinate * float2(1, 0.5);
Interpolants.PackedInterpolator4.xy = Interpolants.PackedInterpolator3.xy + float2(0, 0.5);
Interpolants.PackedInterpolator5.xy = InShadowMapCoordinate;
#endif
}
float4 GetTangentToWorld2(FVertexFactoryInterpolantsVSToPS Interpolants)
{
#if USE_INTERPOLATOR_345
return float4(Interpolants.PackedUVs[0].zw, Interpolants.PackedInterpolator3.zw);
#else
return float4(0, 0, 0, 1);
#endif
}
float4 GetTangentToWorld0(FVertexFactoryInterpolantsVSToPS Interpolants)
{
#if USE_INTERPOLATOR_345
return float4(Interpolants.PackedInterpolator4.zw, Interpolants.PackedInterpolator5.zw);
#else
return float4(0, 0, 0, 0);
#endif
}
void SetTangents(inout FVertexFactoryInterpolantsVSToPS Interpolants, float3 InTangentToWorld0, float3 InTangentToWorld2, float InTangentToWorldSign)
{
#if USE_INTERPOLATOR_345
Interpolants.PackedInterpolator4.zw = InTangentToWorld0.xy;
Interpolants.PackedInterpolator5.zw = InTangentToWorld0.zz;
Interpolants.PackedUVs[0].zw = InTangentToWorld2.xy;
Interpolants.PackedInterpolator3.zw = float2(InTangentToWorld2.z,InTangentToWorldSign);
#else
Interpolants.PackedUVs[0].zw = 0;
#endif
}
#endif