Files
UnrealEngineUWP/Engine/Shaders/Private/CommonViewUniformBuffer.ush
Marc Audy 360d078ca3 Second batch of remaining Engine copyright updates.
#rnx
#rb none

[CL 10871248 by Marc Audy in Main branch]
2019-12-27 09:26:59 -05:00

42 lines
1.3 KiB
Plaintext

// Copyright 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);
}