mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 14:13:57 -06:00
Tech ENABLE_GLBEGIN_GLEND_REMOVAL - Various Gizmos updates and fixes
prusa3d/PrusaSlicer@35dd03e8cb prusa3d/PrusaSlicer@bcaa0d38bd prusa3d/PrusaSlicer@2673994471 prusa3d/PrusaSlicer@0e3a3aa522 prusa3d/PrusaSlicer@08a2711034 prusa3d/PrusaSlicer@f6f95808cc prusa3d/PrusaSlicer@81edc7d752 prusa3d/PrusaSlicer@0b6e2b4aec prusa3d/PrusaSlicer@71f08841f9
This commit is contained in:
parent
f6a3421e2a
commit
7e04448b7a
23 changed files with 742 additions and 449 deletions
|
@ -69,7 +69,7 @@ namespace GUI {
|
|||
m_state = Off;
|
||||
}
|
||||
|
||||
void GLSelectionRectangle::render(const GLCanvas3D& canvas) const
|
||||
void GLSelectionRectangle::render(const GLCanvas3D& canvas)
|
||||
{
|
||||
if (!is_dragging())
|
||||
return;
|
||||
|
@ -92,11 +92,6 @@ namespace GUI {
|
|||
float bottom = (float)std::min(start(1), end(1)) * inv_zoom;
|
||||
|
||||
glsafe(::glLineWidth(1.5f));
|
||||
float color[3];
|
||||
color[0] = 0.00f;
|
||||
color[1] = 1.00f;
|
||||
color[2] = 0.38f;
|
||||
glsafe(::glColor3fv(color));
|
||||
|
||||
glsafe(::glDisable(GL_DEPTH_TEST));
|
||||
|
||||
|
@ -112,12 +107,46 @@ namespace GUI {
|
|||
glsafe(::glLineStipple(4, 0xAAAA));
|
||||
glsafe(::glEnable(GL_LINE_STIPPLE));
|
||||
|
||||
::glBegin(GL_LINE_LOOP);
|
||||
::glVertex2f((GLfloat)left, (GLfloat)bottom);
|
||||
::glVertex2f((GLfloat)right, (GLfloat)bottom);
|
||||
::glVertex2f((GLfloat)right, (GLfloat)top);
|
||||
::glVertex2f((GLfloat)left, (GLfloat)top);
|
||||
glsafe(::glEnd());
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
|
||||
if (!m_rectangle.is_initialized() || !m_old_start_corner.isApprox(m_start_corner) || !m_old_end_corner.isApprox(m_end_corner)) {
|
||||
m_old_start_corner = m_start_corner;
|
||||
m_old_end_corner = m_end_corner;
|
||||
m_rectangle.reset();
|
||||
|
||||
GLModel::InitializationData init_data;
|
||||
GLModel::InitializationData::Entity entity;
|
||||
entity.type = GLModel::PrimitiveType::LineLoop;
|
||||
entity.positions.reserve(4);
|
||||
entity.positions.emplace_back(left, bottom, 0.0f);
|
||||
entity.positions.emplace_back(right, bottom, 0.0f);
|
||||
entity.positions.emplace_back(right, top, 0.0f);
|
||||
entity.positions.emplace_back(left, top, 0.0f);
|
||||
|
||||
entity.normals.reserve(4);
|
||||
for (size_t j = 0; j < 5; ++j) {
|
||||
entity.normals.emplace_back(Vec3f::UnitZ());
|
||||
}
|
||||
|
||||
entity.indices.reserve(6);
|
||||
entity.indices.emplace_back(0);
|
||||
entity.indices.emplace_back(1);
|
||||
entity.indices.emplace_back(2);
|
||||
entity.indices.emplace_back(2);
|
||||
entity.indices.emplace_back(3);
|
||||
entity.indices.emplace_back(0);
|
||||
|
||||
init_data.entities.emplace_back(entity);
|
||||
m_rectangle.init_from(init_data);
|
||||
}
|
||||
|
||||
ColorRGBA color(0.0f, 1.0f, 0.38f, 1.0f);
|
||||
m_rectangle.set_color(-1, color);
|
||||
m_rectangle.render();
|
||||
shader->stop_using();
|
||||
}
|
||||
|
||||
glsafe(::glPopAttrib());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue