| 469 | } |
| 470 | |
| 471 | void UI::ShowCameraControls(Window& window) { |
| 472 | if (!showCameraControls) return; |
| 473 | |
| 474 | ImGui::SetNextWindowPos(ImVec2(1044, 100), ImGuiCond_FirstUseEver); |
| 475 | ImGui::SetNextWindowSize(ImVec2(224, 296), ImGuiCond_FirstUseEver); |
| 476 | if (ImGui::Begin("Camera Controls", &showCameraControls)) { |
| 477 | Camera& camera = window.GetCamera(); |
| 478 | |
| 479 | // Navigation mode |
| 480 | const char* navModes[] = { "Arcball", "First Person", "Selection" }; |
| 481 | int currentMode = (int)window.GetControlMode(); |
| 482 | if (ImGui::Combo("Navigation Mode", ¤tMode, navModes, IM_ARRAYSIZE(navModes))) |
| 483 | window.SetControlMode((Window::ControlMode)currentMode); |
| 484 | |
| 485 | // Projection mode |
| 486 | bool ortho = camera.IsOrthographic(); |
| 487 | if (ImGui::Checkbox("Orthographic", &ortho)) |
| 488 | camera.SetOrthographic(ortho); |
| 489 | if (ImGui::IsItemHovered()) |
| 490 | ImGui::SetTooltip("Toggle orthographic/perspective projection mode"); |
| 491 | |
| 492 | // FOV slider |
| 493 | float fov = (float)camera.GetFOV(); |
| 494 | if (ImGui::SliderFloat("FOV", &fov, 1.f, 179.f, "%.1f°")) |
| 495 | camera.SetFOV(fov); |
| 496 | if (ImGui::IsItemHovered()) |
| 497 | ImGui::SetTooltip("Field of View (FOV) angle"); |
| 498 | |
| 499 | // Camera rendering checkbox |
| 500 | if (ImGui::Checkbox("Show Cameras", &window.showCameras)) |
| 501 | window.RequestRedraw(); |
| 502 | if (ImGui::IsItemHovered()) |
| 503 | ImGui::SetTooltip("Toggle camera frustum display (C key)"); |
| 504 | if (ImGui::SliderFloat("Camera Size", &window.cameraSize, 0.005f, 0.5f, "%.4f")) { |
| 505 | window.GetRenderer().UploadCameras(window); |
| 506 | window.GetRenderer().UploadSelection(window); |
| 507 | } |
| 508 | if (ImGui::IsItemHovered()) |
| 509 | ImGui::SetTooltip("Adjust camera size"); |
| 510 | |
| 511 | // Arcball sensitivity controls (only show when in arcball mode) |
| 512 | if (window.GetControlMode() == Window::CONTROL_ARCBALL) { |
| 513 | ImGui::Separator(); |
| 514 | ImGui::Text("Arcball Sensitivity"); |
| 515 | ArcballControls& arcballControls = window.GetArcballControls(); |
| 516 | // General Sensitivity input |
| 517 | float sensitivity = (float)arcballControls.getSensitivity(); |
| 518 | if (ImGui::InputFloat("Sensitivity", &sensitivity, 0.1f, 5.f, "%.2f")) |
| 519 | arcballControls.setSensitivity(MAXF(0.001f, sensitivity)); |
| 520 | if (ImGui::IsItemHovered()) |
| 521 | ImGui::SetTooltip("Overall sensitivity multiplier"); |
| 522 | // Rotation Sensitivity slider |
| 523 | float rotationSensitivity = (float)arcballControls.getRotationSensitivity(); |
| 524 | if (ImGui::SliderFloat("Rotation", &rotationSensitivity, 0.1f, 5.f, "%.2f")) |
| 525 | arcballControls.setRotationSensitivity(rotationSensitivity); |
| 526 | if (ImGui::IsItemHovered()) |
| 527 | ImGui::SetTooltip("Rotation sensitivity"); |
| 528 | // Zoom Sensitivity slider |
no test coverage detected