| 34 | } |
| 35 | |
| 36 | void MultiViewInterface::displayLoop(sibr::Window & window, std::function<void(MultiViewInterface*)> f) |
| 37 | { |
| 38 | |
| 39 | if (layersData.size() == 0) { |
| 40 | SIBR_ERR << " cant display interface without image layer added" << std::endl; |
| 41 | } |
| 42 | |
| 43 | utils.initAllShaders(); |
| 44 | |
| 45 | glClearColor(0.8f, 0.8f, 0.8f, 1.0f); |
| 46 | |
| 47 | window.size(window.size().x(), (int)std::ceil(window.size().x() / scalesData[0].imRatio)); |
| 48 | |
| 49 | std::cout << " window size : " << window.size().transpose() << std::endl; |
| 50 | |
| 51 | imagesView.viewport = sibr::Viewport(&window.viewport(),0,0,1,1); |
| 52 | imagesView.isActive = true; |
| 53 | |
| 54 | if (cpuMesh.get()) { |
| 55 | meshViewer.setMainMesh(*cpuMesh, sibr::Mesh::FillRenderMode, false, true); |
| 56 | } else { |
| 57 | std::cout << " no mesh " << std::endl; |
| 58 | } |
| 59 | |
| 60 | winSize = window.size().cast<float>(); |
| 61 | |
| 62 | while (window.isOpened()) { |
| 63 | |
| 64 | //std::cout << "." << std::flush; |
| 65 | |
| 66 | window.makeContextCurrent(); |
| 67 | sibr::Input::poll(); |
| 68 | |
| 69 | winSize = window.size().cast<float>(); |
| 70 | imagesInput = sibr::Input::subInput(sibr::Input::global(), imagesView.viewport); |
| 71 | meshInput = sibr::Input::subInput(sibr::Input::global(), meshView.viewport); |
| 72 | |
| 73 | if (sibr::Input::global().key().isPressed(sibr::Key::Escape)) { |
| 74 | break; |
| 75 | } |
| 76 | |
| 77 | update(window, sibr::Input::global()); |
| 78 | |
| 79 | onGui(); |
| 80 | |
| 81 | render(); |
| 82 | |
| 83 | f(this); |
| 84 | |
| 85 | window.swapBuffer(); |
| 86 | |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void MultiViewInterface::addCameras(const std::vector<InputCamera::Ptr>& input_cams) |
| 91 | { |
nothing calls this directly
no test coverage detected