Adds plugins

This commit is contained in:
2021-11-18 15:24:24 +01:00
parent 748b0804b8
commit b94590ab4f
529 changed files with 10429 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
/* Copyright (C) 2021 Hugo ATTAL - All Rights Reserved
* This plugin is downloadable from the Unreal Engine Marketplace
*/
#include "lib/Shapes.usf"
struct DarkerUIBox
{
static float4 ComputeBox(float2 PixelSize, float2 UVs, float4 BackgroundColor, float4 BorderColor, float Radius, float4 Padding)
{
float2 Location = UVs * PixelSize;
PixelSize.x -= Padding.x + Padding.z;
PixelSize.y -= Padding.y + Padding.w;
Location.x -= Padding.x;
Location.y -= Padding.y;
Radius = min(Radius, min(PixelSize.x, PixelSize.y) / 2 - 2);
const float ExternalRectangle = DarkerUIShapes::IsInRoundedRectangle(Location, float2(1, 1), PixelSize - float2(1, 1), Radius + 1);
const float InternalRectangle = DarkerUIShapes::IsInRoundedRectangle(Location, float2(2, 2), PixelSize - float2(2, 2), Radius);
const float Alpha = lerp(
ExternalRectangle * BorderColor.a, BackgroundColor.a,
InternalRectangle);
const float3 Color = lerp(
BorderColor.rgb, BackgroundColor.rgb,
InternalRectangle);
return float4(Color, Alpha);
}
};
/*
#include "/DarkerNodes/Box.usf"
return DarkerUIBox::ComputeBox(PixelSize, UVs, BackgroundColor, BorderColor, Radius, Padding);
*/

View File

@@ -0,0 +1,24 @@
/* Copyright (C) 2021 Hugo ATTAL - All Rights Reserved
* This plugin is downloadable from the Unreal Engine Marketplace
*/
#include "lib/Shapes.usf"
struct DarkerUIButton
{
static float4 ComputeButton(float2 PixelSize, float2 UVs, float3 BackgroundColor, float3 BorderColor, float Radius)
{
Radius = min(Radius, min(PixelSize.x, PixelSize.y) / 2 - 1);
const float2 Location = UVs * PixelSize;
const float Alpha = DarkerUIShapes::IsInRoundedRectangle(Location, float2(0, 0), PixelSize, Radius + 1);
const float3 Color = lerp(
BorderColor, BackgroundColor,
DarkerUIShapes::IsInRoundedRectangle(Location, float2(1, 1), PixelSize - float2(1, 1), Radius));
return float4(Color, Alpha);
}
};
/*
#include "/DarkerNodes/Button.usf"
return DarkerUIButton::ComputeButton(PixelSize, UVs, BackgroundColor, BorderColor, Radius);
*/

View File

@@ -0,0 +1,38 @@
/* Copyright (C) 2021 Hugo ATTAL - All Rights Reserved
* This plugin is downloadable from the Unreal Engine Marketplace
*/
#include "lib/Shapes.usf"
struct DarkerUIButtonCut
{
static float4 ComputeButton(float2 PixelSize, float2 UVs, float3 BackgroundColor, float3 BorderColor, float Part, float Radius)
{
Radius = min(Radius, min(PixelSize.x, PixelSize.y) / 2 - 1);
if (Part < 0)
{
UVs.x = min(UVs.x, 0.5);
}
else if (Part > 0)
{
UVs.x = max(UVs.x, 0.5);
}
else
{
UVs.x = 0.5;
}
const float2 Location = UVs * PixelSize;
const float Alpha = DarkerUIShapes::IsInRoundedRectangle(Location, float2(0, 0), PixelSize - float2(0, 0), Radius + 1);
const float3 Color = lerp(
BorderColor, BackgroundColor,
DarkerUIShapes::IsInRoundedRectangle(Location, float2(1, 1), PixelSize - float2(1, 1), Radius));
return float4(Color, Alpha);
}
};
/*
#include "/DarkerNodes/ButtonCut.usf"
return DarkerUIButtonCut::ComputeButton(PixelSize, UVs, BackgroundColor, BorderColor, Part, Radius);
*/

View File

@@ -0,0 +1,30 @@
/* Copyright (C) 2021 Hugo ATTAL - All Rights Reserved
* This plugin is downloadable from the Unreal Engine Marketplace
*/
struct DarkerUICenterUVs
{
static float2 GetCenterUVs(float2 PixelSize, float2 Size, float2 UVs)
{
if (PixelSize.x > Size.x)
{
UVs.x *= PixelSize.x / Size.x;
UVs.x -= (PixelSize.x - Size.x) / (2.0f * Size.x);
}
if (PixelSize.y > Size.y)
{
UVs.y *= PixelSize.y / Size.y;
UVs.y -= (PixelSize.y - Size.y) / (2.0f * Size.y);
}
UVs = clamp(UVs, 0, 1);
return UVs;
}
};
/*
#include "/DarkerNodes/CenterUVs.usf"
return DarkerUICenterUVs::GetCenterUVs(PixelSize, Size, UVs);
*/

View File

