You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
20 lines
748 B
Plaintext
20 lines
748 B
Plaintext
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
VelocityCommon.usf: Common functions for calculating velocity vectors.
|
|
=============================================================================*/
|
|
|
|
#pragma once
|
|
|
|
float2 Calculate2DVelocity(float4 PackedVelocityA, float4 PackedVelocityC)
|
|
{
|
|
float2 ScreenPos = PackedVelocityA.xy / PackedVelocityA.w - ResolvedView.ViewToClip[2].xy;
|
|
float2 PrevScreenPos = PackedVelocityC.xy / PackedVelocityC.w - ResolvedView.PrevProjection[2].xy;
|
|
|
|
// 2d velocity, includes camera an object motion
|
|
float2 Velocity = ScreenPos - PrevScreenPos;
|
|
|
|
// Make sure not to touch 0,0 which is clear color
|
|
return Velocity;
|
|
}
|