mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 09:56:04 +08:00
Downscale axes when viewed from close-up
This commit is contained in:
parent
f591c2503a
commit
451097bcac
@ -44,17 +44,23 @@ void CoordAxes::render(const Transform3d& trafo, float emission_factor)
|
|||||||
shader->start_using();
|
shader->start_using();
|
||||||
shader->set_uniform("emission_factor", emission_factor);
|
shader->set_uniform("emission_factor", emission_factor);
|
||||||
|
|
||||||
|
// Scale the axes if the camera is close to them to avoid issues
|
||||||
|
// such as https://github.com/prusa3d/PrusaSlicer/issues/9483
|
||||||
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
|
Transform3d scale_tr = Transform3d::Identity();
|
||||||
|
scale_tr.scale(std::min(1., camera.get_inv_zoom() * 10.));
|
||||||
|
|
||||||
// x axis
|
// x axis
|
||||||
m_arrow.set_color(ColorRGBA::X());
|
m_arrow.set_color(ColorRGBA::X());
|
||||||
render_axis(*shader, trafo * Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ 0.0, 0.5 * M_PI, 0.0 }));
|
render_axis(*shader, trafo * Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ 0.0, 0.5 * M_PI, 0.0 }) * scale_tr);
|
||||||
|
|
||||||
// y axis
|
// y axis
|
||||||
m_arrow.set_color(ColorRGBA::Y());
|
m_arrow.set_color(ColorRGBA::Y());
|
||||||
render_axis(*shader, trafo * Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ -0.5 * M_PI, 0.0, 0.0 }));
|
render_axis(*shader, trafo * Geometry::translation_transform(m_origin) * Geometry::rotation_transform({ -0.5 * M_PI, 0.0, 0.0 }) * scale_tr);
|
||||||
|
|
||||||
// z axis
|
// z axis
|
||||||
m_arrow.set_color(ColorRGBA::Z());
|
m_arrow.set_color(ColorRGBA::Z());
|
||||||
render_axis(*shader, trafo * Geometry::translation_transform(m_origin));
|
render_axis(*shader, trafo * Geometry::translation_transform(m_origin) * scale_tr);
|
||||||
|
|
||||||
shader->stop_using();
|
shader->stop_using();
|
||||||
if (curr_shader != nullptr)
|
if (curr_shader != nullptr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user