@@ -0,0 +1,37 @@
/* Copyright (C) 2021 Hugo ATTAL - All Rights Reserved
* This plugin is downloadable from the Unreal Engine Marketplace
*/
#include "lib/Shapes.usf"
struct DarkerUIHeaderBox
{
static float4 ComputeHeaderBox(float2 PixelSize, float2 UVs, float4 BackgroundColor, float4 BorderColor, float Radius, float4 Padding)
{
float2 Location = UVs * PixelSize;
PixelSize.x -= Padding.x + Padding.z;
PixelSize.y -= Padding.y + Padding.w;
Location.x -= Padding.x;
Location.y -= Padding.y;
Radius = min(Radius, min(PixelSize.x, PixelSize.y) / 2 - 2);
const float ExternalRectangle = DarkerUIShapes::IsInRoundedHeader(Location, float2(1, 1), PixelSize - float2(1, 1), Radius + 1);
const float InternalRectangle = DarkerUIShapes::IsInRoundedHeader(Location, float2(2, 2), PixelSize - float2(2, 2), Radius);
const float Alpha = lerp(
ExternalRectangle * BorderColor.a, BackgroundColor.a,
InternalRectangle);
const float3 Color = lerp(
BorderColor.rgb, BackgroundColor.rgb,
InternalRectangle);
return float4(Color, Alpha);
}
};
/*
#include "/DarkerNodes/HeaderBox.usf"
return DarkerUIHeaderBox::ComputeHeaderBox(PixelSize, UVs, BackgroundColor, BorderColor, Radius, Padding);
*/

View File

@@ -0,0 +1,22 @@
/* Copyright (C) 2021 Hugo ATTAL - All Rights Reserved
* This plugin is downloadable from the Unreal Engine Marketplace
*/
#include "lib/Shapes.usf"
struct DarkerUIPanel
{
static float4 ComputePane(float2 PixelSize, float2 UVs, float3 BackgroundColor, float3 BorderColor)
{
const float2 Location = UVs * PixelSize;
const float3 Color = lerp(
BorderColor, BackgroundColor,
DarkerUIShapes::IsInRectangle(Location, float2(1, 1), PixelSize - float2(1, 1)));
return float4(Color, 1.0f);
}
};
/*
#include "/DarkerNodes/Panel.usf"
return DarkerUIPanel::ComputePane(PixelSize, UVs, BackgroundColor, BorderColor);
*/

View File

@@ -0,0 +1,64 @@
/* Copyright (C) 2021 Hugo ATTAL - All Rights Reserved
* This plugin is downloadable from the Unreal Engine Marketplace
*/
#pragma once
#define PI 3.14159265359
#define TWO_PI 6.28318530718
struct DarkerUIShapes
{
static float IsInRectangle(float2 Location, float2 Start, float2 End)
{
return
clamp(Location.x - Start.x + 0.5, 0.0f, 1.0f) *
clamp(End.x - Location.x + 0.5, 0.0f, 1.0f) *
clamp(Location.y - Start.y + 0.5, 0.0f, 1.0f) *
clamp(End.y - Location.y + 0.5, 0.0f, 1.0f);
}
static float IsInOutlineRectangle(float2 Location, float2 Start, float2 End, float Outline)
{
const float2 OutlineOffset = float2(Outline, Outline);
return IsInRectangle(Location, Start, End) && ! IsInRectangle(Location, Start + OutlineOffset, End - OutlineOffset);
}
static float IsInCircle(float2 Location, float2 Center, float Radius)
{
return clamp(Radius - length(Location - Center) + 0.5f, 0.0f, 1.0f);
}
static float IsInOutlineCircle(float2 Location, float2 Center, float Radius, float Outline)
{
return IsInCircle(Location, Center, Radius) && !IsInCircle(Location, Center, Radius - Outline);
}
static float IsInRoundedRectangle(float2 Location, float2 Start, float2 End, float Radius)
{
float Value = 0;
Value = max(Value, IsInRectangle(Location, Start + float2(0, Radius), End - float2(0, Radius)));
Value = max(Value, IsInRectangle(Location, Start + float2(Radius, 0), End - float2(Radius, 0)));
Value = max(Value, IsInCircle(Location, Start + float2(Radius, Radius), Radius));
Value = max(Value, IsInCircle(Location, End + float2(-Radius, -Radius), Radius));
Value = max(Value, IsInCircle(Location, float2(Start.x, End.y) + float2(Radius, -Radius), Radius));
Value = max(Value, IsInCircle(Location, float2(End.x, Start.y) + float2(-Radius, Radius), Radius));
return Value;
}
static float IsInRoundedHeader(float2 Location, float2 Start, float2 End, float Radius)
{
float Value = 0;
Value = max(Value, IsInRectangle(Location, Start + float2(0, Radius), End));
Value = max(Value, IsInRectangle(Location, Start + float2(Radius, 0), End - float2(Radius, 0)));
Value = max(Value, IsInCircle(Location, Start + float2(Radius, Radius), Radius));
Value = max(Value, IsInCircle(Location, float2(End.x, Start.y) + float2(-Radius, Radius), Radius));
return Value;
}
};