Files
UnrealEngineUWP/Engine/Shaders/ParticleCurveInjectionShader.usf
Matthew Griffin bb70b349ce Merging CL 2804086 from //UE4/Release-4.11 to Dev-Main (//UE4/Dev-Main) to isolate copyright update
#lockdown Nick.Penwarden

[CL 2819020 by Matthew Griffin in Main branch]
2016-01-07 08:17:16 -05:00

70 lines
2.0 KiB
Plaintext

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
ParticleCurveInjectionShader.usf: Shaders for uploading curves to the GPU.
=============================================================================*/
#include "Common.usf"
/*-----------------------------------------------------------------------------
Shared declarations and functions.
-----------------------------------------------------------------------------*/
struct FShaderInterpolants
{
/** The curve sample. */
float4 Sample : TEXCOORD0;
};
/*-----------------------------------------------------------------------------
Vertex shader.
-----------------------------------------------------------------------------*/
#if VERTEXSHADER
struct FVertexInput
{
/** The initial position and relative time of the particle. */
float4 Sample : ATTRIBUTE0;
/** The texture coordinate of the corner of the sprite being rendered. */
float2 TexCoord : ATTRIBUTE1;
/** The sample index. */
uint SampleIndex : SV_InstanceID;
};
void VertexMain(
in FVertexInput Input,
out FShaderInterpolants Interpolants,
out float4 OutPosition : SV_POSITION
)
{
float2 TexelCoord = Input.TexCoord.xy * ParticleCurveInjection.PixelScale.xy +
ParticleCurveInjection.CurveOffset.xy;
TexelCoord.x += (float)Input.SampleIndex * ParticleCurveInjection.PixelScale.x;
OutPosition = float4(
TexelCoord.xy * float2(2.0f,-2.0f) + float2(-1.0f,1.0f),
0,
1
);
// Pass sample on to the pixel shader.
Interpolants.Sample = Input.Sample FCOLOR_COMPONENT_SWIZZLE;
}
#endif // #if VERTEXSHADER
/*-----------------------------------------------------------------------------
Pixel shader.
-----------------------------------------------------------------------------*/
#if PIXELSHADER
void PixelMain(
in FShaderInterpolants Interpolants,
out float4 OutSample : SV_Target0
)
{
// Store sample in the texture.
OutSample = Interpolants.Sample;
}
#endif // #if PIXELSHADER