Border the placement tile highlight with perimeter quads #47
Labels
No labels
assets
bug
duplicate
enhancement
help wanted
invalid
question
testing
ui
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liamjd/UntitledColonyBuilder#47
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Draw a perimeter border around the tile highlight during building placement.
#37 delivered the fill quads and the validity tint, but left the border as a TODO
(
entities/buildings/placement_controller.gd,_rebuild_highlight()). This issuefinishes that half of the highlight.
Current state
_rebuild_highlight()emits one inset quad per footprint cell into a singleImmediateMeshPRIMITIVE_TRIANGLESsurface, coloured per-vertex from theplacement
Reason. The corners are inset by a hardcoded0.3on each axis, whichleaves a visible gap between neighbouring cells — this reads well and should stay,
but it means each cell is drawn as an island rather than as part of one shape.
What to add
Thin quads along the outer perimeter of the footprint, drawn into the same
surface at higher alpha (~0.9 against the fill's ~0.35, per #37).
The perimeter rule from #37 still applies and is what makes L-shapes and holes work:
Do not derive the outline from
footprint.bounds()— the bounding box of an L-shapeis a rectangle and would draw a border through empty space. Build a set from
footprint.cells()and test membership.Constraints carried over from #37
PRIMITIVE_LINES. Line width is not adjustable undergl_compatibility— always one pixel — so a line border vanishes when zoomed outand never thickens when zoomed in. A quad ~0.06 m wide has real world-space
thickness.
surface_set_color()before eachsurface_add_vertex(); the border differs from the fill only in alpha, so it needsno second material.
surface_y(level_at(cell)) + 0.02, like the fill. On a terraced site the outlinesteps with the ground.
Open question: the border and the inset interact
The inset means a cell's drawn edge is 0.3 m inside its true cell boundary, so
"border along the perimeter" now has two plausible readings:
framed tile and the gaps stay visible. Simpler; ignores the perimeter rule
entirely.
cell boundary or just inside it, with the inset fill floating inside it. Matches
#37's intent and reads as "this is the building's plot", but the gaps between
cells then sit inside an unbroken frame.
Decide by eye with a headed screenshot on the 3x3 and the L-shape footprints before
committing to one. Worth trying (1) first — it composes with the gap effect rather
than fighting it.
Related refactor
While in this code: the
0.3inset is a magic number coupled toTerrainGrid.tile_size(2.0 today), and inverts the quads iftile_sizeis ever setbelow 0.6. Replace it with an exported ratio hoisted out of the loop:
That scales with the grid, cannot invert for ratios below 0.5, and gives a live
inspector knob for tuning the border/gap balance this issue is about.
Acceptance criteria
across the full zoom range.
notch, and no border through cells the footprint does not occupy.
ImmediateMesh, one material, one surface, rebuilt only when the anchor,type or validity changes.
tools/screenshot_buildings.gdis thetemplate.