16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 00:09:18 +02:00
This commit is contained in:
milek7
2018-08-03 16:28:01 +02:00
parent d7c7305906
commit af0e193bde
5 changed files with 19 additions and 12 deletions

View File

@@ -279,7 +279,7 @@ void TPythonScreenRenderer::updateTexture()
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
// build texture // build texture
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, textureData ); glTexImage2D( GL_TEXTURE_2D, 0, GL_SRGB8_ALPHA8, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, textureData );
#ifdef _PY_INT_MORE_LOG #ifdef _PY_INT_MORE_LOG
GLenum status = glGetError(); GLenum status = glGetError();

View File

@@ -69,7 +69,10 @@ void map::render(scene::basic_region *Region)
if (!scene_ubo) if (!scene_ubo)
if (!init()) if (!init())
{
map_opened = false;
return; return;
}
ImGui::SetNextWindowSizeConstraints(ImVec2(200, 200), ImVec2(fb_size, fb_size)); ImGui::SetNextWindowSizeConstraints(ImVec2(200, 200), ImVec2(fb_size, fb_size));
if (ImGui::Begin("Map", &map_opened, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) if (ImGui::Begin("Map", &map_opened, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse))
@@ -165,7 +168,8 @@ void map::render(scene::basic_region *Region)
if (Global.iMultisampling) if (Global.iMultisampling)
m_fb->blit_from(*m_msaa_fb, size.x, size.y, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT0); m_fb->blit_from(*m_msaa_fb, size.x, size.y, GL_COLOR_BUFFER_BIT, GL_COLOR_ATTACHMENT0);
m_fb->unbind(); gl::framebuffer::unbind();
m_shader->unbind();
ImGui::ImageButton(reinterpret_cast<void*>(m_tex->id), size, ImVec2(0, size.y / fb_size), ImVec2(size.x / fb_size, 0), 0); ImGui::ImageButton(reinterpret_cast<void*>(m_tex->id), size, ImVec2(0, size.y / fb_size), ImVec2(size.x / fb_size, 0), 0);

View File

@@ -383,7 +383,7 @@ void opengl_renderer::Render_pass(rendermode const Mode)
Update_Lights(simulation::Lights); Update_Lights(simulation::Lights);
scene_ubs.time = Timer::GetTime(); scene_ubs.time = Timer::GetTime();
scene_ubs.projection = OpenGLMatrices.data(GL_PROJECTION); scene_ubs.projection = OpenGLMatrices.data(GL_PROJECTION);
scene_ubo->update(scene_ubs); scene_ubo->update(scene_ubs);
scene_ubo->bind_uniform(); scene_ubo->bind_uniform();
m_colorpass = m_renderpass; m_colorpass = m_renderpass;
@@ -521,6 +521,9 @@ void opengl_renderer::Render_pass(rendermode const Mode)
glDebug("uilayer render"); glDebug("uilayer render");
UILayer.render(); UILayer.render();
// restore binding
scene_ubo->bind_uniform();
glDebug("rendermode::color end"); glDebug("rendermode::color end");
break; break;
} }

View File

@@ -142,14 +142,14 @@ bool ui_layer::on_key(int const Key, int const Action)
case GLFW_KEY_F2: case GLFW_KEY_F2:
{ {
// parametry pojazdu // parametry pojazdu
vehicle_info_active = !vehicle_info_active; timetable_active = !timetable_active;
return true; return true;
} }
case GLFW_KEY_F3: case GLFW_KEY_F3:
{ {
// timetable // timetable
timetable_active = !timetable_active; vehicle_info_active = !vehicle_info_active;
return true; return true;
} }
@@ -335,7 +335,7 @@ void ui_layer::render()
ImGui::End(); ImGui::End();
} }
if (vehicle_info_active) if (timetable_active)
{ {
// timetable // timetable
auto *vehicle{(FreeFlyModeFlag ? std::get<TDynamicObject *>(simulation::Region->find_vehicle(camera->Pos, 20, false, false)) : controlled)}; // w trybie latania lokalizujemy wg mapy auto *vehicle{(FreeFlyModeFlag ? std::get<TDynamicObject *>(simulation::Region->find_vehicle(camera->Pos, 20, false, false)) : controlled)}; // w trybie latania lokalizujemy wg mapy
@@ -368,7 +368,7 @@ void ui_layer::render()
} }
ImGui::SetNextWindowSize(ImVec2(0, 0)); ImGui::SetNextWindowSize(ImVec2(0, 0));
ImGui::Begin("Timetable", &vehicle_info_active, ImGuiWindowFlags_NoResize); ImGui::Begin("Timetable", &timetable_active, ImGuiWindowFlags_NoResize);
ImGui::TextUnformatted(uitextline1.c_str()); ImGui::TextUnformatted(uitextline1.c_str());
ImGui::TextUnformatted(uitextline2.c_str()); ImGui::TextUnformatted(uitextline2.c_str());
ImGui::TextUnformatted(uitextline3.c_str()); ImGui::TextUnformatted(uitextline3.c_str());
@@ -424,10 +424,10 @@ void ui_layer::render()
f2_cancel:; f2_cancel:;
if (timetable_active) if (vehicle_info_active)
{ {
ImGui::SetNextWindowSize(ImVec2(0, 0)); ImGui::SetNextWindowSize(ImVec2(0, 0));
ImGui::Begin("Vehicle status", &timetable_active, ImGuiWindowFlags_NoResize); ImGui::Begin("Vehicle status", &vehicle_info_active, ImGuiWindowFlags_NoResize);
uitextline1 = ""; uitextline1 = "";
uitextline2 = ""; uitextline2 = "";
@@ -1120,8 +1120,8 @@ f2_cancel:;
if (ImGui::BeginMenu("Window")) if (ImGui::BeginMenu("Window"))
{ {
ImGui::MenuItem("Basic info", "F1", &basic_info_active); ImGui::MenuItem("Basic info", "F1", &basic_info_active);
ImGui::MenuItem("Timetable", "F2", &vehicle_info_active); ImGui::MenuItem("Timetable", "F2", &timetable_active);
ImGui::MenuItem("Vehicle info", "F3", &timetable_active); ImGui::MenuItem("Vehicle info", "F3", &vehicle_info_active);
ImGui::MenuItem("Renderer stats", "F8", &renderer_debug_active); ImGui::MenuItem("Renderer stats", "F8", &renderer_debug_active);
ImGui::MenuItem("Scenery inspector", "F11", &EditorModeFlag); ImGui::MenuItem("Scenery inspector", "F11", &EditorModeFlag);
ImGui::MenuItem("Events", nullptr, &events_active); ImGui::MenuItem("Events", nullptr, &events_active);

View File

@@ -64,8 +64,8 @@ private:
// members: // members:
GLFWwindow *m_window { nullptr }; GLFWwindow *m_window { nullptr };
bool basic_info_active = false; bool basic_info_active = false;
bool vehicle_info_active = false;
bool timetable_active = false; bool timetable_active = false;
bool vehicle_info_active = false;
bool renderer_debug_active = false; bool renderer_debug_active = false;
bool about_active = false; bool about_active = false;
bool quit_active = false; bool quit_active = false;