GCodeViewer -> Refactoring of sequential view marker positioning
This commit is contained in:
parent
f345e58358
commit
6e279cbec2
2 changed files with 11 additions and 3 deletions
|
@ -156,6 +156,12 @@ void GCodeViewer::SequentialView::Marker::init()
|
|||
#endif // !ENABLE_SHADERS_MANAGER
|
||||
}
|
||||
|
||||
void GCodeViewer::SequentialView::Marker::set_world_position(const Vec3f& position)
|
||||
{
|
||||
m_world_transform = (Geometry::assemble_transform(position.cast<double>()) * Geometry::assemble_transform(m_model.get_bounding_box().size()[2] * Vec3d::UnitZ(), { M_PI, 0.0, 0.0 })).cast<float>();
|
||||
m_world_bounding_box = m_model.get_bounding_box().transformed(m_world_transform.cast<double>());
|
||||
}
|
||||
|
||||
void GCodeViewer::SequentialView::Marker::render() const
|
||||
{
|
||||
#if ENABLE_SHADERS_MANAGER
|
||||
|
@ -346,7 +352,7 @@ void GCodeViewer::render() const
|
|||
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
render_toolpaths();
|
||||
m_sequential_view.marker.set_world_transform(Geometry::assemble_transform(m_sequential_view.current_position.cast<double>() + (0.5 + 12.0) * Vec3d::UnitZ(), { M_PI, 0.0, 0.0 }).cast<float>());
|
||||
m_sequential_view.marker.set_world_position(m_sequential_view.current_position + m_sequential_view_marker_z_offset * Vec3f::UnitZ());
|
||||
m_sequential_view.marker.render();
|
||||
render_shells();
|
||||
render_legend();
|
||||
|
|
|
@ -211,6 +211,7 @@ public:
|
|||
{
|
||||
GL_Model m_model;
|
||||
Transform3f m_world_transform;
|
||||
BoundingBoxf3 m_world_bounding_box;
|
||||
std::array<float, 4> m_color{ 1.0f, 1.0f, 1.0f, 1.0f };
|
||||
bool m_visible{ false };
|
||||
#if !ENABLE_SHADERS_MANAGER
|
||||
|
@ -220,9 +221,9 @@ public:
|
|||
public:
|
||||
void init();
|
||||
|
||||
const BoundingBoxf3& get_bounding_box() const { return m_model.get_bounding_box(); }
|
||||
const BoundingBoxf3& get_bounding_box() const { return m_world_bounding_box; }
|
||||
|
||||
void set_world_transform(const Transform3f& transform) { m_world_transform = transform; }
|
||||
void set_world_position(const Vec3f& position);
|
||||
void set_color(const std::array<float, 4>& color) { m_color = color; }
|
||||
|
||||
bool is_visible() const { return m_visible; }
|
||||
|
@ -273,6 +274,7 @@ private:
|
|||
std::vector<unsigned char> m_extruder_ids;
|
||||
mutable Extrusions m_extrusions;
|
||||
mutable SequentialView m_sequential_view;
|
||||
float m_sequential_view_marker_z_offset{ 0.5f };
|
||||
Shells m_shells;
|
||||
EViewType m_view_type{ EViewType::FeatureType };
|
||||
bool m_legend_enabled{ true };
|
||||
|
|
Loading…
Add table
Reference in a new issue