diff --git a/Source/Editor/Surface/Archetypes/Tools.cs b/Source/Editor/Surface/Archetypes/Tools.cs
index 3d0a8cd0c..555f7ad55 100644
--- a/Source/Editor/Surface/Archetypes/Tools.cs
+++ b/Source/Editor/Surface/Archetypes/Tools.cs
@@ -1059,6 +1059,7 @@ namespace FlaxEditor.Surface.Archetypes
internal class RerouteNode : SurfaceNode, IConnectionInstigator
{
internal static readonly Float2 DefaultSize = new Float2(FlaxEditor.Surface.Constants.BoxRowHeight);
+ internal override bool DrawBasicShadow => false;
private Rectangle _localBounds;
private InputBox _input;
private OutputBox _output;
@@ -1187,6 +1188,11 @@ namespace FlaxEditor.Surface.Archetypes
icon = type.IsVoid ? style.Icons.ArrowClose : style.Icons.BoxClose;
else
icon = type.IsVoid ? style.Icons.ArrowOpen : style.Icons.BoxOpen;
+
+ // Shadow
+ var shadowRect = _localBounds.MakeOffsetted(ShadowOffset);
+ Render2D.DrawSprite(icon, shadowRect, Color.Black.AlphaMultiplied(0.125f));
+
Render2D.DrawSprite(icon, _localBounds, connectionColor);
base.Draw();
diff --git a/Source/Editor/Surface/SurfaceNode.cs b/Source/Editor/Surface/SurfaceNode.cs
index 4b918de08..89471eaf4 100644
--- a/Source/Editor/Surface/SurfaceNode.cs
+++ b/Source/Editor/Surface/SurfaceNode.cs
@@ -40,6 +40,13 @@ namespace FlaxEditor.Surface
[HideInEditor]
public class SurfaceNode : SurfaceControl
{
+ internal const float ShadowOffset = 2.25f;
+
+ ///
+ /// If true, draws a basic rectangle shadow behind the node. Disable to hide shadow or if the node is drawing a custom shadow.
+ ///
+ internal virtual bool DrawBasicShadow => true;
+
///
/// The box to draw a highlight around. Drawing will be skipped if null.
///
@@ -1047,8 +1054,16 @@ namespace FlaxEditor.Surface
{
var style = Style.Current;
- // Background
var backgroundRect = new Rectangle(Float2.Zero, Size);
+
+ // Shadow
+ if (DrawBasicShadow)
+ {
+ var shadowRect = backgroundRect.MakeOffsetted(ShadowOffset);
+ Render2D.FillRectangle(shadowRect, Color.Black.AlphaMultiplied(0.125f));
+ }
+
+ // Background
Render2D.FillRectangle(backgroundRect, BackgroundColor);
// Breakpoint hit
@@ -1085,6 +1100,7 @@ namespace FlaxEditor.Surface
var colorTop = Color.Orange;
var colorBottom = Color.OrangeRed;
Render2D.DrawRectangle(backgroundRect, colorTop, colorTop, colorBottom, colorBottom);
+ Render2D.DrawRectangle(backgroundRect, colorTop, colorTop, colorBottom, colorBottom, 2.5f);
}
// Breakpoint dot
diff --git a/Source/Engine/Core/Math/Rectangle.cs b/Source/Engine/Core/Math/Rectangle.cs
index 81c689d48..c2339d9d5 100644
--- a/Source/Engine/Core/Math/Rectangle.cs
+++ b/Source/Engine/Core/Math/Rectangle.cs
@@ -253,6 +253,16 @@ namespace FlaxEngine
return new Rectangle(Location + new Float2(x, y), Size);
}
+ ///
+ /// Make offseted rectangle
+ ///
+ /// Offset (will be applied to X- and Y- axis).
+ /// Offseted rectangle.
+ public Rectangle MakeOffsetted(float offset)
+ {
+ return new Rectangle(Location + new Float2(offset, offset), Size);
+ }
+
///
/// Make offseted rectangle
///