Skip to content

Snap scenery objects vertex-to-vertex and edge-to-edge - #123

Open
benchan0527 wants to merge 7 commits into
openOMSI-org:mainfrom
benchan0527:feat/vertex-snap
Open

benchan0527 wants to merge 7 commits into
openOMSI-org:mainfrom
benchan0527:feat/vertex-snap

Conversation

@benchan0527

Copy link
Copy Markdown
Contributor

Summary

  • Vertex-to-vertex snapping (Key V): Allows snapping a scenery object to another object by matching a selected vertex from the source object to a target vertex on another object, translating the whole source object accurately.
  • Edge-to-edge snapping (Key L): Allows aligning and snapping a scenery object along an edge of another object or along a road/spline:
    • Supports full 3D rotation alignment or horizontal-only yaw alignment (Shift key).
    • Works with mesh edges (including complex models up to 200,000 edges) and object bounding box edges.
    • Supports snapping to road splines as target edges.
  • UI & Controls:
    • Added dedicated snap buttons in the top toolbar and in the right-side Scenery Object properties panel.
    • Interactive visual overlay: shows highlighted glowing vertices and edge lines, depth-culled nearest raycast picking, and a connecting guide line while picking.
    • Registered in Command Palette (Ctrl+P -> "Snap Vertex to Vertex", "Snap Edge to Edge").
    • Mutually exclusive activation between vertex snap and edge snap modes.
  • Asset path normalization: Normalized backslashes and slashes in asset lookup keys so models located in subfolders load reliably on all platforms.

Test plan

  • Select a scenery object, press V (or click the vertex snap button in toolbar/properties panel): glowing red vertices appear. Click a vertex on the source object, then click a target vertex on another object; confirm the source object snaps cleanly to align the two vertices.
  • Select a scenery object, press L (or click the edge snap button): orange wireframe edges appear. Click a source edge, then click a target edge on another object or road spline; confirm the source object rotates and translates to align along the target edge.
  • Hold Shift while clicking a target edge in edge snap mode; confirm rotation is constrained to horizontal yaw only.
  • Test on a large complex scenery object (e.g. northkcnewnew2.sco with >30k edges); confirm all edges render and are selectable without crashing or freezing.
  • Press Esc at any time during snapping to cancel cleanly without altering the scene.
  • Run cargo test --bin openmapper snap; confirm all unit tests pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant