Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,19 @@ CS
{
material.BaseTextureId = PaintMaterialIndex;
}
else // Painting the Overlay layer
else if ( PaintLayer == 1 ) // Painting the Overlay layer
{
material.OverlayTextureId = PaintMaterialIndex;

// Increase blend to make overlay material more visible
float newBlend = saturate( material.GetNormalizedBlend() + brushValue );
material.BlendFactor = uint( newBlend * 255.0 );
}
else // Painting both layers
{
material.BaseTextureId = PaintMaterialIndex;
material.OverlayTextureId = PaintMaterialIndex;
}

// Write back
ControlMap[texel] = material.EncodeToFloat();
Expand Down
10 changes: 9 additions & 1 deletion game/addons/tools/Code/Scene/Terrain/TerrainEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,23 @@ public override Widget CreateToolSidebar()
// Create named pages so we can hook into tab changes
var basePage = new Widget();
var overlayPage = new Widget();
var bothPage = new Widget();

tabs.AddPage( "Base", "layers", basePage );
tabs.AddPage( "Overlay", "landscape", overlayPage );
tabs.AddPage( "Both", "cloud", bothPage );

// Hook into tab selection changes
var tabBar = tabs.Children.OfType<SegmentedControl>().FirstOrDefault();
tabBar.OnSelectedChanged += ( selectedName ) =>
{
PaintTextureTool.ActiveLayer = selectedName == "Base" ? TerrainLayer.Base : TerrainLayer.Overlay;
PaintTextureTool.ActiveLayer = selectedName switch
{
"Base" => TerrainLayer.Base,
"Overlay" => TerrainLayer.Overlay,
"Both" => TerrainLayer.Both,
_ => TerrainLayer.Base
};
};

group.Add( tabs );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace Editor.TerrainEditor;
public enum TerrainLayer
{
Base = 0,
Overlay = 1
Overlay = 1,
Both = 2
}

[Title( "Paint Texture" )]
Expand Down