void R_draw(HDC hDC) { glGetUniformLocation(NULL,NULL); rt_back.Clear(0.2941f, 0.2941f, 0.2941f, 1.0f); rt_scene.Clear(0.3921f, 0.3921f, 0.3921f, 1.0f); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBindFramebuffer(GL_FRAMEBUFFER, rt_scene.fbo); glViewport(0, 0, rt_scene.width, rt_scene.height); camera.setOrthoMatrix(); if(bdrawbglayer01) tilemap_back.draw(&camera); if(bdrawbglayer02) tilemap_front.draw(&camera); if(bdrawbglayer03 && tilemap_back.has_c_Map) DrawCollisionMap(); R_drawWorldDebug(); glViewport(0, 0, client_rect.w, client_rect.h); R_setScreenOrtho(); s_srcRect = ScreenRect(lmenuw/client_rect.w,0,1.0 - ((lmenuw + rmenuw)/client_rect.w),1); s_dstRect = ScreenRect(lmenuw, 0, client_rect.w - (lmenuw + rmenuw), client_rect.h); DrawQuadDS(rt_back, rt_scene,&s_dstRect,&s_srcRect, NULL); glViewport(0, 0, client_rect.w, client_rect.h); glBindFramebuffer(GL_FRAMEBUFFER, debug_rendertarget.fbo); glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); R_setScreenOrtho(); DrawLeftPanel(); DrawRightPanel(); DrawClientBorder(); R_setPostProcessingOrtho(); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); DrawFullscreenQuad(rt_back, debug_rendertarget, NULL); glFlush(); bdoublebuffer ? SwapBuffers( hDC ) : glDrawBuffer(GL_FRONT); }
void SAEEditor::UIDrawEditorMenus(RenderContext& render_ctxt) { eMenuCommandType menu_cmd_type = eMenuCommandType::None; if (ImGui::BeginMainMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("New attractor")) { menu_cmd_type = eMenuCommandType::NewAttractor; } if (ImGui::MenuItem("Save attractor")) { menu_cmd_type = eMenuCommandType::SaveAttractor; } if (ImGui::MenuItem("Load attractor")) { menu_cmd_type = eMenuCommandType::LoadAttractor; } if (ImGui::MenuItem("Load attractor (OLD)")) { menu_cmd_type = eMenuCommandType::LoadAttractorOld; } if (ImGui::MenuItem("Export Obj")) { menu_cmd_type = eMenuCommandType::ExportObj; } if (ImGui::MenuItem("Export Ply")) { menu_cmd_type = eMenuCommandType::ExportPly; } if (ImGui::MenuItem("Export Pbrt scene file")) { menu_cmd_type = eMenuCommandType::ExportPbrt; } ImGui::EndMenu(); } ImGui::EndMainMenuBar(); } if (menu_cmd_type != eMenuCommandType::None) { m_current_menu_cmd_type = menu_cmd_type; ImGui::OpenPopup("File dialog"); } if (ImGui::BeginPopupModal("File dialog")) { DrawFileDialog(m_current_menu_cmd_type); const char* button_labels[(int)eMenuCommandType::Count] = { "", "Save attractor (.sae)", "Load attractor (.sae)", "Load attractor (.sae)", "Export obj", "Export ply", "Export pbrt scene (.pbrt)" }; if (ImGui::Button(button_labels[(int)m_current_menu_cmd_type])) { // Execute command here switch (m_current_menu_cmd_type) { case eMenuCommandType::SaveAttractor: case eMenuCommandType::LoadAttractor: case eMenuCommandType::LoadAttractorOld: { String filename = m_current_file_path + m_current_file_name; File file; if (file.Open(filename.c_str(), m_current_menu_cmd_type == eMenuCommandType::SaveAttractor ? true : false)) { bool old_format = (m_current_menu_cmd_type == eMenuCommandType::LoadAttractorOld ? true : false); AttractorManager::GetStaticInstance()->SerializeAttractor(file, old_format); } break; } case eMenuCommandType::ExportObj: { String filename = m_current_file_path + m_current_file_name; File file; if (file.Open(filename.c_str(), true)) { AttractorManager::GetStaticInstance()->ExportAttractorAsObj(file); } break; } case eMenuCommandType::ExportPly: { String filename = m_current_file_path + m_current_file_name; File file; if (file.Open(filename.c_str(), true)) { AttractorManager::GetStaticInstance()->ExportAttractorAsPly(file); } break; } case eMenuCommandType::ExportPbrt: { AttractorManager::GetStaticInstance()->ExportAttractorAsPbrtScene(m_current_file_path, m_current_file_name); break; } default: break; } m_current_menu_cmd_type = eMenuCommandType::None; ImGui::CloseCurrentPopup(); RefreshListFiles(); } ImGui::SameLine(); if (ImGui::Button("Cancel")) { m_current_menu_cmd_type = eMenuCommandType::None; ImGui::CloseCurrentPopup(); } ImGui::EndPopup(); } DrawRightPanel(render_ctxt); }