Files
UnrealEngineUWP/Engine/Shaders/Private/CommonViewUniformBuffer.ush
marcus wassmer b259f65406 Copying //UE4/Dev-Rendering[at]4854522 to Dev-Main (//UE4/Dev-Main)
#rb none

#ROBOMERGE-OWNER: ryan.vance
#ROBOMERGE-AUTHOR: marcus.wassmer
#ROBOMERGE-SOURCE: CL 4854553 in //UE4/Main/...
#ROBOMERGE-BOT: DEVVR (Main -> Dev-VR)

[CL 4854570 by marcus wassmer in Dev-VR branch]
2019-01-30 21:24:04 -05:00

42 lines
1.3 KiB
Plaintext

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
CommonViewUniformBuffer.usf: Common view uniform buffer specifics
=============================================================================*/
#pragma once
/*
* @return tan(View.FieldOfViewWideAngles * .5)
*/
float2 GetTanHalfFieldOfView()
{
return float2(View.ClipToView[0][0], View.ClipToView[1][1]);
}
float2 GetPrevTanHalfFieldOfView()
{
return float2(View.PrevClipToView[0][0], View.PrevClipToView[1][1]);
}
// might be used by Custom material expressions (still best to wrap the custom node in a material function)
// @return 1 / tan(View.FieldOfViewWideAngles * .5)
float2 GetCotanHalfFieldOfView()
{
return float2(View.ViewToClip[0][0], View.ViewToClip[1][1]);
}
// might be used by Custom material expressions (still best to wrap the custom node in a material function)
// @return previous 1 / tan(View.FieldOfViewWideAngles * .5)
float2 GetPrevCotanHalfFieldOfView()
{
return float2(View.PrevViewToClip[0][0], View.PrevViewToClip[1][1]);
}
// Return the index of the frame.
uint GetPowerOfTwoModulatedFrameIndex(uint Pow2Modulus)
{
// Bit masking of an uniform parameter is a scalar operation on modern hardware.
return View.StateFrameIndex & uint(Pow2Modulus - 1);
}