You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
42 lines
1.3 KiB
Plaintext
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);
|
|
}
|