mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-06 09:03:52 +00:00
feat(editor): click-to-place path points for river/road carver
- River/Road tool now uses click-capture mode instead of button-based cursor position — click terrain directly to set start and end points - 3-step flow: Click Start → Click End → Apply Path (with preview text) - Cancel button available at each step - Path state tracked on EditorUI with setPathPoint()/clearPath() - Intercepts terrain clicks before mode-specific handling when active
This commit is contained in:
parent
4e2f704124
commit
6b3cdd325a
3 changed files with 91 additions and 37 deletions
|
|
@ -360,8 +360,25 @@ void EditorApp::processEvents() {
|
|||
giz.endDrag();
|
||||
giz.setMode(TransformMode::None);
|
||||
} else if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||
// Path point capture (river/road tool)
|
||||
if (ui_.getPathCapture() != EditorUI::PathCapture::None) {
|
||||
auto ext = window_->getVkContext()->getSwapchainExtent();
|
||||
rendering::Ray ray = camera_.getCamera().screenToWorldRay(
|
||||
static_cast<float>(event.button.x),
|
||||
static_cast<float>(event.button.y),
|
||||
static_cast<float>(ext.width),
|
||||
static_cast<float>(ext.height));
|
||||
glm::vec3 hitPos;
|
||||
if (terrainEditor_.raycastTerrain(ray, hitPos)) {
|
||||
ui_.setPathPoint(hitPos);
|
||||
if (ui_.getPathCapture() == EditorUI::PathCapture::None && ui_.isPathReady())
|
||||
showToast("Both points set — click Apply Path");
|
||||
else if (ui_.getPathCapture() == EditorUI::PathCapture::WaitingEnd)
|
||||
showToast("Start point set — click terrain for end");
|
||||
}
|
||||
}
|
||||
// Ctrl+click = select object (any mode)
|
||||
if ((event.key.keysym.mod & KMOD_CTRL) || (SDL_GetModState() & KMOD_CTRL)) {
|
||||
else if ((event.key.keysym.mod & KMOD_CTRL) || (SDL_GetModState() & KMOD_CTRL)) {
|
||||
auto ext = window_->getVkContext()->getSwapchainExtent();
|
||||
rendering::Ray ray = camera_.getCamera().screenToWorldRay(
|
||||
static_cast<float>(event.button.x),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue