Striping smarts: hatched as a width-cropping generator (#1728) + auto-striping on segment edits - #1907
Draft
kfarr wants to merge 2 commits into
Draft
Striping smarts: hatched as a width-cropping generator (#1728) + auto-striping on segment edits#1907kfarr wants to merge 2 commits into
kfarr wants to merge 2 commits into
Conversation
…ent edits (#1728) Hatched is no longer a street-segment surface material. It is now a street-generated-striping treatment (striping: hatched) that renders a full-width plane whose square seamless texture tiles at a fixed 4m period in both axes, so the diagonal bars keep their natural angle and crop to the segment width instead of stretching across it. - divider type preset now uses surface: asphalt + a generated hatched striping entry; the streetmix importer attaches the same generator to divider-preset segments - surface: hatched is removed from the pickable surface list but still renders (deprecated alias in textureMaps) so un-migrated content works - migrations: json-blob imports rewrite surface: hatched on the fly (parseStreetObject); saved scenes migrate at load via migrateSegmentHatchedSurface in createEntityFromObj Auto-striping on segment edits (#1720 §3): when a segment's type or direction changes, managed-street recomputes the separator stripes on the segment's shared edges (e.g. two drive lanes get a double yellow once their directions oppose; a lane that becomes a sidewalk loses its separator). street-segment now emits directionChanged in segment-changed to feed this. getStripingFromSegments also gained the streetmix importer's divider rule: an edge stripe where a divider meets a lane, none between adjacent dividers. Covered by new browser-mode component tests (import migration, hatch plane geometry, divider edge stripes, type/direction recompute) and unit tests for the saved-scene migration. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fuSkZRhP57HDz5RvoELK5
street-generated-pedestrians handled inbound only as an implicit fallthrough (no rotation attribute, relying on the default of 0, which happens to match the clones convention of inbound = 0 / outbound = 180). Make the branch explicit so the direction contract is visible and the epic checkbox "confirm street-generated-pedestrians handles inbound" can close. No behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fuSkZRhP57HDz5RvoELK5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of epic #1720. Closes #1728. Covers three related items from §2/§3:
hatchedfrom a segment surface to a striping generator that crops to segment width (Convert hatched from a segment surface type to a clone/striping generator #1728)street-generated-pedestrianshandlesinbound(the remaining checkbox blocking bug: direction of parking and street lamps incorrect when importing from streetmix #1282)1. Hatched → generator (#1728)
Hatching is now a
street-generated-stripingtreatment (striping: hatched) instead of astreet-segmentsurface material. The generator renders a full-width plane whose square seamless texture tiles at a fixed 4m period in both axes, so the diagonal bars keep their natural angle and density and crop to the segment width instead of stretching across it (the old surface behavior over/under-extended on narrow/wide dividers).Acceptance criteria from the ticket:
hatchedvalue instreet-generated-stripingdividerpreset uses the generator, notsurface: hatched— preset is nowsurface: asphalt+generated.striping: [{striping: hatched}]; the streetmix importer attaches the same generator (street-generated-striping__2, keeping clear of the bare edge-stripe slot) to every divider-preset segmentparseStreetObject):surface: hatchedrewritten on the fly to asphalt + a hatched striping entrymigrateSegmentHatchedSurfaceincreateEntityFromObj, following the existinglevel→elevation/building→boundarymigration pattern (handles prop-string and object forms, picks the first free striping slot)hatchedstays intextureMapsas a deprecated render alias, but is removed from the pickable surfaceoneOf(it left the dropdown; Fix/1728 segment sidebar surface update #1730 had only kept it there because the divider preset set it)2. Auto-striping on segment edits
When a segment's type or direction changes,
managed-streetrecomputes the auto separator stripes on the segment's two shared edges:solid-doubleyellowsolid-stripeedge line is added against the adjacent laneMechanics:
street-segmentnow includesdirectionChangedin itssegment-changedemit (generators already self-guard on width/length, so no spurious clone regeneration).managed-street.updateAutoStripingreuses the samegetStripingFromSegmentsrules as import, only touches left-side separator slots, and never touches full-width hatched treatments or user right-side stripes.getStripingFromSegmentsalso gained the streetmix importer's divider rule (edge stripe where a divider meets a lane, none between adjacent dividers), so edit-time recompute, json-blob import, and streetmix import all agree.Undo-friendliness: the recompute is reactive — undoing the type/direction change re-fires the event and the stripes recompute back.
3. Pedestrians
inbound(#1282)street-generated-pedestrianshandledinboundonly as an implicit fallthrough (no rotation set, relying on the entity default of 0 — which happens to match the clones convention of inbound = 0 / outbound = 180). The branch is now explicit with the convention documented. No behavior change; this confirms the remaining epic checkbox for #1282.Tests
test/components/managed-street-striping.test.js(browser-mode, real Chromium): import migration of a hatched divider, hatch plane geometry (full width, centered, 4m tiling), divider edge stripes on both sides, direction-flip → double yellow, type→divider → hatch + edge stripe in the next free slot, type→sidewalk → stale separator removedtest/core/street-segment-utils.test.js: 6 new unit tests formigrateSegmentHatchedSurface(string/object forms, slot collision, no-ops)test:core195 passing,test:modern762 passing,test:components64 passing; lint + prettier cleanNotes for review
hatched-base, 512² seamless) has its asphalt background baked in, so the plane renders opaque above the segment's (now asphalt) surface — same look as before at lane scale.🤖 Generated with Claude Code
https://claude.ai/code/session_016fuSkZRhP57HDz5RvoELK5
Generated by Claude Code