Files
UnrealEngineUWP/Engine/Plugins/FX/ExampleCustomDataInterface/Shaders/Private/NiagaraDataInterfaceMousePosition.ush
Stu McKenna 667991930e - Convert example mouse data interface to parameter bindings
#rb michael.galetzka
#jira none
#preflight 6273ee308f7e356c032703cc

[CL 20059140 by Stu McKenna in ue5-main branch]
2022-05-05 12:05:23 -04:00

21 lines
629 B
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
// when using a template ush file, we need the _{ParameterName} appendix on global functions and parameters, because the template can be included multiple times for different data interfaces in a system.
float4 {ParameterName}_MousePosition;
void GetMousePosition_{ParameterName}(in bool In_Normalized, out float Out_PosX, out float Out_PosY)
{
float4 DIPosition = {ParameterName}_MousePosition;
if (In_Normalized)
{
Out_PosX = DIPosition.x / DIPosition.z;
Out_PosY = DIPosition.y / DIPosition.w;
}
else
{
Out_PosX = DIPosition.x;
Out_PosY = DIPosition.y;
}
}