本文整理汇总了C++中TAutoConsoleVariable类的典型用法代码示例。如果您正苦于以下问题:C++ TAutoConsoleVariable类的具体用法?C++ TAutoConsoleVariable怎么用?C++ TAutoConsoleVariable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TAutoConsoleVariable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetParameters
void SetParameters(const FRenderingCompositePassContext& Context)
{
const FPixelShaderRHIParamRef ShaderRHI = GetPixelShader();
FGlobalShader::SetParameters(Context.RHICmdList, ShaderRHI, Context.View);
DeferredParameters.Set(Context.RHICmdList, ShaderRHI, Context.View);
{
bool bFiltered = false;
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
bFiltered = CVarMotionBlurFiltering.GetValueOnRenderThread() != 0;
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if(bFiltered)
{
//PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Bilinear,AM_Border,AM_Border,AM_Clamp>::GetRHI());
FSamplerStateRHIParamRef Filters[] =
{
TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
};
PostprocessParameter.SetPS( ShaderRHI, Context, 0, false, Filters );
}
else if( CVarMotionBlurSmoothMax.GetValueOnRenderThread() )
{
FSamplerStateRHIParamRef Filters[] =
{
TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(),
};
PostprocessParameter.SetPS( ShaderRHI, Context, 0, false, Filters );
}
else
{
PostprocessParameter.SetPS(ShaderRHI, Context, TStaticSamplerState<SF_Point,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI());
}
}
TRefCountPtr<IPooledRenderTarget> InputPooledElement = Context.Pass->GetInput(ePId_Input0)->GetOutput()->RequestInput();
{
const float SizeX = Context.View.ViewRect.Width();
const float SizeY = Context.View.ViewRect.Height();
const float AspectRatio = SizeX / SizeY;
const float InvAspectRatio = SizeY / SizeX;
const FSceneViewState* ViewState = (FSceneViewState*) Context.View.State;
const float MotionBlurTimeScale = ViewState ? ViewState->MotionBlurTimeScale : 1.0f;
const float ViewMotionBlurScale = 0.5f * MotionBlurTimeScale * Context.View.FinalPostProcessSettings.MotionBlurAmount;
// 0:no 1:full screen width
float MaxVelocity = Context.View.FinalPostProcessSettings.MotionBlurMax / 100.0f;
float InvMaxVelocity = 1.0f / MaxVelocity;
// *2 to convert to -1..1 -1..1 screen space
// / MaxFraction to map screenpos to -1..1 normalized MaxFraction
FVector4 MotionBlurParametersValue(
ViewMotionBlurScale,
AspectRatio,
MaxVelocity,
InvMaxVelocity);
SetShaderValue(Context.RHICmdList, ShaderRHI, MotionBlurParameters, MotionBlurParametersValue);
}
}
示例2: Process
void FRCPassPostProcessSubsurfaceExtractSpecular::Process(FRenderingCompositePassContext& Context)
{
const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0);
check(InputDesc);
const FSceneView& View = Context.View;
const FSceneViewFamily& ViewFamily = *(View.Family);
FIntPoint SrcSize = InputDesc->Extent;
FIntPoint DestSize = PassOutputs[0].RenderTargetDesc.Extent;
check(DestSize.X);
check(DestSize.Y);
check(SrcSize.X);
check(SrcSize.Y);
// FIntRect SrcRect = View.ViewRect / ScaleFactor;
FIntRect SrcRect = View.ViewRect;
FIntRect DestRect = View.ViewRect;
TRefCountPtr<IPooledRenderTarget> NewSceneColor;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
// Set the view family's render target/viewport.
SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef());
Context.SetViewportAndCallRHI(0, 0, 0.0f, DestSize.X, DestSize.Y, 1.0f );
Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI());
Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI());
Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI());
TShaderMapRef<FPostProcessVS> VertexShader(Context.GetShaderMap());
bool bDoSpecularCorrection = DoSpecularCorrection();
SCOPED_DRAW_EVENTF(Context.RHICmdList, SubsurfacePass, TEXT("SubsurfacePassExtractSpecular#%d"), (int32)bDoSpecularCorrection);
uint32 SampleSet = FMath::Clamp(CVarSSSSampleSet.GetValueOnRenderThread(), 0, 2);
if(bDoSpecularCorrection)
{
SetSubsurfaceExtractSpecular<1>(Context, SampleSet);
}
else
{
SetSubsurfaceExtractSpecular<0>(Context, SampleSet);
}
DrawRectangle(
Context.RHICmdList,
DestRect.Min.X, DestRect.Min.Y,
DestRect.Width(), DestRect.Height(),
SrcRect.Min.X, SrcRect.Min.Y,
SrcRect.Width(), SrcRect.Height(),
DestSize,
SrcSize,
*VertexShader,
EDRF_UseTriangleOptimization);
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams());
}
示例3: ScreenSpaceReflections
void ScreenSpaceReflections(FRHICommandListImmediate& RHICmdList, FViewInfo& View, TRefCountPtr<IPooledRenderTarget>& SSROutput)
{
BuildHZB(RHICmdList, View);
FRenderingCompositePassContext CompositeContext(RHICmdList, View);
FPostprocessContext Context( CompositeContext.Graph, View );
FSceneViewState* ViewState = (FSceneViewState*)Context.View.State;
FRenderingCompositePass* SceneColorInput = Context.Graph.RegisterPass( new FRCPassPostProcessInput( GSceneRenderTargets.GetSceneColor() ) );
FRenderingCompositePass* HZBInput = Context.Graph.RegisterPass( new FRCPassPostProcessInput( ViewState->HZB.Texture ) );
bool bPrevFrame = 0;
if( ViewState && ViewState->TemporalAAHistoryRT && !Context.View.bCameraCut )
{
SceneColorInput = Context.Graph.RegisterPass( new FRCPassPostProcessInput( ViewState->TemporalAAHistoryRT ) );
bPrevFrame = 1;
}
{
FRenderingCompositePass* TracePass = Context.Graph.RegisterPass( new FRCPassPostProcessScreenSpaceReflections( bPrevFrame ) );
TracePass->SetInput( ePId_Input0, SceneColorInput );
TracePass->SetInput( ePId_Input1, HZBInput );
Context.FinalOutput = FRenderingCompositeOutputRef( TracePass );
}
const bool bTemporalFilter = View.FinalPostProcessSettings.AntiAliasingMethod != AAM_TemporalAA || CVarSSRTemporal.GetValueOnRenderThread() != 0;
if( ViewState && bTemporalFilter )
{
{
FRenderingCompositeOutputRef HistoryInput;
if( ViewState && ViewState->SSRHistoryRT && !Context.View.bCameraCut )
{
HistoryInput = Context.Graph.RegisterPass( new FRCPassPostProcessInput( ViewState->SSRHistoryRT ) );
}
else
{
// No history, use black
HistoryInput = Context.Graph.RegisterPass(new FRCPassPostProcessInput(GSystemTextures.BlackDummy));
}
FRenderingCompositePass* TemporalAAPass = Context.Graph.RegisterPass( new FRCPassPostProcessSSRTemporalAA );
TemporalAAPass->SetInput( ePId_Input0, Context.FinalOutput );
TemporalAAPass->SetInput( ePId_Input1, HistoryInput );
//TemporalAAPass->SetInput( ePId_Input2, VelocityInput );
Context.FinalOutput = FRenderingCompositeOutputRef( TemporalAAPass );
}
if( ViewState )
{
FRenderingCompositePass* HistoryOutput = Context.Graph.RegisterPass( new FRCPassPostProcessOutput( &ViewState->SSRHistoryRT ) );
HistoryOutput->SetInput( ePId_Input0, Context.FinalOutput );
Context.FinalOutput = FRenderingCompositeOutputRef( HistoryOutput );
}
}
{
FRenderingCompositePass* ReflectionOutput = Context.Graph.RegisterPass( new FRCPassPostProcessOutput( &SSROutput ) );
ReflectionOutput->SetInput( ePId_Input0, Context.FinalOutput );
Context.FinalOutput = FRenderingCompositeOutputRef( ReflectionOutput );
}
CompositeContext.Root->AddDependency( Context.FinalOutput );
CompositeContext.Process(TEXT("ReflectionEnvironments"));
}
示例4: RenderForwardShadingBasePass
void FForwardShadingSceneRenderer::RenderForwardShadingBasePass(FRHICommandListImmediate& RHICmdList)
{
SCOPED_DRAW_EVENT(RHICmdList, BasePass, DEC_SCENE_ITEMS);
SCOPE_CYCLE_COUNTER(STAT_BasePassDrawTime);
EBasePassSort::Type SortMode = GetSortMode();
int32 MaxDraws = GMaxBasePassDraws.GetValueOnRenderThread();
if (MaxDraws <= 0)
{
MaxDraws = MAX_int32;
}
if (SortMode == EBasePassSort::SortStateBuckets)
{
SCOPE_CYCLE_COUNTER(STAT_SortStaticDrawLists);
for (int32 DrawType = 0; DrawType < FScene::EBasePass_MAX; DrawType++)
{
Scene->BasePassForForwardShadingLowQualityLightMapDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation);
Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation);
Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation);
Scene->BasePassForForwardShadingMovableDirectionalLightCSMDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation);
Scene->BasePassForForwardShadingMovableDirectionalLightDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation);
Scene->BasePassForForwardShadingNoLightMapDrawList[DrawType].SortFrontToBack(Views[0].ViewLocation);
}
}
// Draw the scene's emissive and light-map color.
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
SCOPED_CONDITIONAL_DRAW_EVENTF(RHICmdList, EventView, Views.Num() > 1, DEC_SCENE_ITEMS, TEXT("View%d"), ViewIndex);
FViewInfo& View = Views[ViewIndex];
// Opaque blending
RHICmdList.SetBlendState(TStaticBlendStateWriteMask<CW_RGBA>::GetRHI());
// Note, this is a reversed Z depth surface, using CF_GreaterEqual.
RHICmdList.SetDepthStencilState(TStaticDepthStencilState<true, CF_GreaterEqual>::GetRHI());
RHICmdList.SetViewport(View.ViewRect.Min.X, View.ViewRect.Min.Y, 0, View.ViewRect.Max.X, View.ViewRect.Max.Y, 1);
{
// Render the base pass static data
if (SortMode == EBasePassSort::SortPerMesh)
{
SCOPE_CYCLE_COUNTER(STAT_StaticDrawListDrawTime);
MaxDraws -= Scene->BasePassForForwardShadingLowQualityLightMapDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility, MaxDraws);
MaxDraws -= Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility, MaxDraws);
MaxDraws -= Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility, MaxDraws);
MaxDraws -= Scene->BasePassForForwardShadingMovableDirectionalLightCSMDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility, MaxDraws);
MaxDraws -= Scene->BasePassForForwardShadingMovableDirectionalLightDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility, MaxDraws);
MaxDraws -= Scene->BasePassForForwardShadingNoLightMapDrawList[FScene::EBasePass_Default].DrawVisibleFrontToBack(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility, MaxDraws);
}
else
{
SCOPE_CYCLE_COUNTER(STAT_StaticDrawListDrawTime);
Scene->BasePassForForwardShadingLowQualityLightMapDrawList[FScene::EBasePass_Default].DrawVisible(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility);
Scene->BasePassForForwardShadingDistanceFieldShadowMapLightMapDrawList[FScene::EBasePass_Default].DrawVisible(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility);
Scene->BasePassForForwardShadingDirectionalLightAndSHIndirectDrawList[FScene::EBasePass_Default].DrawVisible(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility);
Scene->BasePassForForwardShadingMovableDirectionalLightCSMDrawList[FScene::EBasePass_Default].DrawVisible(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility);
Scene->BasePassForForwardShadingMovableDirectionalLightDrawList[FScene::EBasePass_Default].DrawVisible(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility);
Scene->BasePassForForwardShadingNoLightMapDrawList[FScene::EBasePass_Default].DrawVisible(RHICmdList, View, View.StaticMeshVisibilityMap, View.StaticMeshBatchVisibility);
}
}
{
SCOPE_CYCLE_COUNTER(STAT_DynamicPrimitiveDrawTime);
SCOPED_DRAW_EVENT(RHICmdList, Dynamic, DEC_SCENE_ITEMS);
const bool bUseGetMeshElements = ShouldUseGetDynamicMeshElements();
if (bUseGetMeshElements)
{
FBasePassForwardOpaqueDrawingPolicyFactory::ContextType Context(ESceneRenderTargetsMode::DontSet);
for (int32 MeshBatchIndex = 0; MeshBatchIndex < View.DynamicMeshElements.Num(); MeshBatchIndex++)
{
const FMeshBatchAndRelevance& MeshBatchAndRelevance = View.DynamicMeshElements[MeshBatchIndex];
if (MeshBatchAndRelevance.bHasOpaqueOrMaskedMaterial || ViewFamily.EngineShowFlags.Wireframe)
{
const FMeshBatch& MeshBatch = *MeshBatchAndRelevance.Mesh;
FBasePassForwardOpaqueDrawingPolicyFactory::DrawDynamicMesh(RHICmdList, View, Context, MeshBatch, false, true, MeshBatchAndRelevance.PrimitiveSceneProxy, MeshBatch.BatchHitProxyId);
}
}
View.SimpleElementCollector.DrawBatchedElements(RHICmdList, View, NULL, EBlendModeFilter::OpaqueAndMasked);
}
else if (View.VisibleDynamicPrimitives.Num() > 0)
{
// Draw the dynamic non-occluded primitives using a base pass drawing policy.
TDynamicPrimitiveDrawer<FBasePassForwardOpaqueDrawingPolicyFactory> Drawer(RHICmdList, &View, FBasePassForwardOpaqueDrawingPolicyFactory::ContextType(ESceneRenderTargetsMode::DontSet), true);
for (int32 PrimitiveIndex = 0; PrimitiveIndex < View.VisibleDynamicPrimitives.Num(); PrimitiveIndex++)
{
const FPrimitiveSceneInfo* PrimitiveSceneInfo = View.VisibleDynamicPrimitives[PrimitiveIndex];
int32 PrimitiveId = PrimitiveSceneInfo->GetIndex();
const FPrimitiveViewRelevance& PrimitiveViewRelevance = View.PrimitiveViewRelevanceMap[PrimitiveId];
const bool bVisible = View.PrimitiveVisibilityMap[PrimitiveId];
// Only draw the primitive if it's visible
//.........这里部分代码省略.........
示例5: GetContactOffsetParams
void GetContactOffsetParams(float& ContactOffsetFactor, float& MaxContactOffset)
{
// Get contact offset params
ContactOffsetFactor = CVarContactOffsetFactor.GetValueOnGameThread();
MaxContactOffset = CVarMaxContactOffset.GetValueOnGameThread();
}
示例6: InitGamePhys
//////// GAME-LEVEL RIGID BODY PHYSICS STUFF ///////
void InitGamePhys()
{
#if WITH_BOX2D
FPhysicsIntegration2D::InitializePhysics();
#endif
#if WITH_PHYSX
// Do nothing if SDK already exists
if(GPhysXFoundation != NULL)
{
return;
}
// Make sure
LoadPhysXModules();
// Create Foundation
GPhysXAllocator = new FPhysXAllocator();
FPhysXErrorCallback* ErrorCallback = new FPhysXErrorCallback();
GPhysXFoundation = PxCreateFoundation(PX_FOUNDATION_VERSION, *GPhysXAllocator, *ErrorCallback);
check(GPhysXFoundation);
#if PHYSX_MEMORY_STATS
// Want names of PhysX allocations
GPhysXFoundation->setReportAllocationNames(true);
#endif
// Create profile manager
GPhysXVisualDebugger = PxCreatePvd(*GPhysXFoundation);
check(GPhysXVisualDebugger);
// Create Physics
PxTolerancesScale PScale;
PScale.length = CVarToleranceScaleLength.GetValueOnGameThread();
PScale.speed = CVarToleranceScaleSpeed.GetValueOnGameThread();
GPhysXSDK = PxCreatePhysics(PX_PHYSICS_VERSION, *GPhysXFoundation, PScale, false, GPhysXVisualDebugger);
check(GPhysXSDK);
FPhysxSharedData::Initialize();
GPhysCommandHandler = new FPhysCommandHandler();
GPreGarbageCollectDelegateHandle = FCoreUObjectDelegates::PreGarbageCollect.AddRaw(GPhysCommandHandler, &FPhysCommandHandler::Flush);
// Init Extensions
PxInitExtensions(*GPhysXSDK, GPhysXVisualDebugger);
#if WITH_VEHICLE
PxInitVehicleSDK(*GPhysXSDK);
#endif
if (CVarUseUnifiedHeightfield.GetValueOnGameThread())
{
//Turn on PhysX 3.3 unified height field collision detection.
//This approach shares the collision detection code between meshes and height fields such that height fields behave identically to the equivalent terrain created as a mesh.
//This approach facilitates mixing the use of height fields and meshes in the application with no tangible difference in collision behavior between the two approaches except that
//heightfield thickness is not supported for unified heightfields.
PxRegisterUnifiedHeightFields(*GPhysXSDK);
}
else
{
PxRegisterHeightFields(*GPhysXSDK);
}
if( FParse::Param( FCommandLine::Get(), TEXT( "PVD" ) ) )
{
PvdConnect(TEXT("localhost"), true);
}
#if WITH_PHYSICS_COOKING || WITH_RUNTIME_PHYSICS_COOKING
// Create Cooking
PxCookingParams PCookingParams(PScale);
PCookingParams.meshWeldTolerance = 0.1f; // Weld to 1mm precision
PCookingParams.meshPreprocessParams = PxMeshPreprocessingFlags(PxMeshPreprocessingFlag::eWELD_VERTICES);
// Force any cooking in PhysX or APEX to use older incremental hull method
// This is because the new 'quick hull' method can generate degenerate geometry in some cases (very thin meshes etc.)
//PCookingParams.convexMeshCookingType = PxConvexMeshCookingType::eINFLATION_INCREMENTAL_HULL;
PCookingParams.targetPlatform = PxPlatform::ePC;
//PCookingParams.meshCookingHint = PxMeshCookingHint::eCOOKING_PERFORMANCE;
//PCookingParams.meshSizePerformanceTradeOff = 0.0f;
GPhysXCooking = PxCreateCooking(PX_PHYSICS_VERSION, *GPhysXFoundation, PCookingParams);
check(GPhysXCooking);
#endif
#if WITH_APEX
// Build the descriptor for the APEX SDK
apex::ApexSDKDesc ApexDesc;
ApexDesc.foundation = GPhysXFoundation; // Pointer to the PxFoundation
ApexDesc.physXSDK = GPhysXSDK; // Pointer to the PhysXSDK
ApexDesc.cooking = GPhysXCooking; // Pointer to the cooking library
ApexDesc.renderResourceManager = &GApexNullRenderResourceManager; // We will not be using the APEX rendering API, so just use a dummy render resource manager
ApexDesc.resourceCallback = &GApexResourceCallback; // The resource callback is how APEX asks the application to find assets when it needs them
#if PLATFORM_MAC
FString DylibFolder = FPaths::EngineDir() / TEXT("Binaries/ThirdParty/PhysX/");
ANSICHAR* DLLLoadPath = (ANSICHAR*)FMemory::Malloc(DylibFolder.Len() + 1);
FCStringAnsi::Strcpy(DLLLoadPath, DylibFolder.Len() + 1, TCHAR_TO_UTF8(*DylibFolder));
//.........这里部分代码省略.........
示例7: StartFinalPostprocessSettings
void FSceneView::StartFinalPostprocessSettings(FVector InViewLocation)
{
check(IsInGameThread());
// The final settings for the current viewer position (blended together from many volumes).
// Setup by the main thread, passed to the render thread and never touched again by the main thread.
// Set values before any override happens.
FinalPostProcessSettings.SetBaseValues();
// project settings might want to have different defaults
{
if(!CVarDefaultBloom.GetValueOnGameThread())
{
FinalPostProcessSettings.BloomIntensity = 0;
}
if (!CVarDefaultAmbientOcclusion.GetValueOnGameThread())
{
FinalPostProcessSettings.AmbientOcclusionIntensity = 0;
}
if (!CVarDefaultAutoExposure.GetValueOnGameThread())
{
FinalPostProcessSettings.AutoExposureMinBrightness = 1;
FinalPostProcessSettings.AutoExposureMaxBrightness = 1;
}
if (!CVarDefaultMotionBlur.GetValueOnGameThread())
{
FinalPostProcessSettings.MotionBlurAmount = 0;
}
if (!CVarDefaultLensFlare.GetValueOnGameThread())
{
FinalPostProcessSettings.LensFlareIntensity = 0;
}
{
int32 Value = CVarDefaultAntiAliasing.GetValueOnGameThread();
if (Value >= 0 && Value < AAM_MAX)
{
FinalPostProcessSettings.AntiAliasingMethod = (EAntiAliasingMethod)Value;
}
}
{
int32 Value = CVarDefaultAmbientOcclusionStaticFraction.GetValueOnGameThread();
if(!Value)
{
FinalPostProcessSettings.AmbientOcclusionStaticFraction = 0.0f;
}
}
}
if(State)
{
State->OnStartPostProcessing(*this);
}
UWorld* World = Family->Scene->GetWorld();
// Some views have no world (e.g. material preview)
if (World)
{
for (auto VolumeIt = World->PostProcessVolumes.CreateIterator(); VolumeIt; ++VolumeIt)
{
DoPostProcessVolume(*VolumeIt, InViewLocation, this);
}
}
}
示例8: ConvertOverlappedShapeToImpactHit
/** Util to convert an overlapped shape into a sweep hit result, returns whether it was a blocking hit. */
static bool ConvertOverlappedShapeToImpactHit(const UWorld* World, const PxLocationHit& PHit, const FVector& StartLoc, const FVector& EndLoc, FHitResult& OutResult, const PxGeometry& Geom, const PxTransform& QueryTM, const PxFilterData& QueryFilter, bool bReturnPhysMat)
{
SCOPE_CYCLE_COUNTER(STAT_CollisionConvertOverlapToHit);
const PxShape* PShape = PHit.shape;
const PxRigidActor* PActor = PHit.actor;
const uint32 FaceIdx = PHit.faceIndex;
// See if this is a 'blocking' hit
PxFilterData PShapeFilter = PShape->getQueryFilterData();
PxSceneQueryHitType::Enum HitType = FPxQueryFilterCallback::CalcQueryHitType(QueryFilter, PShapeFilter);
const bool bBlockingHit = (HitType == PxSceneQueryHitType::eBLOCK);
OutResult.bBlockingHit = bBlockingHit;
// Time of zero because initially overlapping
OutResult.bStartPenetrating = true;
OutResult.Time = 0.f;
// Return start location as 'safe location'
OutResult.Location = P2UVector(QueryTM.p);
OutResult.ImpactPoint = OutResult.Location; // @todo not really sure of a better thing to do here...
OutResult.TraceStart = StartLoc;
OutResult.TraceEnd = EndLoc;
const bool bFiniteNormal = PHit.normal.isFinite();
const bool bValidNormal = (PHit.flags & PxHitFlag::eNORMAL) && bFiniteNormal;
// Use MTD result if possible. We interpret the MTD vector as both the direction to move and the opposing normal.
if (bValidNormal)
{
OutResult.ImpactNormal = P2UVector(PHit.normal);
OutResult.PenetrationDepth = FMath::Abs(PHit.distance);
}
else
{
// Fallback normal if we can't find it with MTD or otherwise.
OutResult.ImpactNormal = FVector::UpVector;
OutResult.PenetrationDepth = 0.f;
if (!bFiniteNormal)
{
UE_LOG(LogPhysics, Verbose, TEXT("Warning: ConvertOverlappedShapeToImpactHit: MTD returned NaN :( normal: (X:%f, Y:%f, Z:%f)"), PHit.normal.x, PHit.normal.y, PHit.normal.z);
}
}
#if DRAW_OVERLAPPING_TRIS
if (CVarShowInitialOverlaps.GetValueOnAnyThread() != 0 && World && World->IsGameWorld())
{
FVector DummyNormal(0.f);
const PxTransform PShapeWorldPose = PxShapeExt::getGlobalPose(*PShape, *PActor);
FindOverlappedTriangleNormal(World, Geom, QueryTM, PShape, PShapeWorldPose, DummyNormal, 0.f, true);
}
#endif
if (bBlockingHit)
{
// Zero-distance hits are often valid hits and we can extract the hit normal.
// For invalid normals we can try other methods as well (get overlapping triangles).
if (PHit.distance == 0.f || !bValidNormal)
{
const PxTransform PShapeWorldPose = PxShapeExt::getGlobalPose(*PShape, *PActor);
// Try MTD with a small inflation for better accuracy, then a larger one in case the first one fails due to precision issues.
static const float SmallMtdInflation = 0.250f;
static const float LargeMtdInflation = 1.750f;
if (ComputeInflatedMTD(SmallMtdInflation, PHit, OutResult, QueryTM, Geom, PShapeWorldPose) ||
ComputeInflatedMTD(LargeMtdInflation, PHit, OutResult, QueryTM, Geom, PShapeWorldPose))
{
// Success
}
else
{
static const float SmallOverlapInflation = 0.250f;
if (FindOverlappedTriangleNormal(World, Geom, QueryTM, PShape, PShapeWorldPose, OutResult.ImpactNormal, 0.f, false) ||
FindOverlappedTriangleNormal(World, Geom, QueryTM, PShape, PShapeWorldPose, OutResult.ImpactNormal, SmallOverlapInflation, false))
{
// Success
}
else
{
// MTD failed, use point distance. This is not ideal.
// Note: faceIndex seems to be unreliable for convex meshes in these cases, so not using FindGeomOpposingNormal() for them here.
PxGeometry& PGeom = PShape->getGeometry().any();
PxVec3 PClosestPoint;
const float Distance = PxGeometryQuery::pointDistance(QueryTM.p, PGeom, PShapeWorldPose, &PClosestPoint);
if (Distance < KINDA_SMALL_NUMBER)
{
UE_LOG(LogCollision, Verbose, TEXT("Warning: ConvertOverlappedShapeToImpactHit: Query origin inside shape, giving poor MTD."));
PClosestPoint = PxShapeExt::getWorldBounds(*PShape, *PActor).getCenter();
}
OutResult.ImpactNormal = (OutResult.Location - P2UVector(PClosestPoint)).GetSafeNormal();
}
}
}
}
else
//.........这里部分代码省略.........
示例9: EndFinalPostprocessSettings
void FSceneView::EndFinalPostprocessSettings(const FSceneViewInitOptions& ViewInitOptions)
{
{
static const auto CVarMobileMSAA = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.MobileMSAA"));
if(CVarMobileMSAA ? CVarMobileMSAA->GetValueOnGameThread() > 1 : false)
{
// Turn off various features which won't work with mobile MSAA.
FinalPostProcessSettings.DepthOfFieldScale = 0.0f;
FinalPostProcessSettings.AntiAliasingMethod = AAM_None;
}
}
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.BloomQuality"));
int Value = CVar->GetValueOnGameThread();
if(Value <= 0)
{
FinalPostProcessSettings.BloomIntensity = 0.0f;
}
}
if(!Family->EngineShowFlags.Bloom)
{
FinalPostProcessSettings.BloomIntensity = 0.0f;
}
if(!Family->EngineShowFlags.GlobalIllumination)
{
FinalPostProcessSettings.LPVIntensity = 0.0f;
}
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.DepthOfFieldQuality"));
int Value = CVar->GetValueOnGameThread();
if(Value <= 0)
{
FinalPostProcessSettings.DepthOfFieldScale = 0.0f;
}
}
if(!Family->EngineShowFlags.DepthOfField)
{
FinalPostProcessSettings.DepthOfFieldScale = 0;
}
if(!Family->EngineShowFlags.Vignette)
{
FinalPostProcessSettings.VignetteIntensity = 0;
FinalPostProcessSettings.VignetteColor = FLinearColor(0.0f, 0.0f, 0.0f);
}
if(!Family->EngineShowFlags.Grain)
{
FinalPostProcessSettings.GrainIntensity = 0;
FinalPostProcessSettings.GrainJitter = 0;
}
if(!Family->EngineShowFlags.CameraImperfections)
{
FinalPostProcessSettings.BloomDirtMaskIntensity = 0;
}
if(!Family->EngineShowFlags.AmbientCubemap)
{
FinalPostProcessSettings.ContributingCubemaps.Empty();
}
if(!Family->EngineShowFlags.LensFlares)
{
FinalPostProcessSettings.LensFlareIntensity = 0;
}
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
{
float Value = CVarExposureOffset.GetValueOnGameThread();
FinalPostProcessSettings.AutoExposureBias += Value;
}
#endif
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataFloat(TEXT("r.ScreenPercentage"));
float Value = CVar->GetValueOnGameThread();
if(Value >= 0.0)
{
FinalPostProcessSettings.ScreenPercentage = Value;
}
}
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
{
float Value = CVarSSRMaxRoughness.GetValueOnGameThread();
if(Value >= 0.0f)
{
//.........这里部分代码省略.........
示例10: if
FSceneView::FSceneView(const FSceneViewInitOptions& InitOptions)
: Family(InitOptions.ViewFamily)
, State(InitOptions.SceneViewStateInterface)
, ViewActor(InitOptions.ViewActor)
, Drawer(InitOptions.ViewElementDrawer)
, ViewRect(InitOptions.GetConstrainedViewRect())
, UnscaledViewRect(InitOptions.GetConstrainedViewRect())
, UnconstrainedViewRect(InitOptions.GetViewRect())
, MaxShadowCascades(10)
, WorldToMetersScale(InitOptions.WorldToMetersScale)
, ProjectionMatrixUnadjustedForRHI(InitOptions.ProjectionMatrix)
, BackgroundColor(InitOptions.BackgroundColor)
, OverlayColor(InitOptions.OverlayColor)
, ColorScale(InitOptions.ColorScale)
, StereoPass(InitOptions.StereoPass)
, DiffuseOverrideParameter(FVector4(0,0,0,1))
, SpecularOverrideParameter(FVector4(0,0,0,1))
, NormalOverrideParameter(FVector4(0,0,0,1))
, RoughnessOverrideParameter(FVector2D(0,1))
, HiddenPrimitives(InitOptions.HiddenPrimitives)
, LODDistanceFactor(InitOptions.LODDistanceFactor)
, bCameraCut(InitOptions.bInCameraCut)
, bOriginOffsetThisFrame(InitOptions.bOriginOffsetThisFrame)
, CursorPos(InitOptions.CursorPos)
, bIsGameView(false)
, bForceShowMaterials(false)
, bIsViewInfo(false)
, bIsSceneCapture(false)
, bIsReflectionCapture(false)
, bIsLocked(false)
, bStaticSceneOnly(false)
#if WITH_EDITOR
, OverrideLODViewOrigin(InitOptions.OverrideLODViewOrigin)
, bAllowTranslucentPrimitivesInHitProxy( true )
, bHasSelectedComponents( false )
#endif
, FeatureLevel(InitOptions.ViewFamily ? InitOptions.ViewFamily->GetFeatureLevel() : GMaxRHIFeatureLevel)
{
check(UnscaledViewRect.Min.X >= 0);
check(UnscaledViewRect.Min.Y >= 0);
check(UnscaledViewRect.Width() > 0);
check(UnscaledViewRect.Height() > 0);
ViewMatrices.ViewMatrix = InitOptions.ViewMatrix;
// Adjust the projection matrix for the current RHI.
ViewMatrices.ProjMatrix = AdjustProjectionMatrixForRHI(ProjectionMatrixUnadjustedForRHI);
// Compute the view projection matrix and its inverse.
ViewProjectionMatrix = ViewMatrices.GetViewProjMatrix();
// For precision reasons the view matrix inverse is calculated independently.
InvViewMatrix = ViewMatrices.ViewMatrix.Inverse();
InvViewProjectionMatrix = ViewMatrices.GetInvProjMatrix() * InvViewMatrix;
bool ApplyPreViewTranslation = true;
// Calculate the view origin from the view/projection matrices.
if(IsPerspectiveProjection())
{
ViewMatrices.ViewOrigin = InvViewMatrix.GetOrigin();
}
#if WITH_EDITOR
else if (InitOptions.bUseFauxOrthoViewPos)
{
float DistanceToViewOrigin = WORLD_MAX;
ViewMatrices.ViewOrigin = FVector4(InvViewMatrix.TransformVector(FVector(0,0,-1)).GetSafeNormal()*DistanceToViewOrigin,1) + InvViewMatrix.GetOrigin();
}
#endif
else
{
ViewMatrices.ViewOrigin = FVector4(InvViewMatrix.TransformVector(FVector(0,0,-1)).GetSafeNormal(),0);
// to avoid issues with view dependent effect (e.g. Frensel)
ApplyPreViewTranslation = false;
}
// Translate world-space so its origin is at ViewOrigin for improved precision.
// Note that this isn't exactly right for orthogonal projections (See the above special case), but we still use ViewOrigin
// in that case so the same value may be used in shaders for both the world-space translation and the camera's world position.
if(ApplyPreViewTranslation)
{
ViewMatrices.PreViewTranslation = -FVector(ViewMatrices.ViewOrigin);
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
{
// console variable override
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.PreViewTranslation"));
int32 Value = CVar->GetValueOnGameThread();
static FVector PreViewTranslationBackup;
if(Value)
{
PreViewTranslationBackup = ViewMatrices.PreViewTranslation;
}
else
{
ViewMatrices.PreViewTranslation = PreViewTranslationBackup;
}
}
//.........这里部分代码省略.........
示例11: SetFilterShaders
/**
* Sets the filter shaders with the provided filter samples.
* @param SamplerStateRHI - The sampler state to use for the source texture.
* @param FilterTextureRHI - The source texture.
* @param AdditiveTextureRHI - The additional source texture, used in CombineMethod=1
* @param CombineMethodInt 0:weighted filtering, 1: weighted filtering + additional texture, 2: max magnitude
* @param SampleOffsets - A pointer to an array of NumSamples UV offsets
* @param SampleWeights - A pointer to an array of NumSamples 4-vector weights
* @param NumSamples - The number of samples used by the filter.
* @param OutVertexShader - The vertex shader used for the filter
*/
void SetFilterShaders(
FRHICommandListImmediate& RHICmdList,
ERHIFeatureLevel::Type FeatureLevel,
FSamplerStateRHIParamRef SamplerStateRHI,
FTextureRHIParamRef FilterTextureRHI,
FTextureRHIParamRef AdditiveTextureRHI,
uint32 CombineMethodInt,
FVector2D* SampleOffsets,
FLinearColor* SampleWeights,
uint32 NumSamples,
FShader** OutVertexShader
)
{
check(CombineMethodInt <= 2);
check(NumSamples <= MAX_FILTER_SAMPLES && NumSamples > 0);
auto ShaderMap = GetGlobalShaderMap(FeatureLevel);
const auto DynamicNumSample = CVarLoopMode.GetValueOnRenderThread();
if ((NumSamples > MAX_FILTER_COMPILE_TIME_SAMPLES && DynamicNumSample != 0) || (DynamicNumSample == 2))
{
// there is to many samples, so we use the dynamic sample count shader
TShaderMapRef<FPostProcessVS> VertexShader(ShaderMap);
*OutVertexShader = *VertexShader;
if(CombineMethodInt == 0)
{
TShaderMapRef<TFilterPS<0, 0> > PixelShader(ShaderMap);
{
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
}
PixelShader->SetParameters(RHICmdList, SamplerStateRHI, FilterTextureRHI, AdditiveTextureRHI, SampleWeights, SampleOffsets, NumSamples);
}
else if(CombineMethodInt == 1)
{
TShaderMapRef<TFilterPS<0, 1> > PixelShader(ShaderMap);
{
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
}
PixelShader->SetParameters(RHICmdList, SamplerStateRHI, FilterTextureRHI, AdditiveTextureRHI, SampleWeights, SampleOffsets, NumSamples);
}
else\
{
TShaderMapRef<TFilterPS<0, 2> > PixelShader(ShaderMap);
{
static FGlobalBoundShaderState BoundShaderState;
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader);
}
PixelShader->SetParameters(RHICmdList, SamplerStateRHI, FilterTextureRHI, AdditiveTextureRHI, SampleWeights, SampleOffsets, NumSamples);
}
return;
}
// A macro to handle setting the filter shader for a specific number of samples.
#define SET_FILTER_SHADER_TYPE(CompileTimeNumSamples) \
case CompileTimeNumSamples: \
{ \
TShaderMapRef<TFilterVS<CompileTimeNumSamples> > VertexShader(ShaderMap); \
*OutVertexShader = *VertexShader; \
if(CombineMethodInt == 0) \
{ \
TShaderMapRef<TFilterPS<CompileTimeNumSamples, 0> > PixelShader(ShaderMap); \
{ \
static FGlobalBoundShaderState BoundShaderState; \
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader); \
} \
PixelShader->SetParameters(RHICmdList, SamplerStateRHI, FilterTextureRHI, AdditiveTextureRHI, SampleWeights, SampleOffsets, NumSamples); \
} \
else if(CombineMethodInt == 1) \
{ \
TShaderMapRef<TFilterPS<CompileTimeNumSamples, 1> > PixelShader(ShaderMap); \
{ \
static FGlobalBoundShaderState BoundShaderState; \
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader); \
} \
PixelShader->SetParameters(RHICmdList, SamplerStateRHI, FilterTextureRHI, AdditiveTextureRHI, SampleWeights, SampleOffsets, NumSamples); \
} \
else\
{ \
TShaderMapRef<TFilterPS<CompileTimeNumSamples, 2> > PixelShader(ShaderMap); \
{ \
static FGlobalBoundShaderState BoundShaderState; \
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader); \
} \
PixelShader->SetParameters(RHICmdList, SamplerStateRHI, FilterTextureRHI, AdditiveTextureRHI, SampleWeights, SampleOffsets, NumSamples); \
} \
VertexShader->SetParameters(RHICmdList, SampleOffsets); \
//.........这里部分代码省略.........
示例12: ApplyOverrides
void FSystemSettings::ApplyOverrides()
{
EConsoleVariableFlags SetBy = ECVF_SetByMask;
if (FPlatformProperties::SupportsWindowedMode())
{
if (CVarUseMaxQualityMode.GetValueOnGameThread() != 0)
{
SetBy = (EConsoleVariableFlags)(CVarUseMaxQualityMode.AsVariable()->GetFlags() & ECVF_SetByMask);
}
if (FParse::Param(FCommandLine::Get(),TEXT("MAXQUALITYMODE")))
{
SetBy = ECVF_SetByCommandline;
}
}
if (SetBy != ECVF_SetByMask)
{
// Modify various system settings to get the best quality regardless of performance impact
{
static auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.MinResolution"));
CVar->Set(16, SetBy);
}
// Disable shadow fading out over distance
{
static auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.FadeResolution"));
CVar->Set(1, SetBy);
}
// Increase minimum preshadow resolution
{
static auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.MinPreShadowResolution"));
CVar->Set(16, SetBy);
}
// Disable preshadow fading out over distance
{
static auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.PreShadowFadeResolution"));
CVar->Set(1, SetBy);
}
// Increase shadow texel density
{
static auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.TexelsPerPixel"));
CVar->Set(4.0f, SetBy);
}
// Don't downsample preshadows
{
static auto CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Shadow.PreShadowResolutionFactor"));
CVar->Set(1.0f, SetBy);
}
for (int32 GroupIndex = 0; GroupIndex < TEXTUREGROUP_MAX; GroupIndex++)
{
FTextureLODSettings::FTextureLODGroup& CurrentGroup = TextureLODSettings.GetTextureLODGroup(GroupIndex);
// Use the best quality texture filtering
CurrentGroup.Filter = SF_AnisotropicLinear;
// Raise texture max sizes to 4096
CurrentGroup.MinLODMipCount = 12;
CurrentGroup.MaxLODMipCount = 12;
CurrentGroup.LODBias = -1000;
}
}
}
示例13: SetParameters
void SetParameters(FRHICommandList& RHICmdList, const FSceneView& View, FTextureRHIParamRef SSRTexture, TArray<FReflectionCaptureSortData>& SortData, FUnorderedAccessViewRHIParamRef OutSceneColorUAV, const TRefCountPtr<IPooledRenderTarget>& DynamicBentNormalAO)
{
const FComputeShaderRHIParamRef ShaderRHI = GetComputeShader();
FGlobalShader::SetParameters(RHICmdList, ShaderRHI, View);
DeferredParameters.Set(RHICmdList, ShaderRHI, View);
FScene* Scene = (FScene*)View.Family->Scene;
check(Scene->ReflectionSceneData.CubemapArray.IsValid());
check(Scene->ReflectionSceneData.CubemapArray.GetRenderTarget().IsValid());
FSceneRenderTargetItem& CubemapArray = Scene->ReflectionSceneData.CubemapArray.GetRenderTarget();
SetTextureParameter(
RHICmdList,
ShaderRHI,
ReflectionEnvironmentColorTexture,
ReflectionEnvironmentColorSampler,
TStaticSamplerState<SF_Trilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI(),
CubemapArray.ShaderResourceTexture);
SetTextureParameter(RHICmdList, ShaderRHI, ScreenSpaceReflections, SSRTexture );
SetTextureParameter(RHICmdList, ShaderRHI, InSceneColor, GSceneRenderTargets.GetSceneColor()->GetRenderTargetItem().ShaderResourceTexture );
OutSceneColor.SetTexture(RHICmdList, ShaderRHI, NULL, OutSceneColorUAV);
SetShaderValue(RHICmdList, ShaderRHI, ViewDimensionsParameter, View.ViewRect);
FReflectionCaptureData SamplePositionsBuffer;
for (int32 CaptureIndex = 0; CaptureIndex < SortData.Num(); CaptureIndex++)
{
SamplePositionsBuffer.PositionAndRadius[CaptureIndex] = SortData[CaptureIndex].PositionAndRadius;
SamplePositionsBuffer.CaptureProperties[CaptureIndex] = SortData[CaptureIndex].CaptureProperties;
SamplePositionsBuffer.BoxTransform[CaptureIndex] = SortData[CaptureIndex].BoxTransform;
SamplePositionsBuffer.BoxScales[CaptureIndex] = SortData[CaptureIndex].BoxScales;
}
SetUniformBufferParameterImmediate(RHICmdList, ShaderRHI, GetUniformBufferParameter<FReflectionCaptureData>(), SamplePositionsBuffer);
SetShaderValue(RHICmdList, ShaderRHI, NumCaptures, SortData.Num());
SetTextureParameter(RHICmdList, ShaderRHI, PreIntegratedGF, PreIntegratedGFSampler, TStaticSamplerState<SF_Bilinear,AM_Clamp,AM_Clamp,AM_Clamp>::GetRHI(), GSystemTextures.PreintegratedGF->GetRenderTargetItem().ShaderResourceTexture);
SkyLightParameters.SetParameters(RHICmdList, ShaderRHI, Scene, View.Family->EngineShowFlags.SkyLighting);
const float MinOcclusion = Scene->SkyLight ? Scene->SkyLight->MinOcclusion : 0;
SpecularOcclusionParameters.SetParameters(RHICmdList, ShaderRHI, DynamicBentNormalAO, CVarSkySpecularOcclusionStrength.GetValueOnRenderThread(), MinOcclusion);
}
示例14:
FMeshElementCollector::FMeshElementCollector() :
PrimitiveSceneProxy(NULL),
FeatureLevel(ERHIFeatureLevel::Num),
bUseAsyncTasks(FApp::ShouldUseThreadingForPerformance() && CVarUseParallelGetDynamicMeshElementsTasks.GetValueOnAnyThread() > 0)
{
}
示例15: ProcessExtensions
void FAndroidOpenGL::ProcessExtensions(const FString& ExtensionsString)
{
FOpenGLES2::ProcessExtensions(ExtensionsString);
FString VersionString = FString(ANSI_TO_TCHAR((const ANSICHAR*)glGetString(GL_VERSION)));
bES30Support = VersionString.Contains(TEXT("OpenGL ES 3."));
// Get procedures
if (bSupportsOcclusionQueries || bSupportsDisjointTimeQueries)
{
glGenQueriesEXT = (PFNGLGENQUERIESEXTPROC) ((void*)eglGetProcAddress("glGenQueriesEXT"));
glDeleteQueriesEXT = (PFNGLDELETEQUERIESEXTPROC) ((void*)eglGetProcAddress("glDeleteQueriesEXT"));
glIsQueryEXT = (PFNGLISQUERYEXTPROC) ((void*)eglGetProcAddress("glIsQueryEXT"));
glBeginQueryEXT = (PFNGLBEGINQUERYEXTPROC) ((void*)eglGetProcAddress("glBeginQueryEXT"));
glEndQueryEXT = (PFNGLENDQUERYEXTPROC) ((void*)eglGetProcAddress("glEndQueryEXT"));
glGetQueryivEXT = (PFNGLGETQUERYIVEXTPROC) ((void*)eglGetProcAddress("glGetQueryivEXT"));
glGetQueryObjectivEXT = (PFNGLGETQUERYOBJECTIVEXTPROC) ((void*)eglGetProcAddress("glGetQueryObjectivEXT"));
glGetQueryObjectuivEXT = (PFNGLGETQUERYOBJECTUIVEXTPROC)((void*)eglGetProcAddress("glGetQueryObjectuivEXT"));
}
if (bSupportsDisjointTimeQueries)
{
glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC) ((void*)eglGetProcAddress("glQueryCounterEXT"));
glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC) ((void*)eglGetProcAddress("glGetQueryObjectui64vEXT"));
// If EXT_disjoint_timer_query wasn't found, NV_timer_query might be available
if (glQueryCounterEXT == NULL)
{
glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC)eglGetProcAddress("glQueryCounterNV");
}
if (glGetQueryObjectui64vEXT == NULL)
{
glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)eglGetProcAddress("glGetQueryObjectui64vNV");
}
}
glDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)((void*)eglGetProcAddress("glDiscardFramebufferEXT"));
glFramebufferTexture2DMultisampleEXT = (PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC)((void*)eglGetProcAddress("glFramebufferTexture2DMultisampleEXT"));
glRenderbufferStorageMultisampleEXT = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC)((void*)eglGetProcAddress("glRenderbufferStorageMultisampleEXT"));
glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)((void*)eglGetProcAddress("glPushGroupMarkerEXT"));
glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)((void*)eglGetProcAddress("glPopGroupMarkerEXT"));
glLabelObjectEXT = (PFNGLLABELOBJECTEXTPROC)((void*)eglGetProcAddress("glLabelObjectEXT"));
glGetObjectLabelEXT = (PFNGLGETOBJECTLABELEXTPROC)((void*)eglGetProcAddress("glGetObjectLabelEXT"));
bSupportsETC2 = bES30Support;
bUseES30ShadingLanguage = bES30Support;
FString RendererString = FString(ANSI_TO_TCHAR((const ANSICHAR*)glGetString(GL_RENDERER)));
if (RendererString.Contains(TEXT("SGX 540")))
{
UE_LOG(LogRHI, Warning, TEXT("Disabling support for GL_OES_packed_depth_stencil on SGX 540"));
bSupportsPackedDepthStencil = false;
bRequiresTexture2DPrecisionHack = true;
}
const bool bIsAdrenoBased = RendererString.Contains(TEXT("Adreno"));
if (bIsAdrenoBased)
{
// This is to avoid a bug in Adreno drivers that define GL_EXT_shader_framebuffer_fetch even when device does not support this extension
// OpenGL ES 3.1 [email protected] ([email protected])
bRequiresShaderFramebufferFetchUndef = !bSupportsShaderFramebufferFetch;
bRequiresARMShaderFramebufferFetchDepthStencilUndef = !bSupportsShaderDepthStencilFetch;
// Adreno 2xx doesn't work with packed depth stencil enabled
if (RendererString.Contains(TEXT("Adreno (TM) 2")))
{
UE_LOG(LogRHI, Warning, TEXT("Disabling support for GL_OES_packed_depth_stencil on Adreno 2xx"));
bSupportsPackedDepthStencil = false;
}
}
if (bES30Support)
{
glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)((void*)eglGetProcAddress("glDrawElementsInstanced"));
glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)((void*)eglGetProcAddress("glDrawArraysInstanced"));
glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC)((void*)eglGetProcAddress("glVertexAttribDivisor"));
bSupportsInstancing = true;
}
if (bES30Support || bIsAdrenoBased)
{
// Attempt to find ES 3.0 glTexStorage2D if we're on an ES 3.0 device
glTexStorage2D = (PFNGLTEXSTORAGE2DPROC)((void*)eglGetProcAddress("glTexStorage2D"));
if( glTexStorage2D != NULL )
{
bUseHalfFloatTexStorage = true;
}
else
{
// need to disable GL_EXT_color_buffer_half_float support because we have no way to allocate the storage and the driver doesn't work without it.
UE_LOG(LogRHI,Warning,TEXT("Disabling support for GL_EXT_color_buffer_half_float as we cannot bind glTexStorage2D"));
bSupportsColorBufferHalfFloat = false;
}
}
//@todo android: need GMSAAAllowed ?
if (bSupportsNVFrameBufferBlit)
//.........这里部分代码省略.........