Tech ENABLE_WORLD_COORDINATE_SHOW_AXES merged into tech ENABLE_WORLD_COORDINATE
Fixed conflicts during rebase with master
This commit is contained in:
parent
7c86cf84a3
commit
ebb9a4aadb
@ -73,8 +73,6 @@
|
|||||||
#define ENABLE_WORLD_COORDINATE (1 && ENABLE_2_5_0_ALPHA1)
|
#define ENABLE_WORLD_COORDINATE (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
// Enable showing world coordinates of volumes' offset relative to the instance containing them
|
// Enable showing world coordinates of volumes' offset relative to the instance containing them
|
||||||
#define ENABLE_WORLD_COORDINATE_VOLUMES_LOCAL_OFFSET (0 && ENABLE_WORLD_COORDINATE)
|
#define ENABLE_WORLD_COORDINATE_VOLUMES_LOCAL_OFFSET (0 && ENABLE_WORLD_COORDINATE)
|
||||||
// Enable showing the axes of the current reference system when sidebar hints are active
|
|
||||||
#define ENABLE_WORLD_COORDINATE_SHOW_AXES (1 && ENABLE_WORLD_COORDINATE)
|
|
||||||
// Enable alternate implementation of manipulating scale for instances and volumes
|
// Enable alternate implementation of manipulating scale for instances and volumes
|
||||||
#define ENABLE_WORLD_COORDINATE_SCALE_REVISITED (1 && ENABLE_WORLD_COORDINATE)
|
#define ENABLE_WORLD_COORDINATE_SCALE_REVISITED (1 && ENABLE_WORLD_COORDINATE)
|
||||||
// Enable implementation of Geometry::Transformation using matrices only
|
// Enable implementation of Geometry::Transformation using matrices only
|
||||||
|
@ -102,7 +102,7 @@ const float* GeometryBuffer::get_vertices_data() const
|
|||||||
}
|
}
|
||||||
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if !ENABLE_WORLD_COORDINATE
|
||||||
const float Bed3D::Axes::DefaultStemRadius = 0.5f;
|
const float Bed3D::Axes::DefaultStemRadius = 0.5f;
|
||||||
const float Bed3D::Axes::DefaultStemLength = 25.0f;
|
const float Bed3D::Axes::DefaultStemLength = 25.0f;
|
||||||
const float Bed3D::Axes::DefaultTipRadius = 2.5f * Bed3D::Axes::DefaultStemRadius;
|
const float Bed3D::Axes::DefaultTipRadius = 2.5f * Bed3D::Axes::DefaultStemRadius;
|
||||||
@ -180,7 +180,7 @@ void Bed3D::Axes::render()
|
|||||||
|
|
||||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||||
}
|
}
|
||||||
#endif // !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // !ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
bool Bed3D::set_shape(const Pointfs& bed_shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom)
|
bool Bed3D::set_shape(const Pointfs& bed_shape, const double max_print_height, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom)
|
||||||
{
|
{
|
||||||
@ -343,11 +343,11 @@ BoundingBoxf3 Bed3D::calc_extended_bounding_box() const
|
|||||||
out.max.z() = 0.0;
|
out.max.z() = 0.0;
|
||||||
// extend to contain axes
|
// extend to contain axes
|
||||||
out.merge(m_axes.get_origin() + m_axes.get_total_length() * Vec3d::Ones());
|
out.merge(m_axes.get_origin() + m_axes.get_total_length() * Vec3d::Ones());
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
out.merge(out.min + Vec3d(-m_axes.get_tip_radius(), -m_axes.get_tip_radius(), out.max.z()));
|
out.merge(out.min + Vec3d(-m_axes.get_tip_radius(), -m_axes.get_tip_radius(), out.max.z()));
|
||||||
#else
|
#else
|
||||||
out.merge(out.min + Vec3d(-Axes::DefaultTipRadius, -Axes::DefaultTipRadius, out.max.z()));
|
out.merge(out.min + Vec3d(-Axes::DefaultTipRadius, -Axes::DefaultTipRadius, out.max.z()));
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
// extend to contain model, if any
|
// extend to contain model, if any
|
||||||
BoundingBoxf3 model_bb = m_model.get_bounding_box();
|
BoundingBoxf3 model_bb = m_model.get_bounding_box();
|
||||||
if (model_bb.defined) {
|
if (model_bb.defined) {
|
||||||
@ -545,7 +545,7 @@ std::tuple<Bed3D::Type, std::string, std::string> Bed3D::detect_type(const Point
|
|||||||
void Bed3D::render_axes()
|
void Bed3D::render_axes()
|
||||||
{
|
{
|
||||||
if (m_build_volume.valid())
|
if (m_build_volume.valid())
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
m_axes.render(Transform3d::Identity(), 0.25f);
|
m_axes.render(Transform3d::Identity(), 0.25f);
|
||||||
#else
|
#else
|
||||||
@ -553,7 +553,7 @@ void Bed3D::render_axes()
|
|||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
#else
|
#else
|
||||||
m_axes.render();
|
m_axes.render();
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#include "GLTexture.hpp"
|
#include "GLTexture.hpp"
|
||||||
#include "3DScene.hpp"
|
#include "3DScene.hpp"
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#include "CoordAxes.hpp"
|
#include "CoordAxes.hpp"
|
||||||
#else
|
#else
|
||||||
#include "GLModel.hpp"
|
#include "GLModel.hpp"
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
#include "libslic3r/BuildVolume.hpp"
|
#include "libslic3r/BuildVolume.hpp"
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
@ -48,7 +48,7 @@ public:
|
|||||||
|
|
||||||
class Bed3D
|
class Bed3D
|
||||||
{
|
{
|
||||||
#if !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if !ENABLE_WORLD_COORDINATE
|
||||||
class Axes
|
class Axes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -72,7 +72,7 @@ class Bed3D
|
|||||||
float get_total_length() const { return m_stem_length + DefaultTipLength; }
|
float get_total_length() const { return m_stem_length + DefaultTipLength; }
|
||||||
void render();
|
void render();
|
||||||
};
|
};
|
||||||
#endif // !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // !ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class Type : unsigned char
|
enum class Type : unsigned char
|
||||||
@ -113,11 +113,11 @@ private:
|
|||||||
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
unsigned int m_vbo_id{ 0 };
|
unsigned int m_vbo_id{ 0 };
|
||||||
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
CoordAxes m_axes;
|
CoordAxes m_axes;
|
||||||
#else
|
#else
|
||||||
Axes m_axes;
|
Axes m_axes;
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
float m_scale_factor{ 1.0f };
|
float m_scale_factor{ 1.0f };
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
@ -101,4 +101,4 @@ void CoordAxes::render(float emission_factor)
|
|||||||
} // GUI
|
} // GUI
|
||||||
} // Slic3r
|
} // Slic3r
|
||||||
|
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef slic3r_CoordAxes_hpp_
|
#ifndef slic3r_CoordAxes_hpp_
|
||||||
#define slic3r_CoordAxes_hpp_
|
#define slic3r_CoordAxes_hpp_
|
||||||
|
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#include "GLModel.hpp"
|
#include "GLModel.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
@ -59,6 +59,6 @@ public:
|
|||||||
} // GUI
|
} // GUI
|
||||||
} // Slic3r
|
} // Slic3r
|
||||||
|
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
#endif // slic3r_CoordAxes_hpp_
|
#endif // slic3r_CoordAxes_hpp_
|
||||||
|
@ -267,7 +267,11 @@ void GLGizmoMove3D::on_render()
|
|||||||
|
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
|
#if ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
||||||
|
#else
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
|
|
||||||
@ -327,7 +331,11 @@ void GLGizmoMove3D::on_render()
|
|||||||
|
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
#if ENABLE_WORLD_COORDINATE
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix()* base_matrix);
|
||||||
|
#else
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
|
|
||||||
|
@ -357,9 +357,10 @@ void GLGizmoScale3D::on_render()
|
|||||||
else
|
else
|
||||||
m_bounding_box = selection.get_bounding_box();
|
m_bounding_box = selection.get_bounding_box();
|
||||||
|
|
||||||
Vec3d offset_x = offsets_transform * (Offset * Vec3d::UnitX());
|
const Vec3d& center = m_bounding_box.center();
|
||||||
Vec3d offset_y = offsets_transform * (Offset * Vec3d::UnitY());
|
const Vec3d offset_x = offsets_transform * Vec3d((double)Offset, 0.0, 0.0);
|
||||||
Vec3d offset_z = offsets_transform * (Offset * Vec3d::UnitZ());
|
const Vec3d offset_y = offsets_transform * Vec3d(0.0, (double)Offset, 0.0);
|
||||||
|
const Vec3d offset_z = offsets_transform * Vec3d(0.0, 0.0, (double)Offset);
|
||||||
|
|
||||||
bool ctrl_down = m_dragging && m_starting.ctrl_down || !m_dragging && wxGetKeyState(WXK_CONTROL);
|
bool ctrl_down = m_dragging && m_starting.ctrl_down || !m_dragging && wxGetKeyState(WXK_CONTROL);
|
||||||
#endif // ENABLE_WORLD_COORDINATE
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
@ -397,8 +398,6 @@ void GLGizmoScale3D::on_render()
|
|||||||
m_grabbers[9].color = (use_constrain && m_hover_id == 7) ? CONSTRAINED_COLOR : m_highlight_color;
|
m_grabbers[9].color = (use_constrain && m_hover_id == 7) ? CONSTRAINED_COLOR : m_highlight_color;
|
||||||
#else
|
#else
|
||||||
// x axis
|
// x axis
|
||||||
const Vec3d center = m_bounding_box.center();
|
|
||||||
|
|
||||||
m_grabbers[0].center = m_transform * Vec3d(m_bounding_box.min.x(), center.y(), center.z()) - offset_x;
|
m_grabbers[0].center = m_transform * Vec3d(m_bounding_box.min.x(), center.y(), center.z()) - offset_x;
|
||||||
m_grabbers[0].color = (ctrl_down && m_hover_id == 1) ? CONSTRAINED_COLOR : AXES_COLOR[0];
|
m_grabbers[0].color = (ctrl_down && m_hover_id == 1) ? CONSTRAINED_COLOR : AXES_COLOR[0];
|
||||||
m_grabbers[1].center = m_transform * Vec3d(m_bounding_box.max.x(), center.y(), center.z()) + offset_x;
|
m_grabbers[1].center = m_transform * Vec3d(m_bounding_box.max.x(), center.y(), center.z()) + offset_x;
|
||||||
@ -457,7 +456,11 @@ void GLGizmoScale3D::on_render()
|
|||||||
shader->start_using();
|
shader->start_using();
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
|
#if ENABLE_WORLD_COORDINATE
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
||||||
|
#else
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
if (m_grabbers[0].enabled && m_grabbers[1].enabled)
|
if (m_grabbers[0].enabled && m_grabbers[1].enabled)
|
||||||
@ -504,7 +507,11 @@ void GLGizmoScale3D::on_render()
|
|||||||
shader->start_using();
|
shader->start_using();
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
|
#if ENABLE_WORLD_COORDINATE
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
||||||
|
#else
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
render_grabbers_connection(0, 1, m_grabbers[0].color);
|
render_grabbers_connection(0, 1, m_grabbers[0].color);
|
||||||
@ -537,7 +544,11 @@ void GLGizmoScale3D::on_render()
|
|||||||
shader->start_using();
|
shader->start_using();
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
|
#if ENABLE_WORLD_COORDINATE
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
||||||
|
#else
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
render_grabbers_connection(2, 3, m_grabbers[2].color);
|
render_grabbers_connection(2, 3, m_grabbers[2].color);
|
||||||
@ -570,7 +581,11 @@ void GLGizmoScale3D::on_render()
|
|||||||
shader->start_using();
|
shader->start_using();
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
|
#if ENABLE_WORLD_COORDINATE
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
||||||
|
#else
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
render_grabbers_connection(4, 5, m_grabbers[4].color);
|
render_grabbers_connection(4, 5, m_grabbers[4].color);
|
||||||
@ -603,7 +618,11 @@ void GLGizmoScale3D::on_render()
|
|||||||
shader->start_using();
|
shader->start_using();
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
|
#if ENABLE_WORLD_COORDINATE
|
||||||
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * base_matrix);
|
||||||
|
#else
|
||||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||||
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
render_grabbers_connection(6, 7, m_drag_color);
|
render_grabbers_connection(6, 7, m_drag_color);
|
||||||
|
@ -119,12 +119,12 @@ Selection::Selection()
|
|||||||
, m_scale_factor(1.0f)
|
, m_scale_factor(1.0f)
|
||||||
{
|
{
|
||||||
this->set_bounding_boxes_dirty();
|
this->set_bounding_boxes_dirty();
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
m_axes.set_stem_radius(0.15f);
|
m_axes.set_stem_radius(0.15f);
|
||||||
m_axes.set_stem_length(3.0f);
|
m_axes.set_stem_length(3.0f);
|
||||||
m_axes.set_tip_radius(0.45f);
|
m_axes.set_tip_radius(0.45f);
|
||||||
m_axes.set_tip_length(1.5f);
|
m_axes.set_tip_length(1.5f);
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1844,46 +1844,39 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
const Transform3d base_matrix = Geometry::assemble_transform(get_bounding_box().center());
|
const Transform3d base_matrix = Geometry::assemble_transform(get_bounding_box().center());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE
|
||||||
Transform3d orient_matrix = Transform3d::Identity();
|
Transform3d orient_matrix = Transform3d::Identity();
|
||||||
#else
|
#else
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
const Vec3d center = get_bounding_box().center();
|
const Vec3d center = get_bounding_box().center();
|
||||||
Vec3d axes_center = center;
|
Vec3d axes_center = center;
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
if (!boost::starts_with(sidebar_field, "layer")) {
|
if (!boost::starts_with(sidebar_field, "layer")) {
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
shader->set_uniform("emission_factor", 0.05f);
|
shader->set_uniform("emission_factor", 0.05f);
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE
|
||||||
const Vec3d& center = get_bounding_box().center();
|
const Vec3d& center = get_bounding_box().center();
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
if (is_single_full_instance() && !wxGetApp().obj_manipul()->is_world_coordinates()) {
|
if (is_single_full_instance() && !wxGetApp().obj_manipul()->is_world_coordinates()) {
|
||||||
#else
|
#else
|
||||||
if (is_single_full_instance() && !wxGetApp().obj_manipul()->get_world_coordinates()) {
|
if (is_single_full_instance() && !wxGetApp().obj_manipul()->get_world_coordinates()) {
|
||||||
#endif // ENABLE_WORLD_COORDINATE
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE
|
||||||
glsafe(::glTranslated(center.x(), center.y(), center.z()));
|
glsafe(::glTranslated(center.x(), center.y(), center.z()));
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
Transform3d orient_matrix = Transform3d::Identity();
|
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
||||||
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_rotation_matrix();
|
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_rotation_matrix();
|
||||||
#else
|
#else
|
||||||
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
||||||
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
|
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
axes_center = (*m_volumes)[*m_list.begin()]->get_instance_offset();
|
axes_center = (*m_volumes)[*m_list.begin()]->get_instance_offset();
|
||||||
#else
|
|
||||||
glsafe(::glMultMatrixd(orient_matrix.data()));
|
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
#else
|
#else
|
||||||
if (!boost::starts_with(sidebar_field, "position")) {
|
if (!boost::starts_with(sidebar_field, "position")) {
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES
|
#if !ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
@ -1913,14 +1906,11 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
#else
|
#else
|
||||||
else if (is_single_volume() || is_single_modifier()) {
|
else if (is_single_volume() || is_single_modifier()) {
|
||||||
#endif // ENABLE_WORLD_COORDINATE
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE
|
||||||
glsafe(::glTranslated(center.x(), center.y(), center.z()));
|
glsafe(::glTranslated(center.x(), center.y(), center.z()));
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
if (!wxGetApp().obj_manipul()->is_world_coordinates()) {
|
if (!wxGetApp().obj_manipul()->is_world_coordinates()) {
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
Transform3d orient_matrix = Transform3d::Identity();
|
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES && !ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
if (wxGetApp().obj_manipul()->is_local_coordinates()) {
|
if (wxGetApp().obj_manipul()->is_local_coordinates()) {
|
||||||
const GLVolume* v = (*m_volumes)[*m_list.begin()];
|
const GLVolume* v = (*m_volumes)[*m_list.begin()];
|
||||||
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
||||||
@ -1928,9 +1918,7 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
#else
|
#else
|
||||||
orient_matrix = v->get_instance_transformation().get_matrix(true, false, true, true) * v->get_volume_transformation().get_matrix(true, false, true, true);
|
orient_matrix = v->get_instance_transformation().get_matrix(true, false, true, true) * v->get_volume_transformation().get_matrix(true, false, true, true);
|
||||||
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
|
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
axes_center = (*m_volumes)[*m_list.begin()]->world_matrix().translation();
|
axes_center = (*m_volumes)[*m_list.begin()]->world_matrix().translation();
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
||||||
@ -1938,15 +1926,8 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
#else
|
#else
|
||||||
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
||||||
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
|
#endif // ENABLE_TRANSFORMATIONS_BY_MATRICES
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
axes_center = (*m_volumes)[*m_list.begin()]->get_instance_offset();
|
axes_center = (*m_volumes)[*m_list.begin()]->get_instance_offset();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
}
|
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES
|
|
||||||
glsafe(::glMultMatrixd(orient_matrix.data()));
|
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
|
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
@ -1962,7 +1943,7 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
#endif // ENABLE_WORLD_COORDINATE
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE
|
||||||
if (requires_local_axes())
|
if (requires_local_axes())
|
||||||
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
#if ENABLE_TRANSFORMATIONS_BY_MATRICES
|
||||||
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_rotation_matrix();
|
orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_rotation_matrix();
|
||||||
@ -1975,16 +1956,16 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
const Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
const Transform3d orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true);
|
||||||
glsafe(::glMultMatrixd(orient_matrix.data()));
|
glsafe(::glMultMatrixd(orient_matrix.data()));
|
||||||
}
|
}
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES || ENABLE_WORLD_COORDINATE
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (!boost::starts_with(sidebar_field, "layer"))
|
if (!boost::starts_with(sidebar_field, "layer"))
|
||||||
glsafe(::glClear(GL_DEPTH_BUFFER_BIT));
|
glsafe(::glClear(GL_DEPTH_BUFFER_BIT));
|
||||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
if (!boost::starts_with(sidebar_field, "layer")) {
|
if (!boost::starts_with(sidebar_field, "layer")) {
|
||||||
shader->set_uniform("emission_factor", 0.1f);
|
shader->set_uniform("emission_factor", 0.1f);
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES
|
#if !ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
@ -1993,7 +1974,7 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
glsafe(::glMultMatrixd(orient_matrix.data()));
|
glsafe(::glMultMatrixd(orient_matrix.data()));
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
if (boost::starts_with(sidebar_field, "position"))
|
if (boost::starts_with(sidebar_field, "position"))
|
||||||
@ -2004,12 +1985,12 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
render_sidebar_scale_hints(sidebar_field, *shader, base_matrix * orient_matrix);
|
render_sidebar_scale_hints(sidebar_field, *shader, base_matrix * orient_matrix);
|
||||||
else if (boost::starts_with(sidebar_field, "layer"))
|
else if (boost::starts_with(sidebar_field, "layer"))
|
||||||
render_sidebar_layers_hints(sidebar_field, *shader);
|
render_sidebar_layers_hints(sidebar_field, *shader);
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
if (!boost::starts_with(sidebar_field, "layer")) {
|
if (!boost::starts_with(sidebar_field, "layer")) {
|
||||||
if (!wxGetApp().obj_manipul()->is_world_coordinates())
|
if (!wxGetApp().obj_manipul()->is_world_coordinates())
|
||||||
m_axes.render(Geometry::assemble_transform(axes_center) * orient_matrix, 0.25f);
|
m_axes.render(Geometry::assemble_transform(axes_center) * orient_matrix, 0.25f);
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
#else
|
#else
|
||||||
if (boost::starts_with(sidebar_field, "position"))
|
if (boost::starts_with(sidebar_field, "position"))
|
||||||
render_sidebar_position_hints(sidebar_field);
|
render_sidebar_position_hints(sidebar_field);
|
||||||
@ -2020,7 +2001,7 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
else if (boost::starts_with(sidebar_field, "layer"))
|
else if (boost::starts_with(sidebar_field, "layer"))
|
||||||
render_sidebar_layers_hints(sidebar_field);
|
render_sidebar_layers_hints(sidebar_field);
|
||||||
|
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
if (!boost::starts_with(sidebar_field, "layer")) {
|
if (!boost::starts_with(sidebar_field, "layer")) {
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
@ -2030,14 +2011,14 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field)
|
|||||||
m_axes.render(0.25f);
|
m_axes.render(0.25f);
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
}
|
}
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
|
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#if !ENABLE_GL_SHADERS_ATTRIBUTES
|
#if !ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
|
#endif // !ENABLE_GL_SHADERS_ATTRIBUTES
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
#if !ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
if (!boost::starts_with(sidebar_field, "layer"))
|
if (!boost::starts_with(sidebar_field, "layer"))
|
||||||
|
@ -4,13 +4,9 @@
|
|||||||
#include "libslic3r/Geometry.hpp"
|
#include "libslic3r/Geometry.hpp"
|
||||||
#if ENABLE_WORLD_COORDINATE
|
#if ENABLE_WORLD_COORDINATE
|
||||||
#include "GUI_Geometry.hpp"
|
#include "GUI_Geometry.hpp"
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
#include "CoordAxes.hpp"
|
#include "CoordAxes.hpp"
|
||||||
#else
|
#else
|
||||||
#include "GLModel.hpp"
|
#include "GLModel.hpp"
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
|
||||||
#else
|
|
||||||
#include "GLModel.hpp"
|
|
||||||
#endif // ENABLE_WORLD_COORDINATE
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -238,9 +234,9 @@ private:
|
|||||||
GLModel m_vbo_sphere;
|
GLModel m_vbo_sphere;
|
||||||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||||
|
|
||||||
#if ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#if ENABLE_WORLD_COORDINATE
|
||||||
CoordAxes m_axes;
|
CoordAxes m_axes;
|
||||||
#endif // ENABLE_WORLD_COORDINATE_SHOW_AXES
|
#endif // ENABLE_WORLD_COORDINATE
|
||||||
GLModel m_arrow;
|
GLModel m_arrow;
|
||||||
GLModel m_curved_arrow;
|
GLModel m_curved_arrow;
|
||||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||||
|
Loading…
Reference in New Issue
Block a user