MCPcopy Create free account
hub / github.com/city-super/Octree-GS / gui_cameras

Method gui_cameras

SIBR_viewers/src/core/view/SceneDebugView.cpp:405–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403 }
404
405 void SceneDebugView::gui_cameras()
406 {
407 if (ImGui::CollapsingHeader("Cameras##SceneDebugView")) {
408
409 ImGui::SliderInt("Camera ID info", &_cameraIdInfoGUI, 0, static_cast<int>(_cameras.size()) - 1);
410
411
412 ImGui::Columns(4); // 0 name | snapto | active| size
413
414 ImGui::Separator();
415 ImGui::Text("Camera"); ImGui::NextColumn();
416 ImGui::Text("SnapTo"); ImGui::NextColumn();
417 ImGui::Text("Active"); ImGui::NextColumn();
418
419 static std::vector<std::string> cam_info_option_str = { "size", "focal", "fov_y","aspect" };
420 if (ImGui::BeginCombo("Info", cam_info_option_str[_camInfoOption].c_str())) {
421 for (int i = 0; i < (int)cam_info_option_str.size(); ++i) {
422 if (ImGui::Selectable(cam_info_option_str[i].c_str(), _camInfoOption == i)) {
423 _camInfoOption = (CameraInfoDisplay)i;
424 }
425 }
426 ImGui::EndCombo();
427 }
428 ImGui::NextColumn();
429 ImGui::Separator();
430
431 //for (uint i = 0; i < _cameras.size(); ++i)
432 {
433 std::string name = "cam_" + intToString<4>(_cameraIdInfoGUI);
434 ImGui::Text(name.c_str());
435 ImGui::NextColumn();
436
437 if (ImGui::Button(("SnapTo##" + name).c_str())) {
438 const auto & input_cam = _scene->cameras()->inputCameras()[0];
439
440 auto size = camera_handler.getViewport().finalSize();
441 float ratio_dst = size[0] / size[1];
442 float ratio_src = input_cam->w() / (float)input_cam->h();
443 InputCamera cam = InputCamera(_cameras[_cameraIdInfoGUI].cam, (int)size[0], (int)size[1]);
444
445 if (ratio_src < ratio_dst) {
446 float fov_h = 2 * atan(tan(input_cam->fovy() / 2) * ratio_src / ratio_dst);
447 cam.fovy(fov_h);
448 } else {
449 cam.fovy(input_cam->fovy());
450 }
451
452 cam.znear(0.0001f);
453 camera_handler.fromCamera(cam, true, false);
454 }
455 ImGui::NextColumn();
456
457 ImGui::Checkbox(("##is_valid" + name).c_str(), &_cameras[_cameraIdInfoGUI].highlight);
458 ImGui::NextColumn();
459
460 const auto & cam = _cameras[_cameraIdInfoGUI].cam;
461 std::stringstream tmp;
462 switch (_camInfoOption)

Callers

nothing calls this directly

Calls 12

InputCameraFunction · 0.85
finalSizeMethod · 0.80
getViewportMethod · 0.80
fovyMethod · 0.80
znearMethod · 0.80
focalMethod · 0.80
aspectMethod · 0.80
sizeMethod · 0.45
camerasMethod · 0.45
wMethod · 0.45
hMethod · 0.45
fromCameraMethod · 0.45

Tested by

no test coverage detected