Editor utility for porch deck geometry generation. Defines static methods that build a plinth (shrink footprint and create slab skirt), a single deck slab, and an open-edge nosing using ArchFloorGen and ArchBandSection primitives.
using System;
using System.Collections.Generic;
using System.Linq;
using Sandbox;
namespace Sunless.Architecture;
// Everything here is cut from Footprint, not Open - the house is already out of it.
public static partial class ArchPorchGen
{
static void Plinth( ArchMesh canvas, ArchPorchShape shape, ArchKit kit, ArchBrush brush )
{
var skirt = ArchFootprint.Shrink( new[] { shape.Footprint }, 2.5f );
var top = shape.Deck - MathF.Max( 1f, kit.PorchDeckThickness );
foreach ( var loop in skirt )
{
ArchFloorGen.Slab( canvas, loop, null, shape.Grade, top, brush );
}
}
// One slab - the texture already draws the board courses at 128 px/m.
static void Deck( ArchMesh canvas, ArchPorchShape shape, ArchKit kit, ArchBrush brush )
{
ArchFloorGen.Slab( canvas, shape.Footprint, null, shape.Deck - MathF.Max( 1f, kit.PorchDeckThickness ), shape.Deck, brush );
}
// Only the open edges get the lip - the house side has no edge to show.
static void Nosing( ArchMesh canvas, ArchPorchShape shape, ArchKit kit, ArchBrush brush )
{
const float proud = 1.3f;
const float drop = 0.7f;
var bottom = shape.Deck - MathF.Max( 1f, kit.PorchDeckThickness ) - drop;
foreach ( var run in shape.Open )
{
ArchBandSection.Between( 0f, proud, bottom, shape.Deck ).Emit( canvas, run, brush );
}
}
}