mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
Tech ENABLE_SEQUENTIAL_LIMITS -> 1st installment of visualization of objects clearance for sequential prints
This commit is contained in:
parent
9537c4e8d0
commit
75677ba810
14 changed files with 889 additions and 87 deletions
|
@ -98,12 +98,6 @@ const float Bed3D::Axes::DefaultStemLength = 25.0f;
|
|||
const float Bed3D::Axes::DefaultTipRadius = 2.5f * Bed3D::Axes::DefaultStemRadius;
|
||||
const float Bed3D::Axes::DefaultTipLength = 5.0f;
|
||||
|
||||
void Bed3D::Axes::set_stem_length(float length)
|
||||
{
|
||||
m_stem_length = length;
|
||||
m_arrow.reset();
|
||||
}
|
||||
|
||||
void Bed3D::Axes::render() const
|
||||
{
|
||||
auto render_axis = [this](const Transform3f& transform) {
|
||||
|
@ -113,7 +107,10 @@ void Bed3D::Axes::render() const
|
|||
glsafe(::glPopMatrix());
|
||||
};
|
||||
|
||||
const_cast<GLModel*>(&m_arrow)->init_from(stilized_arrow(16, DefaultTipRadius, DefaultTipLength, DefaultStemRadius, m_stem_length));
|
||||
#if ENABLE_SEQUENTIAL_LIMITS
|
||||
if (!m_arrow.is_initialized())
|
||||
#endif // ENABLE_SEQUENTIAL_LIMITS
|
||||
const_cast<GLModel*>(&m_arrow)->init_from(stilized_arrow(16, DefaultTipRadius, DefaultTipLength, DefaultStemRadius, m_stem_length));
|
||||
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
|
||||
if (shader == nullptr)
|
||||
|
@ -124,18 +121,30 @@ void Bed3D::Axes::render() const
|
|||
shader->start_using();
|
||||
|
||||
// x axis
|
||||
#if ENABLE_SEQUENTIAL_LIMITS
|
||||
const_cast<GLModel*>(&m_arrow)->set_color(-1, { 0.75f, 0.0f, 0.0f, 1.0f });
|
||||
#else
|
||||
std::array<float, 4> color = { 0.75f, 0.0f, 0.0f, 1.0f };
|
||||
shader->set_uniform("uniform_color", color);
|
||||
render_axis(Geometry::assemble_transform(m_origin, { 0.0, 0.5 * M_PI, 0.0f }).cast<float>());
|
||||
#endif // ENABLE_SEQUENTIAL_LIMITS
|
||||
render_axis(Geometry::assemble_transform(m_origin, { 0.0, 0.5 * M_PI, 0.0 }).cast<float>());
|
||||
|
||||
// y axis
|
||||
#if ENABLE_SEQUENTIAL_LIMITS
|
||||
const_cast<GLModel*>(&m_arrow)->set_color(-1, { 0.0f, 0.75f, 0.0f, 1.0f });
|
||||
#else
|
||||
color = { 0.0f, 0.75f, 0.0f, 1.0f };
|
||||
shader->set_uniform("uniform_color", color);
|
||||
render_axis(Geometry::assemble_transform(m_origin, { -0.5 * M_PI, 0.0, 0.0f }).cast<float>());
|
||||
#endif // ENABLE_SEQUENTIAL_LIMITS
|
||||
render_axis(Geometry::assemble_transform(m_origin, { -0.5 * M_PI, 0.0, 0.0 }).cast<float>());
|
||||
|
||||
// z axis
|
||||
#if ENABLE_SEQUENTIAL_LIMITS
|
||||
const_cast<GLModel*>(&m_arrow)->set_color(-1, { 0.0f, 0.0f, 0.75f, 1.0f });
|
||||
#else
|
||||
color = { 0.0f, 0.0f, 0.75f, 1.0f };
|
||||
shader->set_uniform("uniform_color", color);
|
||||
#endif // ENABLE_SEQUENTIAL_LIMITS
|
||||
render_axis(Geometry::assemble_transform(m_origin).cast<float>());
|
||||
|
||||
shader->stop_using();
|
||||
|
@ -475,6 +484,10 @@ void Bed3D::render_model() const
|
|||
GLModel* model = const_cast<GLModel*>(&m_model);
|
||||
|
||||
if (model->get_filename() != m_model_filename && model->init_from_file(m_model_filename)) {
|
||||
#if ENABLE_SEQUENTIAL_LIMITS
|
||||
model->set_color(-1, m_model_color);
|
||||
#endif // ENABLE_SEQUENTIAL_LIMITS
|
||||
|
||||
// move the model so that its origin (0.0, 0.0, 0.0) goes into the bed shape center and a bit down to avoid z-fighting with the texture quad
|
||||
Vec3d shift = m_bounding_box.center();
|
||||
shift(2) = -0.03;
|
||||
|
@ -488,7 +501,9 @@ void Bed3D::render_model() const
|
|||
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if !ENABLE_SEQUENTIAL_LIMITS
|
||||
shader->set_uniform("uniform_color", m_model_color);
|
||||
#endif // !ENABLE_SEQUENTIAL_LIMITS
|
||||
::glPushMatrix();
|
||||
::glTranslated(m_model_offset(0), m_model_offset(1), m_model_offset(2));
|
||||
model->render();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue