本文整理汇总了C++中FViewInfo::IsPerspectiveProjection方法的典型用法代码示例。如果您正苦于以下问题:C++ FViewInfo::IsPerspectiveProjection方法的具体用法?C++ FViewInfo::IsPerspectiveProjection怎么用?C++ FViewInfo::IsPerspectiveProjection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FViewInfo
的用法示例。
在下文中一共展示了FViewInfo::IsPerspectiveProjection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BuildVisibleDecalList
void FDecalRendering::BuildVisibleDecalList(const FScene& Scene, const FViewInfo& View, EDecalRenderStage DecalRenderStage, FTransientDecalRenderDataList& OutVisibleDecals)
{
QUICK_SCOPE_CYCLE_COUNTER(BuildVisibleDecalList);
OutVisibleDecals.Empty(Scene.Decals.Num());
const float FadeMultiplier = CVarDecalFadeScreenSizeMultiplier.GetValueOnRenderThread();
const EShaderPlatform ShaderPlatform = View.GetShaderPlatform();
const bool bIsPerspectiveProjection = View.IsPerspectiveProjection();
// Build a list of decals that need to be rendered for this view in SortedDecals
for (const FDeferredDecalProxy* DecalProxy : Scene.Decals)
{
bool bIsShown = true;
if (!DecalProxy->IsShown(&View))
{
bIsShown = false;
}
const FMatrix ComponentToWorldMatrix = DecalProxy->ComponentTrans.ToMatrixWithScale();
// can be optimized as we test against a sphere around the box instead of the box itself
const float ConservativeRadius = FMath::Sqrt(
ComponentToWorldMatrix.GetScaledAxis(EAxis::X).SizeSquared() +
ComponentToWorldMatrix.GetScaledAxis(EAxis::Y).SizeSquared() +
ComponentToWorldMatrix.GetScaledAxis(EAxis::Z).SizeSquared());
// can be optimized as the test is too conservative (sphere instead of OBB)
if(ConservativeRadius < SMALL_NUMBER || !View.ViewFrustum.IntersectSphere(ComponentToWorldMatrix.GetOrigin(), ConservativeRadius))
{
bIsShown = false;
}
if (bIsShown)
{
FTransientDecalRenderData Data(Scene, DecalProxy, ConservativeRadius);
// filter out decals with blend modes that are not supported on current platform
if (IsBlendModeSupported(ShaderPlatform, Data.DecalBlendMode))
{
if (bIsPerspectiveProjection && Data.DecalProxy->Component->FadeScreenSize != 0.0f)
{
float Distance = (View.ViewMatrices.ViewOrigin - ComponentToWorldMatrix.GetOrigin()).Size();
float Radius = ComponentToWorldMatrix.GetMaximumAxisScale();
float CurrentScreenSize = ((Radius / Distance) * FadeMultiplier);
// fading coefficient needs to increase with increasing field of view and decrease with increasing resolution
// FadeCoeffScale is an empirically determined constant to bring us back roughly to fraction of screen size for FadeScreenSize
const float FadeCoeffScale = 600.0f;
float FOVFactor = ((2.0f/View.ViewMatrices.ProjMatrix.M[0][0]) / View.ViewRect.Width()) * FadeCoeffScale;
float FadeCoeff = Data.DecalProxy->Component->FadeScreenSize * FOVFactor;
float FadeRange = FadeCoeff * 0.5f;
float Alpha = (CurrentScreenSize - FadeCoeff) / FadeRange;
Data.FadeAlpha = FMath::Min(Alpha, 1.0f);
}
EDecalRenderStage LocalDecalRenderStage = FDecalRenderingCommon::ComputeRenderStage(ShaderPlatform, Data.DecalBlendMode);
// we could do this test earlier to avoid the decal intersection but getting DecalBlendMode also costs
if (View.Family->EngineShowFlags.ShaderComplexity || (DecalRenderStage == LocalDecalRenderStage && Data.FadeAlpha>0.0f) )
{
OutVisibleDecals.Add(Data);
}
}
}
}
if (OutVisibleDecals.Num() > 0)
{
// Sort by sort order to allow control over composited result
// Then sort decals by state to reduce render target switches
// Also sort by component since Sort() is not stable
struct FCompareFTransientDecalRenderData
{
FORCEINLINE bool operator()(const FTransientDecalRenderData& A, const FTransientDecalRenderData& B) const
{
if (B.DecalProxy->SortOrder != A.DecalProxy->SortOrder)
{
return A.DecalProxy->SortOrder < B.DecalProxy->SortOrder;
}
// bHasNormal here is more important then blend mode because we want to render every decals that output normals before those that read normal.
if (B.bHasNormal != A.bHasNormal)
{
return B.bHasNormal < A.bHasNormal; // < so that those outputting normal are first.
}
if (B.DecalBlendMode != A.DecalBlendMode)
{
return (int32)B.DecalBlendMode < (int32)A.DecalBlendMode;
}
// Batch decals with the same material together
if (B.MaterialProxy != A.MaterialProxy)
{
return B.MaterialProxy < A.MaterialProxy;
}
return (PTRINT)B.DecalProxy->Component < (PTRINT)A.DecalProxy->Component;
}
};
//.........这里部分代码省略.........