mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 07:29:20 +02:00
Remove glLineWidth probe and wide line calls that never take effect on core contexts
This commit is contained in:
@@ -799,9 +799,6 @@ void opengl46_renderer::Render_pass(viewport_config &vp, rendermode const Mode)
|
||||
scene_ubo->update(scene_ubs);
|
||||
scene_ubo->bind_uniform();
|
||||
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(1.0f);
|
||||
|
||||
if (Global.bWireFrame)
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
else
|
||||
@@ -4702,8 +4699,6 @@ void opengl46_renderer::Render_Alpha(TTraction *Traction)
|
||||
// setup
|
||||
auto const distance{static_cast<float>(std::sqrt(distancesquared))};
|
||||
auto const linealpha = 20.f * Traction->WireThickness / std::max(0.5f * Traction->radius() + 1.f, distance - (0.5f * Traction->radius()));
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(std::clamp(0.5f * linealpha + Traction->WireThickness * Traction->radius() / 1000.f, 1.f, 1.75f));
|
||||
|
||||
// render
|
||||
|
||||
@@ -4720,9 +4715,6 @@ void opengl46_renderer::Render_Alpha(TTraction *Traction)
|
||||
// debug data
|
||||
++m_renderpass.draw_stats.traction;
|
||||
++m_renderpass.draw_stats.drawcalls;
|
||||
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(1.0f);
|
||||
}
|
||||
|
||||
void opengl46_renderer::Render_editor_overlay()
|
||||
@@ -4789,8 +4781,6 @@ void opengl46_renderer::Render_Alpha(scene::lines_node const &Lines)
|
||||
auto const distance{static_cast<float>(std::sqrt(distancesquared))};
|
||||
auto const linealpha =
|
||||
(data.line_width > 0.f ? 10.f * data.line_width / std::max(0.5f * data.area.radius + 1.f, distance - (0.5f * data.area.radius)) : 1.f); // negative width means the lines are always opague
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(std::clamp(0.5f * linealpha + data.line_width * data.area.radius / 1000.f, 1.f, 8.f));
|
||||
|
||||
model_ubs.param[0] = glm::vec4(glm::vec3(data.lighting.diffuse * m_sunlight.ambient), glm::min(1.0f, linealpha));
|
||||
|
||||
@@ -4802,9 +4792,6 @@ void opengl46_renderer::Render_Alpha(scene::lines_node const &Lines)
|
||||
|
||||
++m_renderpass.draw_stats.lines;
|
||||
++m_renderpass.draw_stats.drawcalls;
|
||||
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(1.0f);
|
||||
}
|
||||
|
||||
bool opengl46_renderer::Render_Alpha(TDynamicObject *Dynamic)
|
||||
@@ -6058,16 +6045,6 @@ bool opengl46_renderer::Init_caps()
|
||||
if (!GLAD_GL_EXT_texture_compression_s3tc)
|
||||
ErrorLog("EXT_texture_compression_s3tc not supported!");
|
||||
|
||||
glGetError();
|
||||
glLineWidth(2.0f);
|
||||
if (!glGetError())
|
||||
{
|
||||
WriteLog("wide lines supported!");
|
||||
m_widelines_supported = true;
|
||||
}
|
||||
else
|
||||
WriteLog("warning: wide lines not supported");
|
||||
|
||||
WriteLog("--------");
|
||||
|
||||
// ograniczenie maksymalnego rozmiaru tekstur - parametr dla skalowania tekstur
|
||||
|
||||
@@ -542,8 +542,6 @@ class opengl46_renderer : public gfx_renderer {
|
||||
|
||||
bool m_blendingenabled;
|
||||
|
||||
bool m_widelines_supported;
|
||||
|
||||
struct headlight_config_s
|
||||
{
|
||||
float in_cutoff = 1.005f;
|
||||
|
||||
@@ -66,11 +66,6 @@ ui::map_panel::map_panel() : ui_panel(STR_C("Map"), false)
|
||||
}
|
||||
}
|
||||
|
||||
glGetError();
|
||||
glLineWidth(2.0f);
|
||||
if (!glGetError())
|
||||
m_widelines_supported = true;
|
||||
|
||||
scene_ubo = std::make_unique<gl::ubo>(sizeof(gl::scene_ubs), 0);
|
||||
|
||||
init_done = true;
|
||||
@@ -134,8 +129,6 @@ void ui::map_panel::render_map_texture(glm::mat4 transform, glm::vec2 surface_si
|
||||
}
|
||||
|
||||
m_track_shader->bind();
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(1.5f);
|
||||
glViewport(0, 0, surface_size.x, surface_size.y);
|
||||
|
||||
scene_ubs.projection = transform;
|
||||
@@ -148,26 +141,18 @@ void ui::map_panel::render_map_texture(glm::mat4 transform, glm::vec2 surface_si
|
||||
|
||||
gl33->Draw_Geometry(m_section_handles.begin(), m_section_handles.end());
|
||||
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(4.5f);
|
||||
scene_ubs.cascade_end = glm::vec4(0.7f, 0.7f, 0.0f, 0.0f);
|
||||
scene_ubo->update(scene_ubs);
|
||||
gl33->Draw_Geometry(m_colored_paths.future.begin(), m_colored_paths.future.end());
|
||||
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(3.0f);
|
||||
scene_ubs.cascade_end = glm::vec4(0.0f, 1.0f, 0.0f, 0.0f);
|
||||
scene_ubo->update(scene_ubs);
|
||||
gl33->Draw_Geometry(m_colored_paths.switches.begin(), m_colored_paths.switches.end());
|
||||
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(1.5f);
|
||||
scene_ubs.cascade_end = glm::vec4(1.0f, 0.0f, 0.0f, 0.0f);
|
||||
scene_ubo->update(scene_ubs);
|
||||
gl33->Draw_Geometry(m_colored_paths.occupied.begin(), m_colored_paths.occupied.end());
|
||||
|
||||
if (m_widelines_supported)
|
||||
glLineWidth(4.0f);
|
||||
scene_ubs.cascade_end = glm::vec4(0.3f, 0.3f, 1.0f, 0.0f);
|
||||
scene_ubo->update(scene_ubs);
|
||||
gl33->Draw_Geometry(m_colored_paths.highlighted.begin(), m_colored_paths.highlighted.end());
|
||||
|
||||
@@ -115,8 +115,6 @@ class map_panel : public ui_panel
|
||||
std::vector<gfx::geometrybank_handle> m_section_handles;
|
||||
map_colored_paths m_colored_paths;
|
||||
|
||||
bool m_widelines_supported;
|
||||
|
||||
const int fb_size = 1024;
|
||||
|
||||
glm::vec2 translate;
|
||||
|
||||
Reference in New Issue
Block a user