当前位置: 首页>>代码示例>>C++>>正文


C++ FColor类代码示例

本文整理汇总了C++中FColor的典型用法代码示例。如果您正苦于以下问题:C++ FColor类的具体用法?C++ FColor怎么用?C++ FColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetDebugSightRangeColor

//----------------------------------------------------------------------//
// DEBUG
//----------------------------------------------------------------------//
FString UAISense_Sight::GetDebugLegend() const
{
	static const FColor SightColor = GetDebugSightRangeColor(); 
	static const FColor LoseSightColor = GetDebugLoseSightColor();

	return FString::Printf(TEXT("{%s} Sight, {%s} Lose Sight,"), *SightColor.ToString(), *LoseSightColor.ToString());
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:10,代码来源:AISense_Sight.cpp

示例2: DrawTile

void FTileRenderer::DrawTile(FRHICommandListImmediate& RHICmdList, const class FSceneView& View, const FMaterialRenderProxy* MaterialRenderProxy, bool bNeedsToSwitchVerticalAxis, float X, float Y, float SizeX, float SizeY, float U, float V, float SizeU, float SizeV, bool bIsHitTesting, const FHitProxyId HitProxyId, const FColor InVertexColor)
{
	FMaterialTileVertex DestVertex[4];

	// create verts
	if (bNeedsToSwitchVerticalAxis)
	{
		DestVertex[0].Initialize(X + SizeX, View.ViewRect.Height() - (Y + SizeY), U + SizeU, V + SizeV);
		DestVertex[1].Initialize(X, View.ViewRect.Height() - (Y + SizeY), U, V + SizeV);
		DestVertex[2].Initialize(X + SizeX, View.ViewRect.Height() - Y, U + SizeU, V);
		DestVertex[3].Initialize(X, View.ViewRect.Height() - Y, U, V);		
	}
	else
	{
		DestVertex[0].Initialize(X + SizeX, Y, U + SizeU, V);
		DestVertex[1].Initialize(X, Y, U, V);
		DestVertex[2].Initialize(X + SizeX, Y + SizeY, U + SizeU, V + SizeV);
		DestVertex[3].Initialize(X, Y + SizeY, U, V + SizeV);
	}

	DestVertex[0].Color = InVertexColor.DWColor();
	DestVertex[1].Color = InVertexColor.DWColor();
	DestVertex[2].Color = InVertexColor.DWColor();
	DestVertex[3].Color = InVertexColor.DWColor();

	// update the FMeshBatch
	FMeshBatch& Mesh = GTileMesh.MeshElement;
	Mesh.UseDynamicData = true;
	Mesh.DynamicVertexData = DestVertex;
	Mesh.MaterialRenderProxy = MaterialRenderProxy;

	GetRendererModule().DrawTileMesh(RHICmdList, View, Mesh, bIsHitTesting, HitProxyId);
}
开发者ID:stoneStyle,项目名称:Unreal4,代码行数:33,代码来源:TileRendering.cpp

示例3: GetLinkerCustomVersion

void UPaperTerrainComponent::PostLoad()
{
	Super::PostLoad();

	const int32 PaperVer = GetLinkerCustomVersion(FPaperCustomVersion::GUID);

	if (PaperVer < FPaperCustomVersion::FixVertexColorSpace)
	{
		const FColor SRGBColor = TerrainColor.ToFColor(/*bSRGB=*/ true);
		TerrainColor = SRGBColor.ReinterpretAsLinear();
	}
}
开发者ID:PopCap,项目名称:GameIdea,代码行数:12,代码来源:PaperTerrainComponent.cpp

示例4: max

FColor HSB::hsbFromRgb(const FColor& rgb) {
    const auto brightness = max(
        max(RGB::red(rgb), RGB::green(rgb)), RGB::blue(rgb));
    auto hue = 0.0f, saturation = 0.0f;

    if (not near(brightness, 0.0)) {
        const auto darkest = min(
            min(RGB::red(rgb), RGB::green(rgb)), RGB::blue(rgb));
        const auto range = brightness - darkest;
        saturation = range / brightness;

        if (not near(saturation, 0.0)) {
            const float r = (brightness - RGB::red(rgb)) / range;
            const float g = (brightness - RGB::green(rgb)) / range;
            const float b = (brightness - RGB::blue(rgb)) / range;

            if (near(RGB::red(rgb), brightness))
                hue = b - g;
            else if (near(RGB::green(rgb), brightness))
                hue = 2.0f + r - b;
            else
                hue = 4.0f + g - r;

            hue /= 6.0f;

            if (hue < 0)
                hue += 1.0f;
        }
    }
    return FColor(hue, saturation, brightness, rgb.alpha());
}
开发者ID:TopRamenGod,项目名称:echomesh,代码行数:31,代码来源:HSB.cpp

示例5: ParseTag

	bool ParseTag(FColor& OutColor)
	{
		FString TagString;

		EStringParserToken Token = ReadToken();
		for (; Token != EStringParserToken::EndOfString && Token != EStringParserToken::CloseTag; Token = ReadToken())
		{
			if (Token == EStringParserToken::RegularChar)
			{
				TagString.AppendChar(DataString[DataIndex]);
			}
			
			DataIndex++;
		}

		bool bResult = false;
		if (Token == EStringParserToken::CloseTag)
		{
			const FString TagColorLower = TagString.ToLower();
			const bool bIsColorName = GColorList.IsValidColorName(*TagColorLower);
			
			if (bIsColorName)
			{
				OutColor = GColorList.GetFColorByName(*TagColorLower);
				bResult = true;
			}
			else
			{
				bResult = OutColor.InitFromString(TagString);
			}
		}

		return bResult;
	}
开发者ID:dineshone,项目名称:UnrealGameEngine,代码行数:34,代码来源:GameplayDebuggerTypes.cpp

示例6:

void BatchRenderer::DrawSolidTriangle3D(
	const Vec3D& a, const Vec3D& b, const Vec3D& c,
	const FColor& color
	)
{
	const U4 rgbaColor = color.ToRGBA32();

	SetBatchState( this, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );

	const UINT iBaseVertex = self->batchedVertices.Num();
	Vertex & v0 = self->batchedVertices.Add();
	Vertex & v1 = self->batchedVertices.Add();
	Vertex & v2 = self->batchedVertices.Add();

	v0.xyz.x 	= a.x;
	v0.xyz.y 	= a.y;
	v0.xyz.z 	= a.z;
	v0.rgba.asU32 	= rgbaColor;

	v1.xyz.x 	= b.x;
	v1.xyz.y 	= b.y;
	v1.xyz.z 	= b.z;
	v1.rgba.asU32 	= rgbaColor;

	v2.xyz.x 	= c.x;
	v2.xyz.y 	= c.y;
	v2.xyz.z 	= c.z;
	v2.rgba.asU32 	= rgbaColor;

	self->batchedIndices.Add( iBaseVertex + 0 );
	self->batchedIndices.Add( iBaseVertex + 1 );
	self->batchedIndices.Add( iBaseVertex + 2 );
}
开发者ID:S-V,项目名称:Lollipop,代码行数:33,代码来源:BatchRenderer.cpp

示例7: ParseTag

		uint32 ParseTag( FString& OutData )
		{
			FString TagString;
			int32 OryginalIndex = Index;
			uint8 token = ReadToken();
			while (token != EndOfString && token != CloseTag)
			{
				if (token == RegularChar)
				{
					TagString.AppendChar(DataString[Index++]);
				}
				token = ReadToken();
			}

			int OutTag = ErrorTag;

			if (token != CloseTag)
			{
				Index = OryginalIndex;
				OutData = FString::Printf( TEXT("{%s"), *TagString);
				OutData.AppendChar(DataString[Index-1]);
				return OutTag;
			}

			if (GColorList.IsValidColorName(*TagString.ToLower()))
			{
				OutTag = DefinedColor;
				OutData = TagString;
			}
			else
			{
				FColor Color;
				if (Color.InitFromString(TagString))
				{
					OutTag = OtherColor;
					OutData = TagString;
				}
				else
				{
					OutTag = ErrorTag;
					OutData = FString::Printf( TEXT("{%s"), *TagString);
					OutData.AppendChar(DataString[Index-1]);
				}
			}
			//Index++;
			return OutTag;
		}
开发者ID:JustDo1989,项目名称:UnrealEngine4.11-HairWorks,代码行数:47,代码来源:GameplayDebuggingHUDComponent.cpp

示例8:

void FD3DGPUProfiler::PushEvent(const TCHAR* Name, FColor Color)
{
#if WITH_DX_PERF
	D3DPERF_BeginEvent(Color.DWColor(), Name);
#endif

	FGPUProfiler::PushEvent(Name, Color);
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:8,代码来源:D3D12Stats.cpp

示例9: OnSetColorFromColorPicker

void FColorStructCustomization::OnSetColorFromColorPicker( FLinearColor NewColor )
{
	FString ColorString;
	if( bIsLinearColor )
	{
		ColorString = NewColor.ToString();
	}
	else
	{
		// Handled by the color picker
		const bool bSRGB = false;
		FColor NewFColor = NewColor.ToFColor(bSRGB);
		ColorString = NewFColor.ToString();
	}

	StructPropertyHandle->SetValueFromFormattedString( ColorString, bIsInteractive ? EPropertyValueSetFlags::InteractiveChange : 0 );
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:17,代码来源:MathStructCustomizations.cpp

示例10: GetColorAsLinear

void FColorStructCustomization::CreateColorPicker( bool bUseAlpha, bool bOnlyRefreshOnOk )
{
	int32 NumObjects = StructPropertyHandle->GetNumOuterObjects();

	SavedPreColorPickerColors.Empty();
	TArray<FString> PerObjectValues;
	StructPropertyHandle->GetPerObjectValues( PerObjectValues );

	for( int32 ObjectIndex = 0; ObjectIndex < NumObjects; ++ObjectIndex )
	{
		if( bIsLinearColor )
		{
			FLinearColor Color;
			Color.InitFromString( PerObjectValues[ObjectIndex] );
			SavedPreColorPickerColors.Add( Color );	
		}
		else
		{
			FColor Color;
			Color.InitFromString( PerObjectValues[ObjectIndex] );
			SavedPreColorPickerColors.Add( Color.ReinterpretAsLinear() );
		}
	}

	FLinearColor InitialColor;
	GetColorAsLinear(InitialColor);

	// This needs to be meta data.  Other colors could benefit from this
	const bool bRefreshOnlyOnOk = StructPropertyHandle->GetProperty()->GetOwnerClass()->IsChildOf(UMaterialExpressionConstant3Vector::StaticClass());

	FColorPickerArgs PickerArgs;
	PickerArgs.bUseAlpha = !bIgnoreAlpha;
	PickerArgs.bOnlyRefreshOnMouseUp = false;
	PickerArgs.bOnlyRefreshOnOk = bRefreshOnlyOnOk;
	PickerArgs.DisplayGamma = TAttribute<float>::Create( TAttribute<float>::FGetter::CreateUObject(GEngine, &UEngine::GetDisplayGamma) );
	PickerArgs.OnColorCommitted = FOnLinearColorValueChanged::CreateSP( this, &FColorStructCustomization::OnSetColorFromColorPicker );
	PickerArgs.OnColorPickerCancelled = FOnColorPickerCancelled::CreateSP( this, &FColorStructCustomization::OnColorPickerCancelled );
	PickerArgs.OnInteractivePickBegin = FSimpleDelegate::CreateSP( this, &FColorStructCustomization::OnColorPickerInteractiveBegin );
	PickerArgs.OnInteractivePickEnd = FSimpleDelegate::CreateSP( this, &FColorStructCustomization::OnColorPickerInteractiveEnd );
	PickerArgs.InitialColorOverride = InitialColor;
	PickerArgs.ParentWidget = ColorPickerParentWidget;

	OpenColorPicker(PickerArgs);
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:44,代码来源:MathStructCustomizations.cpp

示例11: hue

// from http://www.cs.rit.edu/~ncs/color/t_convert.html
FColor HSB::hsbToRgb(const FColor& hsb) {
    auto h = hue(hsb), s = saturation(hsb), b = brightness(hsb);
    float red, green, blue;
    if (s == 0) {
        // achromatic (grey)
        red = green = blue = b;
    } else {
        h *= 6;			// sector 0 to 5
        int i = floor(h);
        auto f = h - i;			// factorial part of h
        auto p = b * (1 - s);
        auto q = b * (1 - s * f);
        auto t = b * (1 - s * (1 - f));

        switch(i) {
            case 0:
                red = b;
                green = t;
                blue = p;
                break;

            case 1:
                red = q;
                green = b;
                blue = p;
                break;

            case 2:
                red = p;
                green = b;
                blue = t;
                break;

            case 3:
                red = p;
                green = q;
                blue = b;
                break;

            case 4:
                red = t;
                green = p;
                blue = b;
                break;

            case 5:
            default:
                red = b;
                green = p;
                blue = q;
                break;
        }
    }

    return FColor(red, green, blue, hsb.alpha());
}
开发者ID:TopRamenGod,项目名称:echomesh,代码行数:57,代码来源:HSB.cpp

示例12: DrawSprite

void BatchRenderer::DrawSprite(
	const Matrix4& cameraWorldMatrix,
	const Vec3D& spriteOrigin,
	const FLOAT spriteSizeX, const FLOAT spriteSizeY,
	const FColor& color
)
{
	const Vec3D spriteX = cameraWorldMatrix[0].ToVec3() * spriteSizeX;
	const Vec3D spriteY = cameraWorldMatrix[1].ToVec3() * spriteSizeY;

	const U4 rgbaColor = color.ToRGBA32();

	SetBatchState( this, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );

	const UINT iBaseVertex = self->batchedVertices.Num();

	Vertex & v0 = self->batchedVertices.Add();
	Vertex & v1 = self->batchedVertices.Add();
	Vertex & v2 = self->batchedVertices.Add();
	Vertex & v3 = self->batchedVertices.Add();

	
	v0.xyz		= spriteOrigin - spriteX - spriteY;	// bottom left
	v0.uv.x 	= 0.0f;
	v0.uv.y 	= 1.0f;
	v0.rgba.asU32 	= rgbaColor;

	v1.xyz		= spriteOrigin - spriteX + spriteY;	// top left
	v1.uv.x 	= 0.0f;
	v1.uv.y 	= 0.0f;
	v1.rgba.asU32 	= rgbaColor;

	v2.xyz		= spriteOrigin + spriteX + spriteY;	// top right
	v2.uv.x 	= 1.0f;
	v2.uv.y 	= 0.0f;
	v2.rgba.asU32 	= rgbaColor;

	v3.xyz		= spriteOrigin + spriteX - spriteY;	// bottom right
	v3.uv.x 	= 1.0f;
	v3.uv.y 	= 1.0f;
	v3.rgba.asU32 	= rgbaColor;

	// indices:
	// 0,	1,	2,
	// 0,	2,	3,

	self->batchedIndices.Add( iBaseVertex + 0 );
	self->batchedIndices.Add( iBaseVertex + 1 );
	self->batchedIndices.Add( iBaseVertex + 2 );

	self->batchedIndices.Add( iBaseVertex + 0 );
	self->batchedIndices.Add( iBaseVertex + 2 );
	self->batchedIndices.Add( iBaseVertex + 3 );
}
开发者ID:S-V,项目名称:Lollipop,代码行数:54,代码来源:BatchRenderer.cpp

示例13: GetLinkerCustomVersion

void UPaperSpriteComponent::PostLoad()
{
	Super::PostLoad();

	const int32 PaperVer = GetLinkerCustomVersion(FPaperCustomVersion::GUID);

	if (PaperVer < FPaperCustomVersion::ConvertPaperSpriteComponentToBeMeshComponent)
	{
		if (MaterialOverride_DEPRECATED != nullptr)
		{
			SetMaterial(0, MaterialOverride_DEPRECATED);
		}
	}

	if (PaperVer < FPaperCustomVersion::FixVertexColorSpace)
	{
		const FColor SRGBColor = SpriteColor.ToFColor(/*bSRGB=*/ true);
		SpriteColor = SRGBColor.ReinterpretAsLinear();
	}
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:20,代码来源:PaperSpriteComponent.cpp

示例14: DrawDebugPoint

void DrawDebugPoint(const UWorld* InWorld, FVector const& Position, float Size, FColor const& Color, bool bPersistentLines, float LifeTime, uint8 DepthPriority)
{
	// no debug line drawing on dedicated server
	if (GEngine->GetNetMode(InWorld) != NM_DedicatedServer)
	{
		// this means foreground lines can't be persistent 
		ULineBatchComponent* const LineBatcher = GetDebugLineBatcher( InWorld, bPersistentLines, LifeTime, (DepthPriority == SDPG_Foreground) );
		if(LineBatcher != NULL)
		{
			LineBatcher->DrawPoint(Position, Color.ReinterpretAsLinear(), Size, DepthPriority, LifeTime);
		}
	}
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:13,代码来源:DrawDebugHelpers.cpp

示例15: OnColorPickerCancelled

void FColorStructCustomization::OnColorPickerCancelled( FLinearColor OriginalColor )
{
	TArray<FString> PerObjectColors;

	for( int32 ColorIndex = 0; ColorIndex < SavedPreColorPickerColors.Num(); ++ColorIndex )
	{
		if( bIsLinearColor )
		{
			PerObjectColors.Add( SavedPreColorPickerColors[ColorIndex].ToString() );
		}
		else
		{
			const bool bSRGB = false;
			FColor Color = SavedPreColorPickerColors[ColorIndex].ToFColor( bSRGB );
			PerObjectColors.Add( Color.ToString() );
		}
	}

	StructPropertyHandle->SetPerObjectValues( PerObjectColors );

	PerObjectColors.Empty();
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:22,代码来源:MathStructCustomizations.cpp


注:本文中的FColor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。