int32 SHistogram::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const { static double TotalTime = 0.0f; static uint32 NumCalls = 0; const double StartTime = FPlatformTime::Seconds(); const TSharedRef< FSlateFontMeasure > FontMeasureService = FSlateApplication::Get().GetRenderer()->GetFontMeasureService(); // Rendering info. const bool bEnabled = ShouldBeEnabled( bParentEnabled ); ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect; const FSlateBrush* TimelineAreaBrush = FEditorStyle::GetBrush("Profiler.LineGraphArea"); const FSlateBrush* WhiteBrush = FEditorStyle::GetBrush("WhiteTexture"); const FSlateBrush* FillImage = FEditorStyle::GetBrush("TaskGraph.Mono"); // Draw background. FSlateDrawElement::MakeBox ( OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry( FVector2D(0,0), FVector2D(AllottedGeometry.Size.X,AllottedGeometry.Size.Y) ), TimelineAreaBrush, MyClippingRect, DrawEffects, TimelineAreaBrush->GetTint( InWidgetStyle ) * InWidgetStyle.GetColorAndOpacityTint() ); LayerId++; const float LabelBuffer = 25.0f; // draw the grid lines uint32 CountX = (uint32)((AllottedGeometry.Size.X-LabelBuffer*2.0f) / Description.GetBinCount()); float StartX = LabelBuffer; static const FLinearColor GridColor = FLinearColor(0.0f,0.0f,0.0f, 0.25f); static const FLinearColor GridTextColor = FLinearColor(1.0f,1.0f,1.0f, 0.25f); static const FLinearColor BorderColor = FLinearColor(0.0f,0.0f,0.0f,1.0f); FSlateFontInfo SummaryFont(FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf"), 8 ); const float MaxFontCharHeight = FontMeasureService->Measure( TEXT("!"), SummaryFont ).Y; TArray<FVector2D> LinePoints; // draw the histogram box LinePoints.Add( FVector2D(StartX-1, LabelBuffer-1) ); LinePoints.Add( FVector2D(StartX + Description.GetBinCount()*CountX+1, LabelBuffer-1) ); LinePoints.Add( FVector2D(StartX + Description.GetBinCount()*CountX+1, AllottedGeometry.Size.Y - LabelBuffer+1) ); LinePoints.Add( FVector2D(StartX-1, AllottedGeometry.Size.Y - LabelBuffer+1) ); LinePoints.Add( FVector2D(StartX-1, LabelBuffer-1) ); FSlateDrawElement::MakeLines ( OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), LinePoints, MyClippingRect, DrawEffects, BorderColor ); LinePoints.Empty(); LayerId++; // draw the vertical lines for (int32 Index = 0; Index < Description.GetBinCount(); ++Index) { float MarkerPosX = StartX + Index * CountX; LinePoints.Add( FVector2D(MarkerPosX, LabelBuffer-1) ); LinePoints.Add( FVector2D(MarkerPosX, AllottedGeometry.Size.Y - LabelBuffer+1) ); FSlateDrawElement::MakeLines ( OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), LinePoints, MyClippingRect, DrawEffects, GridColor ); LinePoints.Empty(); // Bottom - X-Axes numbers, starting from MinValue const FString XLabel = FString::Printf(TEXT("%.0f"), Description.MinValue + Index*Description.Interval); float FontCharWidth = FontMeasureService->Measure(XLabel, SummaryFont).X; FSlateDrawElement::MakeText ( OutDrawElements, LayerId, AllottedGeometry.ToOffsetPaintGeometry( FVector2D(MarkerPosX-FontCharWidth/2.0f,AllottedGeometry.Size.Y-LabelBuffer/2.0f-MaxFontCharHeight/2.0f) ), XLabel, SummaryFont, MyClippingRect, DrawEffects, FLinearColor::White ); } LayerId++; // draw the horizontal lines float CountY = (AllottedGeometry.Size.Y-LabelBuffer*2.0f) / 4; float StartY = LabelBuffer; for (int32 Index = 0; Index < 5; ++Index) { float MarkerPosY = StartY + Index * CountY; LinePoints.Add( FVector2D(StartX, MarkerPosY) ); LinePoints.Add( FVector2D(StartX + Description.GetBinCount()*CountX, MarkerPosY) ); FSlateDrawElement::MakeLines ( OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), LinePoints, MyClippingRect, DrawEffects, GridColor ); LinePoints.Empty(); // Bottom - Y-Axes numbers, starting from 0 const FString YLabel = FString::Printf(TEXT("%i"), Description.Normalize ? 25 * (4-Index) : Description.GetTotalCount() / 4 * Index); float FontCharWidth = FontMeasureService->Measure(YLabel, SummaryFont).X; FSlateDrawElement::MakeText ( OutDrawElements, LayerId, AllottedGeometry.ToOffsetPaintGeometry( FVector2D(LabelBuffer/2.0f-FontCharWidth/2.0f,MarkerPosY-MaxFontCharHeight/2.0f) ), YLabel, SummaryFont, MyClippingRect, DrawEffects, FLinearColor::White ); } LayerId++; for (int32 Index = 0; Index < Description.GetBinCount(); ++Index) { float MarkerPosX = StartX + Index * CountX; float SizeY = (float)Description.GetCount(Index) / (float)Description.GetTotalCount() * (AllottedGeometry.Size.Y - LabelBuffer*2.0f); FSlateDrawElement::MakeBox( OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry( FVector2D(MarkerPosX, AllottedGeometry.Size.Y - SizeY- LabelBuffer), FVector2D(CountX, SizeY) ), FillImage, MyClippingRect, DrawEffects, FLinearColor::Green ); } return SCompoundWidget::OnPaint( Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled && IsEnabled() ); }
void SARInventoryItemWidget::OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent) { TextColor = FSlateColor(FLinearColor(0, 1, 0, 1)); }
FLinearColor UAnimGraphNode_LocalToComponentSpace::GetNodeTitleColor() const { return FLinearColor(0.7f, 0.7f, 0.7f); }
void UK2Node_Timeline::FindDiffs( class UEdGraphNode* OtherNode, struct FDiffResults& Results ) { UK2Node_Timeline* Timeline1 = this; UK2Node_Timeline* Timeline2 = Cast<UK2Node_Timeline>(OtherNode); UBlueprint* Blueprint1 = Timeline1->GetBlueprint(); int32 Index1 = FBlueprintEditorUtils::FindTimelineIndex(Blueprint1,Timeline1->TimelineName); UBlueprint* Blueprint2 = Timeline2->GetBlueprint(); int32 Index2 = FBlueprintEditorUtils::FindTimelineIndex(Blueprint2,Timeline2->TimelineName); if(Index1 != INDEX_NONE && Index2 != INDEX_NONE) { UTimelineTemplate* Template1 = Blueprint1->Timelines[Index1]; UTimelineTemplate* Template2 = Blueprint2->Timelines[Index2]; FDiffSingleResult Diff; Diff.Node1 = Timeline2; Diff.Node2 = Timeline1; if(Template1->bAutoPlay != Template2->bAutoPlay) { Diff.Diff = EDiffType::TIMELINE_AUTOPLAY; FText NodeName = GetNodeTitle(ENodeTitleType::ListView); FFormatNamedArguments Args; Args.Add(TEXT("NodeName"), NodeName); Diff.ToolTip = FText::Format(LOCTEXT("DIF_TimelineAutoPlayToolTip", "Timeline '{NodeName}' had its AutoPlay state changed"), Args); Diff.DisplayColor = FLinearColor(0.15f,0.61f,0.15f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_TimelineAutoPlay", "Timeline AutoPlay Changed '{NodeName}'"), Args); Results.Add(Diff); } if(Template1->bLoop != Template2->bLoop) { Diff.Diff = EDiffType::TIMELINE_LOOP; FText NodeName = GetNodeTitle(ENodeTitleType::ListView); FFormatNamedArguments Args; Args.Add(TEXT("NodeName"), NodeName); Diff.ToolTip = FText::Format(LOCTEXT("DIF_TimelineLoopingToolTip", "Timeline '{NodeName}' had its looping state changed"), Args); Diff.DisplayColor = FLinearColor(0.75f,0.1f,0.75f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_TimelineLooping", "Timeline Loop Changed '{NodeName}'"), Args); Results.Add(Diff); } if(Template1->TimelineLength != Template2->TimelineLength) { FText NodeName = GetNodeTitle(ENodeTitleType::ListView); FFormatNamedArguments Args; Args.Add(TEXT("NodeName"), NodeName); Args.Add(TEXT("TimelineLength1"), Template1->TimelineLength); Args.Add(TEXT("TimelineLength2"), Template2->TimelineLength); Diff.Diff = EDiffType::TIMELINE_LENGTH; Diff.ToolTip = FText::Format(LOCTEXT("DIF_TimelineLengthToolTip", "Length of Timeline '{NodeName}' has changed. Was {TimelineLength1}, but is now {TimelineLength2}"), Args); Diff.DisplayColor = FLinearColor(0.25f,0.1f,0.15f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_TimelineLength", "Timeline Length '{NodeName}' [{TimelineLength1} -> {TimelineLength2}]"), Args); Results.Add(Diff); } if (Template1->bIgnoreTimeDilation != Template2->bIgnoreTimeDilation) { Diff.Diff = EDiffType::TIMELINE_IGNOREDILATION; FText NodeName = GetNodeTitle(ENodeTitleType::ListView); FFormatNamedArguments Args; Args.Add(TEXT("NodeName"), NodeName); Diff.ToolTip = FText::Format(LOCTEXT("DIF_TimelineIgnoreDilationToolTip", "Timeline '{NodeName}' had its ignore time dilation state changed"), Args); Diff.DisplayColor = FLinearColor(0.75f, 0.1f, 0.75f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_TimelineIgnoreDilation", "Timeline IgnoreTimeDilation Changed '{NodeName}'"), Args); Results.Add(Diff); } //something specific inside has changed if(Diff.Diff == EDiffType::NO_DIFFERENCE) { FindExactTimelineDifference(Results, Diff, Template1->EventTracks, Template2->EventTracks, LOCTEXT("Event", "Event").ToString()); FindExactTimelineDifference(Results, Diff, Template1->FloatTracks, Template2->FloatTracks, LOCTEXT("Float", "Float").ToString()); FindExactTimelineDifference(Results, Diff, Template1->VectorTracks, Template2->VectorTracks, LOCTEXT("Vector", "Vector").ToString() ); } } }
/** Converts an XYZ color to xyzY, where xy and z are chrominance measures and Y is the brightness. */ FLinearColor FLinearColorUtils::XYZToxyzY(const FLinearColor& InColor) { const float InvTotal = 1.0f / FMath::Max(InColor.R + InColor.G + InColor.B, (float)SMALL_NUMBER); return FLinearColor(InColor.R * InvTotal, InColor.G * InvTotal, InColor.B * InvTotal, InColor.G); }
void FRCPassPostProcessNoiseBlur::Process(FRenderingCompositePassContext& Context) { SCOPED_DRAW_EVENT(Context.RHICmdList, NoiseBlur); const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0); if(!InputDesc) { // input is not hooked up correctly return; } const FSceneView& View = Context.View; const FSceneViewFamily& ViewFamily = *(View.Family); FIntPoint SrcSize = InputDesc->Extent; FIntPoint DestSize = PassOutputs[0].RenderTargetDesc.Extent; // e.g. 4 means the input texture is 4x smaller than the buffer size uint32 ScaleFactor = GSceneRenderTargets.GetBufferSizeXY().X / SrcSize.X; FIntRect SrcRect = View.ViewRect / ScaleFactor; FIntRect DestRect = SrcRect; const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context); // Set the view family's render target/viewport. SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef()); // is optimized away if possible (RT size=view size, ) Context.RHICmdList.Clear(true, FLinearColor(0, 0, 0, 0), false, 1.0f, false, 0, DestRect); Context.SetViewportAndCallRHI(0, 0, 0.0f, DestSize.X, DestSize.Y, 1.0f ); // set the state Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI()); Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI()); Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI()); if(Quality == 0) { SetNoiseBlurShader<0>(Context, Radius); } else if(Quality == 1) { SetNoiseBlurShader<1>(Context, Radius); } else { SetNoiseBlurShader<2>(Context, Radius); } // Draw a quad mapping scene color to the view's render target TShaderMapRef<FPostProcessVS> VertexShader(Context.GetShaderMap()); 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()); }
/** Diff result when a pin type was changed */ static void DiffR_PinTypeChanged(FDiffResults& Results, class UEdGraphPin* Pin2, class UEdGraphPin* Pin1) { if(Results) { FEdGraphPinType Type1 = Pin1->PinType; FEdGraphPinType Type2 = Pin2->PinType; FDiffSingleResult Diff; const UObject* T1Obj = Type1.PinSubCategoryObject.Get(); const UObject* T2Obj = Type2.PinSubCategoryObject.Get(); if(Type1.PinCategory != Type2.PinCategory) { Diff.Diff = EDiffType::PIN_TYPE_CATEGORY; Diff.ToolTip = FText::Format(LOCTEXT("DIF_PinCategoryToolTipFmt", "Pin '{0}' Category was '{1}', but is now '{2}"), FText::FromString(Pin2->PinName), FText::FromString(Pin1->PinType.PinCategory), FText::FromString(Pin2->PinType.PinCategory)); Diff.DisplayColor = FLinearColor(0.15f,0.53f,0.15f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_PinCategoryFmt", "Pin Category '{0}' ['{1}' -> '{2}']"), FText::FromString(Pin2->PinName), FText::FromString(Pin1->PinType.PinCategory), FText::FromString(Pin2->PinType.PinCategory)); } else if(Type1.PinSubCategory != Type2.PinSubCategory) { Diff.Diff = EDiffType::PIN_TYPE_SUBCATEGORY; Diff.ToolTip = FText::Format(LOCTEXT("DIF_PinSubCategoryToolTipFmt", "Pin '{0}' SubCategory was '{1}', but is now '{2}"), FText::FromString(Pin2->PinName), FText::FromString(Pin1->PinType.PinSubCategory), FText::FromString(Pin2->PinType.PinSubCategory)); Diff.DisplayColor = FLinearColor(0.45f,0.53f,0.65f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_PinSubCategoryFmt", "Pin SubCategory '{0}' ['{1}' -> '{2}']"), FText::FromString(Pin2->PinName), FText::FromString(Pin1->PinType.PinSubCategory), FText::FromString(Pin2->PinType.PinSubCategory)); } else if(T1Obj != T2Obj && (T1Obj && T2Obj ) && (T1Obj->GetFName() != T2Obj->GetFName())) { FString Obj1 = T1Obj->GetFName().ToString(); FString Obj2 = T2Obj->GetFName().ToString(); Diff.Diff = EDiffType::PIN_TYPE_SUBCATEGORY_OBJECT; Diff.ToolTip = FText::Format(LOCTEXT("DIF_PinSubCategorObjToolTipFmt", "Pin '{0}' was SubCategoryObject '{1}', but is now '{2}"), FText::FromString(Pin2->PinName), FText::FromString(Obj1), FText::FromString(Obj2)); Diff.DisplayColor = FLinearColor(0.45f,0.13f,0.25f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_PinSubCategoryObjFmt", "Pin SubCategoryObject '{0}' ['{1}' -> '{2}']"), FText::FromString(Pin2->PinName), FText::FromString(Obj1), FText::FromString(Obj2)); } else if(Type1.bIsArray != Type2.bIsArray) { Diff.Diff = EDiffType::PIN_TYPE_IS_ARRAY; FText IsArray1 = Pin1->PinType.bIsArray ? LOCTEXT("true", "true") : LOCTEXT("false", "false"); FText IsArray2 = Pin2->PinType.bIsArray ? LOCTEXT("true", "true") : LOCTEXT("false", "false"); Diff.ToolTip = FText::Format(LOCTEXT("DIF_PinIsArrayToolTipFmt", "PinType IsArray for '{0}' modified. Was '{1}', but is now '{2}"), FText::FromString(Pin2->PinName), IsArray1, IsArray2); Diff.DisplayString = FText::Format(LOCTEXT("DIF_PinIsArrayFmt", "Pin IsArray '{0}' ['{1}' -> '{2}']"), FText::FromString(Pin2->PinName), IsArray1, IsArray2); Diff.DisplayColor = FLinearColor(0.45f,0.33f,0.35f); } else if(Type1.bIsReference != Type2.bIsReference) { Diff.Diff = EDiffType::PIN_TYPE_IS_REF; FText IsRef1 = Pin1->PinType.bIsReference ? LOCTEXT("true", "true") : LOCTEXT("false", "false"); FText IsRef2 = Pin2->PinType.bIsReference ? LOCTEXT("true", "true") : LOCTEXT("false", "false"); Diff.ToolTip = FText::Format(LOCTEXT("DIF_PinIsRefToolTipFmt", "PinType IsReference for '{0}' modified. Was '{1}', but is now '{2}"), FText::FromString(Pin2->PinName), IsRef1, IsRef2); Diff.DisplayColor = FLinearColor(0.25f,0.43f,0.35f); Diff.DisplayString = FText::Format(LOCTEXT("DIF_PinIsRefFmt", "Pin IsReference '{0}' ['{1}' -> '{2}']"), FText::FromString(Pin2->PinName), IsRef1, IsRef2); } Diff.Pin1 = Pin1; Diff.Pin2 = Pin2; Results.Add(Diff); } }
void AAbilitySystemDebugHUD::DrawWithBackground(UFont* InFont, const FString& Text, const FColor& TextColor, EAlignHorizontal::Type HAlign, float& OffsetX, EAlignVertical::Type VAlign, float& OffsetY, float Alpha) { float SizeX, SizeY; Canvas->StrLen(InFont, Text, SizeX, SizeY); const float PosX = (HAlign == EAlignHorizontal::Center) ? OffsetX + (Canvas->ClipX - SizeX) * 0.5f : (HAlign == EAlignHorizontal::Left) ? Canvas->OrgX + OffsetX : Canvas->ClipX - SizeX - OffsetX; const float PosY = (VAlign == EAlignVertical::Center) ? OffsetY + (Canvas->ClipY - SizeY) * 0.5f : (VAlign == EAlignVertical::Top) ? Canvas->OrgY + OffsetY : Canvas->ClipY - SizeY - OffsetY; const float BoxPadding = 5.0f; const float X = PosX - BoxPadding; const float Y = PosY - BoxPadding; const float Z = 0.1f; FCanvasTileItem TileItem(FVector2D(X, Y), FVector2D(SizeX + BoxPadding * 2.0f, SizeY + BoxPadding * 2.0f), FLinearColor(0.75f, 0.75f, 0.75f, Alpha)); Canvas->DrawItem(TileItem); FLinearColor TextCol(TextColor); TextCol.A = Alpha; FCanvasTextItem TextItem(FVector2D(PosX, PosY), FText::FromString(Text), GEngine->GetSmallFont(), TextCol); Canvas->DrawItem(TextItem); OffsetY += 25; }
void AGameplayDebuggingHUDComponent::DrawEQSItemDetails(int32 ItemIdx, class UGameplayDebuggingComponent *DebugComponent) { #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) && WITH_EQS const float PosY = DefaultContext.CursorY + 1.0f; float PosX = DefaultContext.CursorX; const int32 EQSIndex = DebugComponent->EQSLocalData.Num() > 0 ? FMath::Clamp(DebugComponent->CurrentEQSIndex, 0, DebugComponent->EQSLocalData.Num() - 1) : INDEX_NONE; auto& CurrentLocalData = DebugComponent->EQSLocalData[EQSIndex]; const EQSDebug::FItemData& ItemData = CurrentLocalData.Items[ItemIdx]; PrintString(DefaultContext, FColor::White, ItemData.Desc, PosX, PosY); PosX += ItemDescriptionWidth; FString ScoreDesc = FString::Printf(TEXT("%.2f"), ItemData.TotalScore); PrintString(DefaultContext, FColor::Yellow, ScoreDesc, PosX, PosY); PosX += ItemScoreWidth; FCanvasTileItem ActiveTileItem(FVector2D(0, PosY + 15.0f), GWhiteTexture, FVector2D(0, 2.0f), FLinearColor::Yellow); FCanvasTileItem BackTileItem(FVector2D(0, PosY + 15.0f), GWhiteTexture, FVector2D(0, 2.0f), FLinearColor(0.1f, 0.1f, 0.1f)); const float BarWidth = 80.0f; const int32 NumTests = ItemData.TestScores.Num(); float TotalWeightedScore = 0.0f; for (int32 Idx = 0; Idx < NumTests; Idx++) { TotalWeightedScore += ItemData.TestScores[Idx]; } for (int32 Idx = 0; Idx < NumTests; Idx++) { const float ScoreW = ItemData.TestScores[Idx]; const float ScoreN = ItemData.TestValues[Idx]; FString DescScoreW = FString::Printf(TEXT("%.2f"), ScoreW); FString DescScoreN = (ScoreN == UEnvQueryTypes::SkippedItemValue) ? TEXT("SKIP") : FString::Printf(TEXT("%.2f"), ScoreN); FString TestDesc = DescScoreW + FString(" {LightBlue}") + DescScoreN; float Pct = (TotalWeightedScore > KINDA_SMALL_NUMBER) ? (ScoreW / TotalWeightedScore) : 0.0f; ActiveTileItem.Position.X = PosX; ActiveTileItem.Size.X = BarWidth * Pct; BackTileItem.Position.X = PosX + ActiveTileItem.Size.X; BackTileItem.Size.X = FMath::Max(BarWidth * (1.0f - Pct), 0.0f); DrawItem(DefaultContext, ActiveTileItem, ActiveTileItem.Position.X, ActiveTileItem.Position.Y); DrawItem(DefaultContext, BackTileItem, BackTileItem.Position.X, BackTileItem.Position.Y); PrintString(DefaultContext, FColor::Green, TestDesc, PosX, PosY); PosX += TestScoreWidth; } #endif //!(UE_BUILD_SHIPPING || UE_BUILD_TEST) && WITH_EQS }
void FSteamVRHMD::RenderTexture_RenderThread(FRHICommandListImmediate& RHICmdList, FTexture2DRHIParamRef BackBuffer, FTexture2DRHIParamRef SrcTexture) const { check(IsInRenderingThread()); UpdateLayerTextures(); if (bSplashIsShown) { SetRenderTarget(RHICmdList, SrcTexture, FTextureRHIRef()); RHICmdList.Clear(true, FLinearColor(0, 0, 0, 0), false, (float)ERHIZBuffer::FarPlane, false, 0, FIntRect()); } if (WindowMirrorMode != 0) { const uint32 ViewportWidth = BackBuffer->GetSizeX(); const uint32 ViewportHeight = BackBuffer->GetSizeY(); SetRenderTarget(RHICmdList, BackBuffer, FTextureRHIRef()); RHICmdList.SetViewport(0, 0, 0, ViewportWidth, ViewportHeight, 1.0f); RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI()); RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI()); RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI()); const auto FeatureLevel = GMaxRHIFeatureLevel; auto ShaderMap = GetGlobalShaderMap(FeatureLevel); TShaderMapRef<FScreenVS> VertexShader(ShaderMap); TShaderMapRef<FScreenPS> PixelShader(ShaderMap); static FGlobalBoundShaderState BoundShaderState; SetGlobalBoundShaderState(RHICmdList, FeatureLevel, BoundShaderState, RendererModule->GetFilterVertexDeclaration().VertexDeclarationRHI, *VertexShader, *PixelShader); PixelShader->SetParameters(RHICmdList, TStaticSamplerState<SF_Bilinear>::GetRHI(), SrcTexture); if (WindowMirrorMode == 1) { // need to clear when rendering only one eye since the borders won't be touched by the DrawRect below RHICmdList.Clear(true, FLinearColor::Black, false, 0, false, 0, FIntRect()); RendererModule->DrawRectangle( RHICmdList, ViewportWidth / 4, 0, ViewportWidth / 2, ViewportHeight, 0.1f, 0.2f, 0.3f, 0.6f, FIntPoint(ViewportWidth, ViewportHeight), FIntPoint(1, 1), *VertexShader, EDRF_Default); } else if (WindowMirrorMode == 2) { RendererModule->DrawRectangle( RHICmdList, 0, 0, ViewportWidth, ViewportHeight, 0.0f, 0.0f, 1.0f, 1.0f, FIntPoint(ViewportWidth, ViewportHeight), FIntPoint(1, 1), *VertexShader, EDRF_Default); } } }
int32 SObjectNameEditableTextBox::OnPaint( const FPaintArgs& Args, const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, const FWidgetStyle& InWidgetStyle, bool bParentEnabled ) const { int32 StartLayer = SCompoundWidget::OnPaint( Args, AllottedGeometry, MyClippingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled ); const int32 TextLayer = 1; // See if a disabled effect should be used bool bEnabled = ShouldBeEnabled( bParentEnabled ); ESlateDrawEffect::Type DrawEffects = (bEnabled) ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect; const double CurrentTime = FSlateApplication::Get().GetCurrentTime(); // Draw highlight targeting effect const float TimeSinceHighlightInteraction = (float)( CurrentTime - LastCommittedTime ); if( TimeSinceHighlightInteraction <= HighlightTargetEffectDuration ) { // Compute animation progress float EffectAlpha = FMath::Clamp( TimeSinceHighlightInteraction / HighlightTargetEffectDuration, 0.0f, 1.0f ); EffectAlpha = 1.0f - EffectAlpha * EffectAlpha; // Inverse square falloff (looks nicer!) float EffectOpacity = EffectAlpha; // Figure out a universally visible highlight color. FLinearColor HighlightTargetColorAndOpacity = ( (FLinearColor::White - ColorAndOpacity.Get())*0.5f + FLinearColor(+0.4f, +0.1f, -0.2f)) * InWidgetStyle.GetColorAndOpacityTint(); HighlightTargetColorAndOpacity.A = HighlightTargetOpacity * EffectOpacity * 255.0f; // Compute the bounds offset of the highlight target from where the highlight target spring // extents currently lie. This is used to "grow" or "shrink" the highlight as needed. const float CommittingAnimOffset = CommittingAnimOffsetPercent * AllottedGeometry.Size.Y; // Choose an offset amount depending on whether we're highlighting, or clearing highlight const float EffectOffset = EffectAlpha * CommittingAnimOffset; const float HighlightLeftX = HighlightTargetLeftSpring.GetPosition() - EffectOffset; const float HighlightRightX = HighlightTargetRightSpring.GetPosition() + EffectOffset; const float HighlightTopY = 0.0f - EffectOffset; const float HighlightBottomY = AllottedGeometry.Size.Y + EffectOffset; const FVector2D DrawPosition = FVector2D( HighlightLeftX, HighlightTopY ); const FVector2D DrawSize = FVector2D( HighlightRightX - HighlightLeftX, HighlightBottomY - HighlightTopY ); const FSlateBrush* StyleInfo = FEditorStyle::GetBrush("DetailsView.NameChangeCommitted"); // NOTE: We rely on scissor clipping for the highlight rectangle FSlateDrawElement::MakeBox( OutDrawElements, LayerId + TextLayer, AllottedGeometry.ToPaintGeometry( DrawPosition, DrawSize ), // Position, Size, Scale StyleInfo, // Style MyClippingRect, // Clipping rect DrawEffects, // Effects to use HighlightTargetColorAndOpacity ); // Color } return LayerId + TextLayer; }
FLinearColor UK2Node_Switch::GetNodeTitleColor() const { // Use yellow for now return FLinearColor(255.0f, 255.0f, 0.0f); }
FLinearColor FCurveAssetEditor::GetWorldCentricTabColorScale() const { return FLinearColor( 0.0f, 0.0f, 0.2f, 0.5f ); }
void FRCPassPostProcessScreenSpaceReflections::Process(FRenderingCompositePassContext& Context) { SCOPED_DRAW_EVENT(Context.RHICmdList, ScreenSpaceReflections); const FSceneView& View = Context.View; const auto FeatureLevel = Context.GetFeatureLevel(); const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context); // Set the view family's render target/viewport. SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef()); Context.RHICmdList.Clear(true, FLinearColor(0, 0, 0, 0), false, 1.0f, false, 0, FIntRect()); Context.SetViewportAndCallRHI(View.ViewRect); // set the state Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI()); Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI()); Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI()); int SSRQuality = ComputeSSRQuality(View.FinalPostProcessSettings.ScreenSpaceReflectionQuality); SSRQuality = FMath::Clamp(SSRQuality, 1, 4); uint32 iPreFrame = bPrevFrame ? 1 : 0; if (View.Family->EngineShowFlags.VisualizeSSR) { iPreFrame = 0; SSRQuality = 0; } TShaderMapRef< FPostProcessVS > VertexShader(Context.GetShaderMap()); #define CASE(A, B) \ case (A + 2 * (B + 3 * 0 )): \ { \ TShaderMapRef< FPostProcessScreenSpaceReflectionsPS<A, B> > PixelShader(Context.GetShaderMap()); \ static FGlobalBoundShaderState BoundShaderState; \ SetGlobalBoundShaderState(Context.RHICmdList, FeatureLevel, BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader); \ VertexShader->SetParameters(Context); \ PixelShader->SetParameters(Context); \ }; \ break switch (iPreFrame + 2 * (SSRQuality + 3 * 0)) { CASE(0,0); CASE(0,1); CASE(1,1); CASE(0,2); CASE(1,2); CASE(0,3); CASE(1,3); CASE(0,4); CASE(1,4); default: check(!"Missing case in FRCPassPostProcessScreenSpaceReflections"); } #undef CASE // Draw a quad mapping scene color to the view's render target DrawRectangle( Context.RHICmdList, 0, 0, View.ViewRect.Width(), View.ViewRect.Height(), View.ViewRect.Min.X, View.ViewRect.Min.Y, View.ViewRect.Width(), View.ViewRect.Height(), View.ViewRect.Size(), GSceneRenderTargets.GetBufferSizeXY(), *VertexShader, EDRF_UseTriangleOptimization); Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams()); }
void FCodeEditorStyle::Initialize() { // Only register once if( StyleSet.IsValid() ) { return; } StyleSet = MakeShareable(new FSlateStyleSet("CodeEditor") ); StyleSet->SetContentRoot(FPaths::EnginePluginsDir() / TEXT("Experimental/CodeEditor/Resources")); // Icons { StyleSet->Set("CodeEditor.TabIcon", new IMAGE_BRUSH("UI/CodeEditor_16x", Icon16x16)); StyleSet->Set("CodeEditor.Save", new IMAGE_BRUSH("UI/Save_40x", Icon40x40)); StyleSet->Set("CodeEditor.Save.Small", new IMAGE_BRUSH("UI/Save_40x", Icon16x16)); StyleSet->Set("CodeEditor.SaveAll", new IMAGE_BRUSH("UI/SaveAll_40x", Icon40x40)); StyleSet->Set("CodeEditor.SaveAll.Small", new IMAGE_BRUSH("UI/SaveAll_40x", Icon16x16)); } const FSlateFontInfo Consolas10 = TTF_FONT("Font/DroidSansMono", 9); const FTextBlockStyle NormalText = FTextBlockStyle() .SetFont(Consolas10) .SetColorAndOpacity(FLinearColor::White) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black) .SetHighlightColor(FLinearColor(0.02f, 0.3f, 0.0f)) .SetHighlightShape(BOX_BRUSH("UI/TextBlockHighlightShape", FMargin(3.f / 8.f))); // Text editor { StyleSet->Set("TextEditor.NormalText", NormalText); StyleSet->Set("SyntaxHighlight.CPP.Normal", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffdfd706))));// yellow StyleSet->Set("SyntaxHighlight.CPP.Operator", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffcfcfcf)))); // light grey StyleSet->Set("SyntaxHighlight.CPP.Keyword", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff006ab4)))); // blue StyleSet->Set("SyntaxHighlight.CPP.String", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff9e4a1e)))); // pinkish StyleSet->Set("SyntaxHighlight.CPP.Number", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff6db3a8)))); // cyan StyleSet->Set("SyntaxHighlight.CPP.Comment", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff57a64a)))); // green StyleSet->Set("SyntaxHighlight.CPP.PreProcessorKeyword", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffcfcfcf)))); // light grey StyleSet->Set("TextEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.02f,0.02f,0.02f,1))); const FEditableTextBoxStyle EditableTextBoxStyle = FEditableTextBoxStyle() .SetBackgroundImageNormal( FSlateNoResource() ) .SetBackgroundImageHovered( FSlateNoResource() ) .SetBackgroundImageFocused( FSlateNoResource() ) .SetBackgroundImageReadOnly( FSlateNoResource() ); StyleSet->Set("TextEditor.EditableTextBox", EditableTextBoxStyle); } // Project editor { StyleSet->Set("ProjectEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.048f,0.048f,0.048f,1))); StyleSet->Set("ProjectEditor.Icon.Project", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1))); StyleSet->Set("ProjectEditor.Icon.Folder", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1))); StyleSet->Set("ProjectEditor.Icon.File", new IMAGE_BRUSH("UI/GenericFile", Icon16x16)); StyleSet->Set("ProjectEditor.Icon.GenericFile", new IMAGE_BRUSH("UI/GenericFile", Icon16x16)); } FSlateStyleRegistry::RegisterSlateStyle( *StyleSet.Get() ); }
void ULeapMotionImageComponent::UpdateImageTexture() { FLeapMotionDevice* Device = FLeapMotionControllerPlugin::GetLeapDeviceSafe(); if (Device && Device->IsConnected()) { Device->SetReferenceFrameOncePerTick(); } if (Device && Device->IsConnected() && Device->Frame().images().count() > 1) { Leap::ImageList ImageList = Device->Frame().images(); for (int eye = 0; eye < 2; eye++) { Leap::Image Image = ImageList[eye]; bool isRGB = Image.format() != Leap::Image::INFRARED; UTexture2D*& Texture = eye ? ImagePassthroughRight : ImagePassthroughLeft; UTexture2D*& Distortion = eye ? DistortionTextureRight : DistortionTextureLeft; // Recreate the image & distortion textures. if (!Texture || Image.width() != Texture->PlatformData->SizeX || Image.height() != Texture->PlatformData->SizeY) { EPixelFormat PixelFormat = !isRGB ? PF_G8 : PF_R8G8B8A8; Texture = UTexture2D::CreateTransient(Image.width(), Image.height(), PixelFormat); Texture->SRGB = 0; Texture->UpdateResource(); Distortion = BuildDistortionTextures(Image); if (isRGB) { DynamicPassthroughMaterial->SetTextureParameterValue(eye ? TEXT("BaseTextureRGB_Right") : TEXT("BaseTextureRGB"), Texture); DynamicPassthroughMaterial->SetScalarParameterValue(TEXT("ImageFormat"), 1.0); } else { DynamicPassthroughMaterial->SetTextureParameterValue(eye ? TEXT("BaseTextureIR_Right") : TEXT("BaseTextureIR"), Texture); DynamicPassthroughMaterial->SetScalarParameterValue(TEXT("ImageFormat"), -1.0); } DynamicPassthroughMaterial->SetTextureParameterValue(eye ? TEXT("DistortionTextureRight") : TEXT("DistortionTexture"), Distortion); if (GEngine && GEngine->GameViewport && GEngine->GameViewport->Viewport) { FIntPoint Resolution = GEngine->GameViewport->Viewport->GetSizeXY(); FLinearColor ScreenRes = FLinearColor(Resolution.X, Resolution.Y, 0.f, 0.f); DynamicPassthroughMaterial->SetVectorParameterValue(TEXT("ScreenResolution"), ScreenRes); } AttachDisplaySurface(); } // Extract the image { UTexture2D*& Texture = eye ? ImagePassthroughRight : ImagePassthroughLeft; const uint8* LeapData = Image.data(); const int LeapDataSize = Image.width() * Image.height() * Image.bytesPerPixel(); //Check for dragonfly if (!isRGB) { uint8* Dest = (uint8*)Texture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); FMemory::Memcpy(Dest, LeapData, LeapDataSize); } else { uint32* Dest = (uint32*)Texture->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE); FMemory::Memcpy(Dest, LeapData, LeapDataSize); } Texture->PlatformData->Mips[0].BulkData.Unlock(); Texture->UpdateResource(); } // Hack: need to update distortion texture every frame to handle device flipping. UpdateDistortionTextures(Image, Distortion); } const bool bUsingHmd = GEngine->HMDDevice.IsValid() && GEngine->HMDDevice->IsHeadTrackingAllowed(); DynamicPassthroughMaterial->SetScalarParameterValue("HorizontalTanHalfFOV", bUsingHmd ? 1.4f : 1.0f); } else { // We can't find two images, that might be due to device being detached & maybe exchanged later -- trigger reset. ImagePassthroughLeft = nullptr; ImagePassthroughRight = nullptr; DistortionTextureLeft = nullptr; DistortionTextureRight = nullptr; } }
int32 FVisualLoggerTimeSliderController::OnPaintSectionView( const FGeometry& AllottedGeometry, const FSlateRect& MyClippingRect, FSlateWindowElementList& OutDrawElements, int32 LayerId, bool bEnabled, bool bDisplayTickLines, bool bDisplayScrubPosition ) const { const ESlateDrawEffect::Type DrawEffects = bEnabled ? ESlateDrawEffect::None : ESlateDrawEffect::DisabledEffect; TRange<float> LocalViewRange = TimeSliderArgs.ViewRange.Get(); float LocalScrubPosition = TimeSliderArgs.ScrubPosition.Get(); float ViewRange = LocalViewRange.Size<float>(); float PixelsPerInput = ViewRange > 0 ? AllottedGeometry.Size.X / ViewRange : 0; float LinePos = (LocalScrubPosition - LocalViewRange.GetLowerBoundValue()) * PixelsPerInput; FScrubRangeToScreen RangeToScreen( LocalViewRange, AllottedGeometry.Size ); if( bDisplayTickLines ) { // Draw major tick lines in the section area FDrawTickArgs Args; Args.AllottedGeometry = AllottedGeometry; Args.bMirrorLabels = false; Args.bOnlyDrawMajorTicks = true; Args.TickColor = FLinearColor( 0.3f, 0.3f, 0.3f, 0.3f ); Args.ClippingRect = MyClippingRect; Args.DrawEffects = DrawEffects; // Draw major ticks under sections Args.StartLayer = LayerId-1; // Draw the tick the entire height of the section area Args.TickOffset = 0.0f; Args.MajorTickHeight = AllottedGeometry.Size.Y; DrawTicks( OutDrawElements, RangeToScreen, Args ); } if( bDisplayScrubPosition ) { // Draw cursor size const float CursorHalfSize = TimeSliderArgs.CursorSize.Get() * 0.5f; const float CursorHalfLength = AllottedGeometry.Size.X * CursorHalfSize; FPaintGeometry CursorGeometry = AllottedGeometry.ToPaintGeometry(FVector2D(LinePos - CursorHalfLength, 0), FVector2D(2 * CursorHalfLength, AllottedGeometry.Size.Y)); FSlateDrawElement::MakeBox( OutDrawElements, ++LayerId, CursorGeometry, CursorBackground, MyClippingRect, DrawEffects, FLinearColor::White.CopyWithNewOpacity(0.08f) ); // Draw a line for the scrub position TArray<FVector2D> LinePoints; LinePoints.AddUninitialized(2); LinePoints[0] = FVector2D( 1.0f, 0.0f ); LinePoints[1] = FVector2D( 1.0f, FMath::RoundToFloat( AllottedGeometry.Size.Y ) ); FSlateDrawElement::MakeLines( OutDrawElements, ++LayerId, AllottedGeometry.ToPaintGeometry( FVector2D(LinePos, 0.0f ), FVector2D(1.0f,1.0f) ), LinePoints, MyClippingRect, DrawEffects, FLinearColor::White.CopyWithNewOpacity(0.39f), false ); } return LayerId; }
TSharedRef<SWidget> SCAQueryTableRow::GenerateWidgetForColumn(const FName& ColumnName) { TSharedPtr<SCollisionAnalyzer> OwnerAnalyzerWidget = OwnerAnalyzerWidgetPtr.Pin(); // GROUP if(Item->bIsGroup) { if (ColumnName == TEXT("ID")) { return SNew(SExpanderArrow, SharedThis(this)); } else if (ColumnName == TEXT("Frame") && OwnerAnalyzerWidget->GroupBy == EQueryGroupMode::ByFrameNum) { return SNew(STextBlock) .Font(FEditorStyle::GetFontStyle("BoldFont")) .Text(FText::AsNumber(Item->FrameNum)); } else if (ColumnName == TEXT("Tag") && OwnerAnalyzerWidget->GroupBy == EQueryGroupMode::ByTag) { return SNew(STextBlock) .Font(FEditorStyle::GetFontStyle("BoldFont")) .Text(FText::FromName(Item->GroupName)); } else if (ColumnName == TEXT("Owner") && OwnerAnalyzerWidget->GroupBy == EQueryGroupMode::ByOwnerTag) { return SNew(STextBlock) .Font(FEditorStyle::GetFontStyle("BoldFont")) .Text(FText::FromName(Item->GroupName)); } else if (ColumnName == TEXT("Time")) { return SNew(STextBlock) .Font(FEditorStyle::GetFontStyle("BoldFont")) .Text(this, &SCAQueryTableRow::GetTotalTimeText); } } // ITEM else { const int32 QueryId = Item->QueryIndex; if(QueryId >= OwnerAnalyzerWidget->Analyzer->Queries.Num()) { return SNew(STextBlock) .Text( LOCTEXT("ErrorMessage", "ERROR") ); } FCAQuery& Query = OwnerAnalyzerWidget->Analyzer->Queries[QueryId]; if (ColumnName == TEXT("ID")) { return SNew(STextBlock) .Text( FText::AsNumber(QueryId) ); } else if (ColumnName == TEXT("Frame")) { return SNew(STextBlock) .Text( FText::AsNumber(Query.FrameNum) ); } else if (ColumnName == TEXT("Type")) { return SNew(STextBlock) .Text(FText::FromString(SCollisionAnalyzer::QueryTypeToString(Query.Type))); } else if (ColumnName == TEXT("Shape")) { return SNew(STextBlock) .Text(FText::FromString(SCollisionAnalyzer::QueryShapeToString(Query.Shape))); } else if (ColumnName == TEXT("Tag")) { return SNew(STextBlock) .Text(FText::FromName(Query.Params.TraceTag)); } else if (ColumnName == TEXT("Owner")) { return SNew(STextBlock) .Text(FText::FromName(Query.Params.OwnerTag)); } else if (ColumnName == TEXT("NumBlock")) { FHitResult* FirstHit = FHitResult::GetFirstBlockingHit(Query.Results); bool bStartPenetrating = (FirstHit != NULL) && FirstHit->bStartPenetrating; // Draw number in red if we start penetrating return SNew(STextBlock) .Text(FText::AsNumber(FHitResult::GetNumBlockingHits(Query.Results))) .ColorAndOpacity(bStartPenetrating ? FLinearColor(1.f,0.25f,0.25f) : FSlateColor::UseForeground() ); } else if (ColumnName == TEXT("NumTouch")) { return SNew(STextBlock) .Text(FText::AsNumber(FHitResult::GetNumOverlapHits(Query.Results))); } else if (ColumnName == TEXT("Time")) { static const FNumberFormattingOptions TimeFormatOptions = FNumberFormattingOptions() .SetMinimumFractionalDigits(3) .SetMaximumFractionalDigits(3); return SNew(STextBlock) .Text(FText::AsNumber(Query.CPUTime, &TimeFormatOptions)); } } return SNullWidget::NullWidget; }
FLinearColor UAnimGraphNode_RotateRootBone::GetNodeTitleColor() const { return FLinearColor(0.7f, 0.7f, 0.7f); }
FLinearColor UAnimGraphNode_Mirror::GetNodeTitleColor() const { return FLinearColor(0, 12, 12, 1); }
FLinearColor UK2Node_Timeline::GetNodeTitleColor() const { return FLinearColor(1.0f, 0.51f, 0.0f); }
UWALandscapeNode::UWALandscapeNode() { BackgroundColor = FLinearColor(0.0f, 0.0f, 0.0f, 1.0f); }
void FRCPassPostProcessMotionBlurSetup::Process(FRenderingCompositePassContext& Context) { SCOPED_DRAW_EVENT(Context.RHICmdList, MotionBlurSetup); const FPooledRenderTargetDesc* InputDesc = GetInputDesc(ePId_Input0); if(!InputDesc) { // input is not hooked up correctly return; } const FSceneView& View = Context.View; const FSceneViewFamily& ViewFamily = *(View.Family); FIntPoint SrcSize = InputDesc->Extent; FIntPoint DestSize = PassOutputs[0].RenderTargetDesc.Extent; // e.g. 4 means the input texture is 4x smaller than the buffer size uint32 ScaleFactor = GSceneRenderTargets.GetBufferSizeXY().X / SrcSize.X; FIntRect SrcRect = View.ViewRect / ScaleFactor; // Viewport size not even also causes issue FIntRect DestRect = FIntRect::DivideAndRoundUp(SrcRect, 2); const FSceneRenderTargetItem& DestRenderTarget0 = PassOutputs[0].RequestSurface(Context); const FSceneRenderTargetItem& DestRenderTarget1 = PassOutputs[1].RequestSurface(Context); // Set the view family's render target/viewport. FTextureRHIParamRef RenderTargets[] = { DestRenderTarget0.TargetableTexture, DestRenderTarget1.TargetableTexture }; SetRenderTargets(Context.RHICmdList, ARRAY_COUNT(RenderTargets), RenderTargets, FTextureRHIParamRef(), 0, NULL); // is optimized away if possible (RT size=view size, ) FLinearColor ClearColors[2] = {FLinearColor(0,0,0,0), FLinearColor(0,0,0,0)}; Context.RHICmdList.ClearMRT(true, 2, ClearColors, false, 1.0f, false, 0, DestRect); Context.SetViewportAndCallRHI(0, 0, 0.0f, DestSize.X, DestSize.Y, 1.0f ); // set the state Context.RHICmdList.SetBlendState(TStaticBlendState<>::GetRHI()); Context.RHICmdList.SetRasterizerState(TStaticRasterizerState<>::GetRHI()); Context.RHICmdList.SetDepthStencilState(TStaticDepthStencilState<false, CF_Always>::GetRHI()); TShaderMapRef<FPostProcessMotionBlurSetupVS> VertexShader(Context.GetShaderMap()); { TShaderMapRef<FPostProcessMotionBlurSetupPS > PixelShader(Context.GetShaderMap()); static FGlobalBoundShaderState BoundShaderState; SetGlobalBoundShaderState(Context.RHICmdList, Context.GetFeatureLevel(), BoundShaderState, GFilterVertexDeclaration.VertexDeclarationRHI, *VertexShader, *PixelShader); PixelShader->SetParameters(Context); VertexShader->SetParameters(Context); } // Draw a quad mapping scene color to the view's render target 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(DestRenderTarget0.TargetableTexture, DestRenderTarget0.ShaderResourceTexture, false, FResolveParams()); Context.RHICmdList.CopyToResolveTarget(DestRenderTarget1.TargetableTexture, DestRenderTarget1.ShaderResourceTexture, false, FResolveParams()); }
static void UpdatePlanarReflectionContents_RenderThread( FRHICommandListImmediate& RHICmdList, FSceneRenderer* MainSceneRenderer, FSceneRenderer* SceneRenderer, const FPlanarReflectionSceneProxy* SceneProxy, FRenderTarget* RenderTarget, FTexture* RenderTargetTexture, const FPlane& MirrorPlane, const FName OwnerName, const FResolveParams& ResolveParams, bool bUseSceneColorTexture) { QUICK_SCOPE_CYCLE_COUNTER(STAT_RenderPlanarReflection); FBox PlanarReflectionBounds = SceneProxy->WorldBounds; bool bIsInAnyFrustum = false; for (int32 ViewIndex = 0; ViewIndex < SceneRenderer->Views.Num(); ++ViewIndex) { FViewInfo& View = SceneRenderer->Views[ViewIndex]; if (View.ViewFrustum.IntersectBox(PlanarReflectionBounds.GetCenter(), PlanarReflectionBounds.GetExtent())) { bIsInAnyFrustum = true; break; } } if (bIsInAnyFrustum) { bool bIsVisibleInAnyView = true; for (int32 ViewIndex = 0; ViewIndex < SceneRenderer->Views.Num(); ++ViewIndex) { FViewInfo& View = SceneRenderer->Views[ViewIndex]; FSceneViewState* ViewState = View.ViewState; if (ViewState) { FIndividualOcclusionHistory& OcclusionHistory = ViewState->PlanarReflectionOcclusionHistories.FindOrAdd(SceneProxy->PlanarReflectionId); // +1 to buffered frames because the query is submitted late into the main frame, but read at the beginning of a reflection capture frame const int32 NumBufferedFrames = FOcclusionQueryHelpers::GetNumBufferedFrames() + 1; // +1 to frame counter because we are operating before the main view's InitViews, which is where OcclusionFrameCounter is incremented uint32 OcclusionFrameCounter = ViewState->OcclusionFrameCounter + 1; FRenderQueryRHIRef& PastQuery = OcclusionHistory.GetPastQuery(OcclusionFrameCounter, NumBufferedFrames); if (IsValidRef(PastQuery)) { uint64 NumSamples = 0; QUICK_SCOPE_CYCLE_COUNTER(STAT_PlanarReflectionOcclusionQueryResults); if (RHIGetRenderQueryResult(PastQuery.GetReference(), NumSamples, true)) { bIsVisibleInAnyView = NumSamples > 0; if (bIsVisibleInAnyView) { break; } } } } } if (bIsVisibleInAnyView) { FMemMark MemStackMark(FMemStack::Get()); // update any resources that needed a deferred update FDeferredUpdateResource::UpdateResources(RHICmdList); { #if WANTS_DRAW_MESH_EVENTS FString EventName; OwnerName.ToString(EventName); SCOPED_DRAW_EVENTF(RHICmdList, SceneCapture, TEXT("PlanarReflection %s"), *EventName); #else SCOPED_DRAW_EVENT(RHICmdList, UpdatePlanarReflectionContent_RenderThread); #endif const FRenderTarget* Target = SceneRenderer->ViewFamily.RenderTarget; SetRenderTarget(RHICmdList, Target->GetRenderTargetTexture(), NULL, true); // Note: relying on GBuffer SceneColor alpha being cleared to 1 in the main scene rendering check(GetSceneColorClearAlpha() == 1.0f); RHICmdList.Clear(true, FLinearColor(0, 0, 0, 1), false, (float)ERHIZBuffer::FarPlane, false, 0, FIntRect()); // Reflection view late update if (SceneRenderer->Views.Num() > 1) { const FMirrorMatrix MirrorMatrix(MirrorPlane); for (int32 ViewIndex = 0; ViewIndex < SceneRenderer->Views.Num(); ++ViewIndex) { FViewInfo& ReflectionViewToUpdate = SceneRenderer->Views[ViewIndex]; const FViewInfo& UpdatedParentView = MainSceneRenderer->Views[ViewIndex]; ReflectionViewToUpdate.UpdatePlanarReflectionViewMatrix(UpdatedParentView, MirrorMatrix); } } // Render the scene normally { SCOPED_DRAW_EVENT(RHICmdList, RenderScene); SceneRenderer->Render(RHICmdList); } for (int32 ViewIndex = 0; ViewIndex < SceneRenderer->Views.Num(); ++ViewIndex) { FViewInfo& View = SceneRenderer->Views[ViewIndex]; if (MainSceneRenderer->Scene->GetShadingPath() == EShadingPath::Deferred) { PrefilterPlanarReflection<true>(RHICmdList, View, SceneProxy, Target); } else { PrefilterPlanarReflection<false>(RHICmdList, View, SceneProxy, Target); } } RHICmdList.CopyToResolveTarget(RenderTarget->GetRenderTargetTexture(), RenderTargetTexture->TextureRHI, false, ResolveParams); } FSceneRenderer::WaitForTasksClearSnapshotsAndDeleteSceneRenderer(RHICmdList, SceneRenderer); } } }
/** Converts an xyzY color to XYZ. */ FLinearColor FLinearColorUtils::xyzYToXYZ(const FLinearColor& InColor) { const float yInverse = 1.0f / FMath::Max(InColor.G, (float)SMALL_NUMBER); return FLinearColor(InColor.R * InColor.A * yInverse, InColor.A, InColor.B * InColor.A * yInverse); }
void SGraphTitleBar::Construct( const FArguments& InArgs ) { EdGraphObj = InArgs._EdGraphObj; OnDifferentGraphCrumbClicked = InArgs._OnDifferentGraphCrumbClicked; check(EdGraphObj); Kismet2Ptr = InArgs._Kismet2; check(Kismet2Ptr.IsValid()); bEditingFunction = false; // Set-up shared breadcrumb defaults FMargin BreadcrumbTrailPadding = FMargin(4.f, 2.f); const FSlateBrush* BreadcrumbButtonImage = FEditorStyle::GetBrush("BreadcrumbTrail.Delimiter"); this->ChildSlot [ SNew(SBorder) .BorderImage( FEditorStyle::GetBrush( TEXT("Graph.TitleBackground") ) ) .HAlign(HAlign_Fill) .AddMetaData<FTagMetaData>(FTagMetaData(TEXT("EventGraphTitleBar"))) [ SNew(SVerticalBox) // Title text/icon +SVerticalBox::Slot() .AutoHeight() [ SNew(SHorizontalBox) +SHorizontalBox::Slot() .AutoWidth() [ InArgs._HistoryNavigationWidget.ToSharedRef() ] +SHorizontalBox::Slot() .HAlign(HAlign_Center) .FillWidth(1.f) [ SNew(SHorizontalBox) +SHorizontalBox::Slot() .AutoWidth() .Padding( 10,5 ) .VAlign(VAlign_Center) [ SNew(SImage) .Image( this, &SGraphTitleBar::GetTypeGlyph ) ] // show fake 'root' breadcrumb for the title +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) .Padding(BreadcrumbTrailPadding) [ SNew(STextBlock) .Text(this, &SGraphTitleBar::GetBlueprintTitle ) .TextStyle( FEditorStyle::Get(), TEXT("GraphBreadcrumbButtonText") ) .Visibility( this, &SGraphTitleBar::IsGraphBlueprintNameVisible ) ] +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) [ SNew(SImage) .Image( BreadcrumbButtonImage ) .Visibility( this, &SGraphTitleBar::IsGraphBlueprintNameVisible ) ] // New style breadcrumb +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) [ SAssignNew(BreadcrumbTrail, SBreadcrumbTrail<UEdGraph*>) .ButtonStyle(FEditorStyle::Get(), "GraphBreadcrumbButton") .TextStyle(FEditorStyle::Get(), "GraphBreadcrumbButtonText") .ButtonContentPadding( BreadcrumbTrailPadding ) .DelimiterImage( BreadcrumbButtonImage ) .PersistentBreadcrumbs( true ) .OnCrumbClicked( this, &SGraphTitleBar::OnBreadcrumbClicked ) ] +SHorizontalBox::Slot() .AutoWidth() .VAlign(VAlign_Center) [ SNew(STextBlock) .Font( FSlateFontInfo(FPaths::EngineContentDir() / TEXT("Slate/Fonts/Roboto-Regular.ttf"), 14 ) ) .ColorAndOpacity( FLinearColor(1,1,1,0.5) ) .Text( this, &SGraphTitleBar::GetTitleExtra ) ] ] ] ] ]; RebuildBreadcrumbTrail(); UBlueprint* BlueprintObj = FBlueprintEditorUtils::FindBlueprintForGraph(this->EdGraphObj); if (BlueprintObj) { bShowBlueprintTitle = true; BlueprintTitle = BlueprintObj->GetFriendlyName(); // Register for notifications to refresh UI if( Kismet2Ptr.IsValid() ) { Kismet2Ptr.Pin()->OnRefresh().AddRaw(this, &SGraphTitleBar::Refresh); } } }
void SARInventoryItemWidget::OnMouseLeave(const FPointerEvent& MouseEvent) { TextColor = FSlateColor(FLinearColor(1, 0, 0, 1)); }
FLinearColor UAnimGraphNode_TwoWayBlend::GetNodeTitleColor() const { return FLinearColor(0.75f, 0.75f, 0.75f); }
void FRCPassPostProcessVisualizeLPV::Process(FRenderingCompositePassContext& Context) { SCOPED_DRAW_EVENT(Context.RHICmdList, VisualizeLPV); const FSceneView& View = Context.View; const FSceneViewFamily& ViewFamily = *(View.Family); // const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context); const TRefCountPtr<IPooledRenderTarget> RenderTarget = GetInput(ePId_Input0)->GetOutput()->PooledRenderTarget; const FSceneRenderTargetItem& DestRenderTarget = RenderTarget->GetRenderTargetItem(); // Set the view family's render target/viewport. SetRenderTarget(Context.RHICmdList, DestRenderTarget.TargetableTexture, FTextureRHIRef()); { FRenderTargetTemp TempRenderTarget(View, (const FTexture2DRHIRef&)DestRenderTarget.TargetableTexture); FCanvas Canvas(&TempRenderTarget, NULL, ViewFamily.CurrentRealTime, ViewFamily.CurrentWorldTime, ViewFamily.DeltaWorldTime, View.GetFeatureLevel()); float X = 30; float Y = 28; const float YStep = 14; const float ColumnWidth = 250; Canvas.DrawShadowedString( X, Y += YStep, TEXT("VisualizeLightPropagationVolume"), GetStatsFont(), FLinearColor(0.2f, 0.2f, 1)); Y += YStep; const FLightPropagationVolumeSettings& Dest = View.FinalPostProcessSettings.BlendableManager.GetSingleFinalDataConst<FLightPropagationVolumeSettings>(); #define ENTRY(name)\ Canvas.DrawShadowedString( X, Y += YStep, TEXT(#name) TEXT(":"), GetStatsFont(), FLinearColor(1, 1, 1));\ Canvas.DrawShadowedString( X + ColumnWidth, Y, *FString::Printf(TEXT("%g"), Dest.name), GetStatsFont(), FLinearColor(1, 1, 1)); ENTRY(LPVIntensity) ENTRY(LPVVplInjectionBias) ENTRY(LPVSize) ENTRY(LPVSecondaryOcclusionIntensity) ENTRY(LPVSecondaryBounceIntensity) ENTRY(LPVGeometryVolumeBias) ENTRY(LPVEmissiveInjectionIntensity) ENTRY(LPVDirectionalOcclusionIntensity) ENTRY(LPVDirectionalOcclusionRadius) ENTRY(LPVDiffuseOcclusionExponent) ENTRY(LPVSpecularOcclusionExponent) ENTRY(LPVDiffuseOcclusionIntensity) ENTRY(LPVSpecularOcclusionIntensity) #undef ENTRY Canvas.Flush_RenderThread(Context.RHICmdList); } Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, false, FResolveParams()); // to satify following passws FRenderingCompositeOutput* Output = GetOutput(ePId_Output0); Output->PooledRenderTarget = RenderTarget; }
FLinearColor UGameplayTagsK2Node_LiteralGameplayTag::GetNodeTitleColor() const { return FLinearColor(1.0f, 0.51f, 0.0f); }