本文整理汇总了C++中TAutoConsoleVariable::GetValueOnAnyThread方法的典型用法代码示例。如果您正苦于以下问题:C++ TAutoConsoleVariable::GetValueOnAnyThread方法的具体用法?C++ TAutoConsoleVariable::GetValueOnAnyThread怎么用?C++ TAutoConsoleVariable::GetValueOnAnyThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAutoConsoleVariable
的用法示例。
在下文中一共展示了TAutoConsoleVariable::GetValueOnAnyThread方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnArrangeChildren
void SVectorInputBox::OnArrangeChildren(const FGeometry& AllottedGeometry, FArrangedChildren& ArrangedChildren) const
{
bool bFoop = bCanBeCrushed && (CVarCrushThem.GetValueOnAnyThread() > 0.0f);
if (bFoop)
{
const float AlottedWidth = AllottedGeometry.Size.X;
const float CrushBelow = CVarStartCrushWhenBelow.GetValueOnAnyThread();
const float StopCrushing = CVarStopCrushWhenAbove.GetValueOnAnyThread();
if (bIsBeingCrushed)
{
bIsBeingCrushed = AlottedWidth < StopCrushing;
}
else
{
bIsBeingCrushed = AlottedWidth < CrushBelow;
}
}
else
{
bIsBeingCrushed = false;
}
SCompoundWidget::OnArrangeChildren(AllottedGeometry, ArrangedChildren);
}
示例2: InitFogConstants
void FSceneRenderer::InitFogConstants()
{
// console command override
float FogDensityOverride = -1.0f;
float FogStartDistanceOverride = -1.0f;
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
{
// console variable overrides
FogDensityOverride = CVarFogDensity.GetValueOnAnyThread();
FogStartDistanceOverride = CVarFogStartDistance.GetValueOnAnyThread();
}
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
for(int32 ViewIndex = 0;ViewIndex < Views.Num();ViewIndex++)
{
FViewInfo& View = Views[ViewIndex];
// set fog consts based on height fog components
if(ShouldRenderFog(*View.Family))
{
if (Scene->ExponentialFogs.Num() > 0)
{
const FExponentialHeightFogSceneInfo& FogInfo = Scene->ExponentialFogs[0];
const float CosTerminatorAngle = FMath::Clamp(FMath::Cos(FogInfo.LightTerminatorAngle * PI / 180.0f), -1.0f + DELTA, 1.0f - DELTA);
const float CollapsedFogParameterPower = FMath::Clamp(
-FogInfo.FogHeightFalloff * (View.ViewMatrices.ViewOrigin.Z - FogInfo.FogHeight),
-126.f + 1.f, // min and max exponent values for IEEE floating points (http://en.wikipedia.org/wiki/IEEE_floating_point)
+127.f - 1.f
);
const float CollapsedFogParameter = FogInfo.FogDensity * FMath::Pow(2.0f, CollapsedFogParameterPower);
View.ExponentialFogParameters = FVector4(CollapsedFogParameter, FogInfo.FogHeightFalloff, CosTerminatorAngle, FogInfo.StartDistance);
View.ExponentialFogColor = FVector(FogInfo.FogColor.R, FogInfo.FogColor.G, FogInfo.FogColor.B);
View.FogMaxOpacity = FogInfo.FogMaxOpacity;
View.DirectionalInscatteringExponent = FogInfo.DirectionalInscatteringExponent;
View.DirectionalInscatteringStartDistance = FogInfo.DirectionalInscatteringStartDistance;
View.bUseDirectionalInscattering = false;
View.InscatteringLightDirection = FVector(0);
for (TSparseArray<FLightSceneInfoCompact>::TConstIterator It(Scene->Lights); It; ++It)
{
const FLightSceneInfoCompact& LightInfo = *It;
// This will find the first directional light that is set to be used as an atmospheric sun light of sufficient brightness.
// If you have more than one directional light with these properties then all subsequent lights will be ignored.
if (LightInfo.LightSceneInfo->Proxy->GetLightType() == LightType_Directional
&& LightInfo.LightSceneInfo->Proxy->IsUsedAsAtmosphereSunLight()
&& LightInfo.LightSceneInfo->Proxy->GetColor().ComputeLuminance() > KINDA_SMALL_NUMBER
&& FogInfo.DirectionalInscatteringColor.ComputeLuminance() > KINDA_SMALL_NUMBER)
{
View.InscatteringLightDirection = -LightInfo.LightSceneInfo->Proxy->GetDirection();
View.bUseDirectionalInscattering = true;
View.DirectionalInscatteringColor = FogInfo.DirectionalInscatteringColor * LightInfo.LightSceneInfo->Proxy->GetColor().ComputeLuminance();
break;
}
}
}
}
}
}
示例3: GetFeatureLevel
FSceneViewFamily::FSceneViewFamily( const ConstructionValues& CVS )
:
FamilySizeX(0),
FamilySizeY(0),
RenderTarget(CVS.RenderTarget),
bUseSeparateRenderTarget(false),
Scene(CVS.Scene),
EngineShowFlags(CVS.EngineShowFlags),
CurrentWorldTime(CVS.CurrentWorldTime),
DeltaWorldTime(CVS.DeltaWorldTime),
CurrentRealTime(CVS.CurrentRealTime),
FrameNumber(UINT_MAX),
bRealtimeUpdate(CVS.bRealtimeUpdate),
bDeferClear(CVS.bDeferClear),
bResolveScene(CVS.bResolveScene),
GammaCorrection(CVS.GammaCorrection)
{
// If we do not pass a valid scene pointer then SetWorldTimes must be called to initialized with valid times.
ensure(CVS.bTimesSet);
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
int32 Value = CVarRenderTimeFrozen.GetValueOnAnyThread();
if(Value)
{
CurrentWorldTime = 0;
CurrentRealTime = 0;
}
#endif
#if !WITH_EDITOR
// Console shader compilers don't set instruction count,
// Also various console-specific rendering paths haven't been tested with shader complexity
check(!EngineShowFlags.ShaderComplexity);
check(!EngineShowFlags.StationaryLightOverlap);
#else
// instead of checking IsGameWorld on rendering thread to see if we allow this flag to be disabled
// we force it on in the game thread.
if(IsInGameThread())
{
if ( Scene && Scene->GetWorld() && Scene->GetWorld()->IsGameWorld() )
{
EngineShowFlags.LOD = 1;
}
}
LandscapeLODOverride = -1;
bDrawBaseInfo = true;
#endif
// Not supported in ES2.
auto FeatureLevel = GetFeatureLevel();
if (FeatureLevel == ERHIFeatureLevel::ES2 || FeatureLevel == ERHIFeatureLevel::ES3_1)
{
EngineShowFlags.ScreenPercentage = false;
}
}
示例4: GetReflectionEnvironmentCVar
// to avoid having direct access from many places
static int GetReflectionEnvironmentCVar()
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
return CVarReflectionEnvironment.GetValueOnAnyThread();
#endif
// on, default mode
return 1;
}
示例5: Evaluate
void FAnimNode_AimOffsetLookAt::Evaluate(FPoseContext& Context)
{
// Evaluate base pose
BasePose.Evaluate(Context);
if (bIsLODEnabled && FAnimWeight::IsRelevant(Alpha) && (CVarAimOffsetLookAtEnable.GetValueOnAnyThread() == 1))
{
UpdateFromLookAtTarget(Context);
// Evaluate MeshSpaceRotation additive blendspace
FPoseContext MeshSpaceRotationAdditivePoseContext(Context);
FAnimNode_BlendSpacePlayer::Evaluate(MeshSpaceRotationAdditivePoseContext);
// Accumulate poses together
FAnimationRuntime::AccumulateMeshSpaceRotationAdditiveToLocalPose(Context.Pose, MeshSpaceRotationAdditivePoseContext.Pose, Context.Curve, MeshSpaceRotationAdditivePoseContext.Curve, Alpha);
// Resulting rotations are not normalized, so normalize here.
Context.Pose.NormalizeRotations();
}
}
示例6: InitAndLoad
void FVulkanPipelineStateCache::InitAndLoad(const TArray<FString>& CacheFilenames)
{
TArray<uint8> DeviceCache;
bool bLoaded = false;
if (GEnablePipelineCacheLoadCvar.GetValueOnAnyThread() == 0)
{
UE_LOG(LogVulkanRHI, Display, TEXT("Not loading pipeline cache per r.Vulkan.PipelineCacheLoad=0"));
}
else
{
bLoaded = Load(CacheFilenames, DeviceCache);
}
VkPipelineCacheCreateInfo PipelineCacheInfo;
FMemory::Memzero(PipelineCacheInfo);
PipelineCacheInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO;
PipelineCacheInfo.initialDataSize = bLoaded ? DeviceCache.Num() : 0;
PipelineCacheInfo.pInitialData = bLoaded ? DeviceCache.GetData() : 0;
VERIFYVULKANRESULT(VulkanRHI::vkCreatePipelineCache(Device->GetInstanceHandle(), &PipelineCacheInfo, nullptr, &PipelineCache));
}
示例7: OutputsToGBuffer
bool FVelocityRendering::OutputsToGBuffer()
{
return CVarBasePassOutputsVelocity.GetValueOnAnyThread() == 1;
}
示例8: Update
void FAnimNode_StateMachine::Update(const FAnimationUpdateContext& Context)
{
// If we just became relevant and haven't been initialized yet, then reinitialize state machine.
if (!bFirstUpdate && (UpdateCounter.Get() != INDEX_NONE) && !UpdateCounter.WasSynchronizedInTheLastFrame(Context.AnimInstanceProxy->GetUpdateCounter()) && (CVarAnimStateMachineRelevancyReset.GetValueOnAnyThread() == 1))
{
FAnimationInitializeContext InitializationContext(Context.AnimInstanceProxy);
Initialize(InitializationContext);
}
UpdateCounter.SynchronizeWith(Context.AnimInstanceProxy->GetUpdateCounter());
const FBakedAnimationStateMachine* Machine = GetMachineDescription();
if (Machine != nullptr)
{
if (Machine->States.Num() == 0)
{
return;
}
else if(!Machine->States.IsValidIndex(CurrentState))
{
// Attempting to catch a crash where the state machine has been freed.
// Reported as a symptom of a crash in UE-24732 for 4.10. This log message should not appear given changes to
// re-instancing in 4.11 (see CL 2823202). If it does appear we need to spot integrate CL 2823202 (and supporting
// anim re-init changes, probably 2799786 & 2801372).
UE_LOG(LogAnimation, Warning, TEXT("FAnimNode_StateMachine::Update - Invalid current state, please report. Attempting to use state %d of %d in state machine %d (ptr 0x%x)"), CurrentState, Machine->States.Num(), StateMachineIndexInClass, Machine);
UE_LOG(LogAnimation, Warning, TEXT("\t\tWhen updating AnimInstance: %s"), *Context.AnimInstanceProxy->GetAnimInstanceObject()->GetName())
return;
}
}
示例9: if
FD3D12DynamicRHI::FD3D12DynamicRHI(IDXGIFactory4* InDXGIFactory, FD3D12Adapter& InAdapter) :
DXGIFactory(InDXGIFactory),
CommitResourceTableCycles(0),
CacheResourceTableCalls(0),
CacheResourceTableCycles(0),
SetShaderTextureCycles(0),
SetShaderTextureCalls(0),
SetTextureInTableCalls(0),
SceneFrameCounter(0),
ResourceTableFrameCounter(INDEX_NONE),
bForceSingleQueueGPU(false),
NumThreadDynamicHeapAllocators(0),
ViewportFrameCounter(0),
MainAdapter(InAdapter),
MainDevice(nullptr)
{
FMemory::Memzero(ThreadDynamicHeapAllocatorArray, sizeof(ThreadDynamicHeapAllocatorArray));
// The FD3D12DynamicRHI must be a singleton
check(SingleD3DRHI == nullptr);
// This should be called once at the start
check( IsInGameThread() );
check( !GIsThreadedRendering );
SingleD3DRHI = this;
check(MainAdapter.IsValid());
MainDevice = new FD3D12Device(this, DXGIFactory, MainAdapter);
FeatureLevel = MainAdapter.MaxSupportedFeatureLevel;
GPUProfilingData.Init(MainDevice);
#if SUPPORTS_MEMORY_RESIDENCY
ResourceResidencyManager.Init(MainDevice);
#endif
// Allocate a buffer of zeroes. This is used when we need to pass D3D memory
// that we don't care about and will overwrite with valid data in the future.
ZeroBufferSize = FMath::Max(CVarD3D12ZeroBufferSizeInMB.GetValueOnAnyThread(), 0) * (1 << 20);
ZeroBuffer = FMemory::Malloc(ZeroBufferSize);
FMemory::Memzero(ZeroBuffer,ZeroBufferSize);
GPoolSizeVRAMPercentage = 0;
GTexturePoolSize = 0;
GConfig->GetInt(TEXT("TextureStreaming"), TEXT("PoolSizeVRAMPercentage"), GPoolSizeVRAMPercentage, GEngineIni);
// Initialize the RHI capabilities.
check(FeatureLevel == D3D_FEATURE_LEVEL_11_0 || FeatureLevel == D3D_FEATURE_LEVEL_10_0 );
if (FeatureLevel == D3D_FEATURE_LEVEL_10_0)
{
GSupportsDepthFetchDuringDepthTest = false;
}
// ES2 feature level emulation in D3D11
if (FParse::Param(FCommandLine::Get(), TEXT("FeatureLevelES2")) && !GIsEditor)
{
GMaxRHIFeatureLevel = ERHIFeatureLevel::ES2;
GMaxRHIShaderPlatform = SP_PCD3D_ES2;
}
else if ((FParse::Param(FCommandLine::Get(), TEXT("FeatureLevelES31")) || FParse::Param(FCommandLine::Get(), TEXT("FeatureLevelES3_1"))) && !GIsEditor)
{
GMaxRHIFeatureLevel = ERHIFeatureLevel::ES3_1;
GMaxRHIShaderPlatform = SP_PCD3D_ES3_1;
}
else if (FeatureLevel == D3D_FEATURE_LEVEL_11_0)
{
GMaxRHIFeatureLevel = ERHIFeatureLevel::SM5;
GMaxRHIShaderPlatform = SP_PCD3D_SM5;
}
else if (FeatureLevel == D3D_FEATURE_LEVEL_10_0)
{
GMaxRHIFeatureLevel = ERHIFeatureLevel::SM4;
GMaxRHIShaderPlatform = SP_PCD3D_SM4;
}
if (FParse::Param(FCommandLine::Get(), TEXT("ForceSingleQueue")))
{
bForceSingleQueueGPU = true;
}
// Initialize the platform pixel format map.
GPixelFormats[ PF_Unknown ].PlatformFormat = DXGI_FORMAT_UNKNOWN;
GPixelFormats[ PF_A32B32G32R32F ].PlatformFormat = DXGI_FORMAT_R32G32B32A32_FLOAT;
GPixelFormats[ PF_B8G8R8A8 ].PlatformFormat = DXGI_FORMAT_B8G8R8A8_TYPELESS;
GPixelFormats[ PF_G8 ].PlatformFormat = DXGI_FORMAT_R8_UNORM;
GPixelFormats[ PF_G16 ].PlatformFormat = DXGI_FORMAT_R16_UNORM;
GPixelFormats[ PF_DXT1 ].PlatformFormat = DXGI_FORMAT_BC1_TYPELESS;
GPixelFormats[ PF_DXT3 ].PlatformFormat = DXGI_FORMAT_BC2_TYPELESS;
GPixelFormats[ PF_DXT5 ].PlatformFormat = DXGI_FORMAT_BC3_TYPELESS;
GPixelFormats[ PF_BC4 ].PlatformFormat = DXGI_FORMAT_BC4_UNORM;
GPixelFormats[ PF_UYVY ].PlatformFormat = DXGI_FORMAT_UNKNOWN; // TODO: Not supported in D3D11
#if DEPTH_32_BIT_CONVERSION
GPixelFormats[ PF_DepthStencil ].PlatformFormat = DXGI_FORMAT_R32G8X24_TYPELESS;
GPixelFormats[ PF_DepthStencil ].BlockBytes = 5;
GPixelFormats[ PF_X24_G8 ].PlatformFormat = DXGI_FORMAT_X32_TYPELESS_G8X24_UINT;
GPixelFormats[ PF_X24_G8].BlockBytes = 5;
#else
//.........这里部分代码省略.........
示例10: EvaluateBoneTransforms
void FAnimNode_AnimDynamics::EvaluateBoneTransforms(USkeletalMeshComponent* SkelComp, FCSPose<FCompactPose>& MeshBases, TArray<FBoneTransform>& OutBoneTransforms)
{
SCOPE_CYCLE_COUNTER(STAT_AnimDynamicsOverall);
int32 RestrictToLOD = CVarRestrictLod.GetValueOnAnyThread();
bool bEnabledForLod = RestrictToLOD >= 0 ? SkelComp->PredictedLODLevel == RestrictToLOD : true;
if (CVarEnableDynamics.GetValueOnAnyThread() == 1 && bEnabledForLod)
{
// Pretty nasty - but there isn't really a good way to get clean bone transforms (without the modification from
// previous runs) so we have to initialize here, checking often so we can restart a simulation in the editor.
if (bRequiresInit)
{
InitPhysics(SkelComp, MeshBases);
bRequiresInit = false;
}
if (bDoUpdate && NextTimeStep > 0.0f)
{
// Wind / Force update
if(CVarEnableWind.GetValueOnAnyThread() == 1 && bEnableWind)
{
SCOPE_CYCLE_COUNTER(STAT_AnimDynamicsWindData);
for(FAnimPhysRigidBody* Body : BaseBodyPtrs)
{
if(SkelComp && SkelComp->GetWorld())
{
Body->bWindEnabled = bEnableWind;
if(Body->bWindEnabled)
{
UWorld* World = SkelComp->GetWorld();
FSceneInterface* Scene = World->Scene;
// Unused by our simulation but needed for the call to GetWindParameters below
float WindMinGust;
float WindMaxGust;
// Setup wind data
Body->bWindEnabled = true;
Scene->GetWindParameters(SkelComp->ComponentToWorld.TransformPosition(Body->Pose.Position), Body->WindData.WindDirection, Body->WindData.WindSpeed, WindMinGust, WindMaxGust);
Body->WindData.WindDirection = SkelComp->ComponentToWorld.Inverse().TransformVector(Body->WindData.WindDirection);
Body->WindData.WindAdaption = FMath::FRandRange(0.0f, 2.0f);
Body->WindData.BodyWindScale = WindScale;
}
}
}
}
else
{
SCOPE_CYCLE_COUNTER(STAT_AnimDynamicsWindData);
// Disable wind.
for(FAnimPhysRigidBody* Body : BaseBodyPtrs)
{
Body->bWindEnabled = false;
}
}
if (CVarEnableAdaptiveSubstep.GetValueOnAnyThread() == 1)
{
float FixedTimeStep = MaxSubstepDeltaTime * CurrentTimeDilation;
// Clamp the fixed timestep down to max physics tick time.
// at high speeds the simulation will not converge as the delta time is too high, this will
// help to keep constraints together at a cost of physical accuracy
FixedTimeStep = FMath::Clamp(FixedTimeStep, 0.0f, MaxPhysicsDeltaTime);
// Calculate number of substeps we should do.
int32 NumIters = FMath::TruncToInt((NextTimeStep + (TimeDebt * CurrentTimeDilation)) / FixedTimeStep);
NumIters = FMath::Clamp(NumIters, 0, MaxSubsteps);
SET_DWORD_STAT(STAT_AnimDynamicsSubSteps, NumIters);
// Store the remaining time as debt for later frames
TimeDebt = (NextTimeStep + TimeDebt) - (NumIters * FixedTimeStep);
TimeDebt = FMath::Clamp(TimeDebt, 0.0f, MaxTimeDebt);
NextTimeStep = FixedTimeStep;
for (int32 Iter = 0; Iter < NumIters; ++Iter)
{
UpdateLimits(SkelComp, MeshBases);
FAnimPhys::PhysicsUpdate(FixedTimeStep, BaseBodyPtrs, LinearLimits, AngularLimits, Springs, NumSolverIterationsPreUpdate, NumSolverIterationsPostUpdate);
}
}
else
{
// Do variable frame-time update
const float MaxDeltaTime = MaxPhysicsDeltaTime;
NextTimeStep = FMath::Min(NextTimeStep, MaxDeltaTime);
UpdateLimits(SkelComp, MeshBases);
FAnimPhys::PhysicsUpdate(NextTimeStep, BaseBodyPtrs, LinearLimits, AngularLimits, Springs, NumSolverIterationsPreUpdate, NumSolverIterationsPostUpdate);
}
}
if (bDoEval)
//.........这里部分代码省略.........
示例11: UseSelectiveBasePassOutputs
bool UseSelectiveBasePassOutputs()
{
return CVarSelectiveBasePassOutputs.GetValueOnAnyThread() == 1;
}
示例12: ProcessExtensions
//.........这里部分代码省略.........
}
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)
{
glBlitFramebufferNV = (PFNBLITFRAMEBUFFERNVPROC)((void*)eglGetProcAddress("glBlitFramebufferNV"));
}
glMapBufferOES = (PFNGLMAPBUFFEROESPROC)((void*)eglGetProcAddress("glMapBufferOES"));
glUnmapBufferOES = (PFNGLUNMAPBUFFEROESPROC)((void*)eglGetProcAddress("glUnmapBufferOES"));
//On Android, there are problems compiling shaders with textureCubeLodEXT calls in the glsl code,
// so we set this to false to modify the glsl manually at compile-time.
bSupportsTextureCubeLodEXT = false;
// On some Android devices with Mali GPUs textureCubeLod is not available.
if (RendererString.Contains(TEXT("Mali-400")))
{
bSupportsShaderTextureCubeLod = false;
}
// Nexus 5 (Android 4.4.2) doesn't like glVertexAttribDivisor(index, 0) called when not using a glDrawElementsInstanced
if (bIsAdrenoBased && VersionString.Contains(TEXT("OpenGL ES 3.0 [email protected] [email protected] ([email protected])")))
{
UE_LOG(LogRHI, Warning, TEXT("Disabling support for hardware instancing on Adreno 330 OpenGL ES 3.0 [email protected] [email protected] ([email protected])"));
bSupportsInstancing = false;
}
if (bSupportsBGRA8888 && CVarAndroidDisableTextureFormatBGRA8888.GetValueOnAnyThread() == 1)
{
UE_LOG(LogRHI, Warning, TEXT("Disabling support for GL_EXT_texture_format_BGRA8888"));
bSupportsBGRA8888 = false;
}
}
示例13: UpdateFromLookAtTarget
void FAnimNode_AimOffsetLookAt::UpdateFromLookAtTarget(FPoseContext& LocalPoseContext)
{
const FBoneContainer& RequiredBones = LocalPoseContext.Pose.GetBoneContainer();
if (RequiredBones.GetSkeletalMeshAsset())
{
const USkeletalMeshSocket* Socket = RequiredBones.GetSkeletalMeshAsset()->FindSocket(SourceSocketName);
if (Socket)
{
const FTransform SocketLocalTransform = Socket->GetSocketLocalTransform();
FBoneReference SocketBoneReference;
SocketBoneReference.BoneName = Socket->BoneName;
SocketBoneReference.Initialize(RequiredBones);
if (SocketBoneReference.IsValid(RequiredBones))
{
const FCompactPoseBoneIndex SocketBoneIndex = SocketBoneReference.GetCompactPoseIndex(RequiredBones);
FCSPose<FCompactPose> GlobalPose;
GlobalPose.InitPose(LocalPoseContext.Pose);
USkeletalMeshComponent* Component = LocalPoseContext.AnimInstanceProxy->GetSkelMeshComponent();
AActor* Actor = Component ? Component->GetOwner() : nullptr;
if (Component && Actor && BlendSpace)
{
const FTransform ActorTransform = Actor->GetTransform();
const FTransform BoneTransform = GlobalPose.GetComponentSpaceTransform(SocketBoneIndex);
const FTransform SocketWorldTransform = SocketLocalTransform * BoneTransform * Component->ComponentToWorld;
// Convert Target to Actor Space
const FTransform TargetWorldTransform(LookAtLocation);
const FVector DirectionToTarget = ActorTransform.InverseTransformVectorNoScale(TargetWorldTransform.GetLocation() - SocketWorldTransform.GetLocation()).GetSafeNormal();
const FVector CurrentDirection = ActorTransform.InverseTransformVectorNoScale(SocketWorldTransform.GetUnitAxis(EAxis::X));
const FVector AxisX = FVector::ForwardVector;
const FVector AxisY = FVector::RightVector;
const FVector AxisZ = FVector::UpVector;
const FVector2D CurrentCoords = FMath::GetAzimuthAndElevation(CurrentDirection, AxisX, AxisY, AxisZ);
const FVector2D TargetCoords = FMath::GetAzimuthAndElevation(DirectionToTarget, AxisX, AxisY, AxisZ);
const FVector BlendInput(
FRotator::NormalizeAxis(FMath::RadiansToDegrees(TargetCoords.X - CurrentCoords.X)),
FRotator::NormalizeAxis(FMath::RadiansToDegrees(TargetCoords.Y - CurrentCoords.Y)),
0.f);
// Set X and Y, so ticking next frame is based on correct weights.
X = BlendInput.X;
Y = BlendInput.Y;
// Generate BlendSampleDataCache from inputs.
BlendSpace->GetSamplesFromBlendInput(BlendInput, BlendSampleDataCache);
if (CVarAimOffsetLookAtDebug.GetValueOnAnyThread() == 1)
{
DrawDebugLine(Component->GetWorld(), SocketWorldTransform.GetLocation(), TargetWorldTransform.GetLocation(), FColor::Green);
DrawDebugLine(Component->GetWorld(), SocketWorldTransform.GetLocation(), SocketWorldTransform.GetLocation() + SocketWorldTransform.GetUnitAxis(EAxis::X) * (TargetWorldTransform.GetLocation() - SocketWorldTransform.GetLocation()).Size(), FColor::Red);
DrawDebugCoordinateSystem(Component->GetWorld(), ActorTransform.GetLocation(), ActorTransform.GetRotation().Rotator(), 100.f);
FString DebugString = FString::Printf(TEXT("Socket (X:%f, Y:%f), Target (X:%f, Y:%f), Result (X:%f, Y:%f)")
, FMath::RadiansToDegrees(CurrentCoords.X)
, FMath::RadiansToDegrees(CurrentCoords.Y)
, FMath::RadiansToDegrees(TargetCoords.X)
, FMath::RadiansToDegrees(TargetCoords.Y)
, BlendInput.X
, BlendInput.Y);
GEngine->AddOnScreenDebugMessage(INDEX_NONE, 0.f, FColor::Red, DebugString, false);
}
}
}
}
}
}
示例14:
FMeshElementCollector::FMeshElementCollector() :
PrimitiveSceneProxy(NULL),
FeatureLevel(ERHIFeatureLevel::Num),
bUseAsyncTasks(FApp::ShouldUseThreadingForPerformance() && CVarUseParallelGetDynamicMeshElementsTasks.GetValueOnAnyThread() > 0)
{
}
示例15: if
//.........这里部分代码省略.........
PreViewTranslationBackup = ViewMatrices.PreViewTranslation;
}
else
{
ViewMatrices.PreViewTranslation = PreViewTranslationBackup;
}
}
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
}
/** The view transform, starting from world-space points translated by -ViewOrigin. */
FMatrix TranslatedViewMatrix = FTranslationMatrix(-ViewMatrices.PreViewTranslation) * ViewMatrices.ViewMatrix;
// Compute a transform from view origin centered world-space to clip space.
ViewMatrices.TranslatedViewProjectionMatrix = TranslatedViewMatrix * ViewMatrices.ProjMatrix;
ViewMatrices.InvTranslatedViewProjectionMatrix = ViewMatrices.TranslatedViewProjectionMatrix.Inverse();
// Compute screen scale factors.
// Stereo renders at half horizontal resolution, but compute shadow resolution based on full resolution.
const bool bStereo = StereoPass != eSSP_FULL;
const float ScreenXScale = bStereo ? 2.0f : 1.0f;
ViewMatrices.ProjectionScale.X = ScreenXScale * FMath::Abs(ViewMatrices.ProjMatrix.M[0][0]);
ViewMatrices.ProjectionScale.Y = FMath::Abs(ViewMatrices.ProjMatrix.M[1][1]);
ViewMatrices.ScreenScale = FMath::Max(
ViewRect.Size().X * 0.5f * ViewMatrices.ProjectionScale.X,
ViewRect.Size().Y * 0.5f * ViewMatrices.ProjectionScale.Y
);
ShadowViewMatrices = ViewMatrices;
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
{
// console variable override
int32 Value = CVarShadowFreezeCamera.GetValueOnAnyThread();
static FViewMatrices Backup = ShadowViewMatrices;
if(Value)
{
ShadowViewMatrices = Backup;
}
else
{
Backup = ShadowViewMatrices;
}
}
#endif // !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (InitOptions.OverrideFarClippingPlaneDistance > 0.0f)
{
const FPlane FarPlane(ViewMatrices.ViewOrigin + GetViewDirection() * InitOptions.OverrideFarClippingPlaneDistance, GetViewDirection());
// Derive the view frustum from the view projection matrix, overriding the far plane
GetViewFrustumBounds(ViewFrustum,ViewProjectionMatrix,FarPlane,true,false);
}
else
{
// Derive the view frustum from the view projection matrix.
GetViewFrustumBounds(ViewFrustum,ViewProjectionMatrix,false);
}
// Derive the view's near clipping distance and plane.
// The GetFrustumFarPlane() is the near plane because of reverse Z projection.
bHasNearClippingPlane = ViewProjectionMatrix.GetFrustumFarPlane(NearClippingPlane);
if(ViewMatrices.ProjMatrix.M[2][3] > DELTA)
{
// Infinite projection with reversed Z.