MCPcopy Create free account
hub / github.com/city-super/Scaffold-GS / onGUI

Method onGUI

SIBR_viewers/src/core/view/InteractiveCameraHandler.cpp:502–708  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500 }
501
502 void InteractiveCameraHandler::onGUI(const std::string& suffix) {
503
504 const std::string fullName = (suffix);
505
506
507 // Saving camera.
508 if (ImGui::Begin(fullName.c_str())) {
509
510 ImGui::PushScaledItemWidth(130);
511 ImGui::Combo("Mode", (int*)&_currentMode, "FPS\0Orbit\0Interp.\0Trackball\0None\0\0");
512 switchMode(_currentMode);
513 ImGui::SameLine();
514 if (ImGui::Button("Load camera")) {
515 std::string selectedFile;
516 if (sibr::showFilePicker(selectedFile, Default)) {
517 if (!selectedFile.empty()) {
518 sibr::InputCamera savedCam;
519 savedCam.loadFromBinary(selectedFile);
520 SIBR_LOG << "Loaded saved camera (" << selectedFile << ")." << std::endl;
521 fromCamera(savedCam, false);
522 }
523 }
524 }
525
526 ImGui::SameLine();
527 if (ImGui::Button("Save camera (bin)")) {
528 std::string selectedFile;
529 if (sibr::showFilePicker(selectedFile, Save)) {
530 if (!selectedFile.empty()) {
531 if (selectedFile[selectedFile.size() - 1] == '/' || selectedFile[selectedFile.size() - 1] == '\\') {
532 selectedFile.append("default_camera.bin");
533 }
534 _currentCamera.saveToBinary(selectedFile);
535 SIBR_LOG << "Saved camera (" << selectedFile << ")." << std::endl;
536 }
537 }
538 }
539
540
541 ImGui::Separator();
542 if (ImGui::Button("Snap to closest")) {
543 _currentCamId = findNearestCamera(_interpPath);
544 snapToCamera(_currentCamId);
545 }
546 ImGui::SameLine();
547 if (ImGui::InputInt("Snap to", &_currentCamId, 1, 10)) {
548 _currentCamId = sibr::clamp(_currentCamId, 0, int(_interpPath.size()) - 1);
549 snapToCamera(_currentCamId);
550 }
551
552 if (_currentMode == TRACKBALL) {
553 ImGui::SameLine();
554 ImGui::Checkbox("Show trackball", &_trackball.drawThis);
555 }
556
557 if (ImGui::InputFloat("Fov Y", &_cameraFovDeg, 1.0f, 5.0f)) {
558 _cameraFovDeg = sibr::clamp(_cameraFovDeg, 1.0f, 180.0f);
559 _currentCamera.fovy(_cameraFovDeg * float(M_PI) / 180.0f);

Callers

nothing calls this directly

Calls 15

PushScaledItemWidthFunction · 0.85
showFilePickerFunction · 0.85
loadFromBinaryMethod · 0.80
saveToBinaryMethod · 0.80
fovyMethod · 0.80
znearMethod · 0.80
zfarMethod · 0.80
pop_backMethod · 0.80
playbackMethod · 0.80
recordMethod · 0.80
stopMethod · 0.80
saveAsLookAtMethod · 0.80

Tested by

no test coverage detected