本文整理汇总了C++中FLinearColor函数的典型用法代码示例。如果您正苦于以下问题:C++ FLinearColor函数的具体用法?C++ FLinearColor怎么用?C++ FLinearColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLinearColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShouldBeEnabled
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;
//.........这里部分代码省略.........
示例2: FSlateColor
void SARInventoryItemWidget::OnMouseEnter(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
TextColor = FSlateColor(FLinearColor(0, 1, 0, 1));
}
示例3: FLinearColor
FLinearColor UAnimGraphNode_LocalToComponentSpace::GetNodeTitleColor() const
{
return FLinearColor(0.7f, 0.7f, 0.7f);
}
示例4: GetNodeTitle
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() );
}
}
}
示例5: FLinearColor
/** 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);
}
示例6: SCOPED_DRAW_EVENT
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());
}
示例7: DiffR_PinTypeChanged
/** 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);
}
}
示例8: TileItem
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;
}
示例9: PrintString
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
}
示例10: check
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);
}
}
}
示例11: ShouldBeEnabled
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;
}
示例12: FLinearColor
FLinearColor UK2Node_Switch::GetNodeTitleColor() const
{
// Use yellow for now
return FLinearColor(255.0f, 255.0f, 0.0f);
}
示例13: FLinearColor
FLinearColor FCurveAssetEditor::GetWorldCentricTabColorScale() const
{
return FLinearColor( 0.0f, 0.0f, 0.2f, 0.5f );
}
示例14: SCOPED_DRAW_EVENT
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());
}
示例15: MakeShareable
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() );
}