You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

58 lines
2.2 KiB

//
// Created by cflin on 4/14/23.
//
#include "StaticSimGUI.h"
namespace ssim{
void StaticSimGUI::viewer_launch() {
auto config_viewer = [&] {
viewer_.core().set_rotation_type(
igl::opengl::ViewerCore::ROTATION_TYPE_NO_ROTATION);
viewer_.core().orthographic = false;
viewer_.core().is_animating = true;
viewer_.core().lighting_factor = 0.0;
viewer_.core().animation_max_fps = 120.0;
// Camera parameters
viewer_.core().camera_zoom = 1.0f;
viewer_.core().camera_translation << 0, 0, 0;
};
config_viewer();
viewer_.callback_pre_draw = [&](igl::opengl::glfw::Viewer &) {
return pre_draw_loop();
};
viewer_.callback_post_draw = [&](igl::opengl::glfw::Viewer &) {
return post_draw_loop();
};
viewer_.callback_key_pressed = [&](igl::opengl::glfw::Viewer &,
unsigned int unicode_key,
int modifiers) {
return false;
};
menu_.callback_draw_viewer_menu = [&]() {
menu_draw_viewer_menu();
};
menu_.callback_draw_viewer_window=[&](){
float menu_width = 180.f *plugin_.hidpi_scaling() / plugin_.pixel_ratio();
ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(0.0f, 0.0f), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSizeConstraints(ImVec2(menu_width, -1.0f), ImVec2(menu_width, -1.0f));
bool _viewer_menu_visible = true;
ImGui::Begin(
"菜单", &_viewer_menu_visible,
ImGuiWindowFlags_NoSavedSettings
| ImGuiWindowFlags_AlwaysAutoResize
);
ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.4f);
// call menu here
menu_draw_viewer_menu();
ImGui::PopItemWidth();
ImGui::End();
};
viewer_.launch(
/*resizable=*/true, /*fullscreen=*/false,
/*name=*/"静力学仿真");
}
}