mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 18:21:18 -06:00
parent
30d2c3787f
commit
9d29eddf16
11 changed files with 61 additions and 43 deletions
|
|
@ -53,9 +53,9 @@ void GLGizmoBase::Grabber::render(float size, const std::array<float, 4>& render
|
|||
if (! cube_initialized) {
|
||||
// This cannot be done in constructor, OpenGL is not yet
|
||||
// initialized at that point (on Linux at least).
|
||||
TriangleMesh mesh = make_cube(1., 1., 1.);
|
||||
mesh.translate(Vec3f(-0.5, -0.5, -0.5));
|
||||
const_cast<GLModel&>(cube).init_from(mesh);
|
||||
indexed_triangle_set mesh = its_make_cube(1., 1., 1.);
|
||||
its_translate(mesh, Vec3f(-0.5, -0.5, -0.5));
|
||||
const_cast<GLModel&>(cube).init_from(mesh, BoundingBoxf3{ { -0.5, -0.5, -0.5 }, { 0.5, 0.5, 0.5 } });
|
||||
const_cast<bool&>(cube_initialized) = true;
|
||||
}
|
||||
|
||||
|
|
@ -90,9 +90,9 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, u
|
|||
m_base_color = DEFAULT_BASE_COLOR;
|
||||
m_drag_color = DEFAULT_DRAG_COLOR;
|
||||
m_highlight_color = DEFAULT_HIGHLIGHT_COLOR;
|
||||
m_cone.init_from(make_cone(1., 1., 2 * PI / 24));
|
||||
m_sphere.init_from(make_sphere(1., (2 * M_PI) / 24.));
|
||||
m_cylinder.init_from(make_cylinder(1., 1., 2 * PI / 24.));
|
||||
m_cone.init_from(its_make_cone(1., 1., 2 * PI / 24));
|
||||
m_sphere.init_from(its_make_sphere(1., (2 * M_PI) / 24.));
|
||||
m_cylinder.init_from(its_make_cylinder(1., 1., 2 * PI / 24.));
|
||||
}
|
||||
|
||||
void GLGizmoBase::set_hover_id(int id)
|
||||
|
|
|
|||
|
|
@ -287,16 +287,14 @@ void GLGizmoFdmSupports::select_facets_by_angle(float threshold_deg, bool block)
|
|||
float dot_limit = limit.dot(down);
|
||||
|
||||
// Now calculate dot product of vert_direction and facets' normals.
|
||||
int idx = -1;
|
||||
int idx = 0;
|
||||
const indexed_triangle_set &its = mv->mesh().its;
|
||||
for (stl_triangle_vertex_indices face : its.indices) {
|
||||
stl_vertex vertex[3] = { its.vertices[face[0]], its.vertices[face[1]], its.vertices[face[2]] };
|
||||
stl_vertex n = (vertex[2] - vertex[1]).cross(vertex[3] - vertex[2]).normalized();
|
||||
++ idx;
|
||||
if (n.dot(down) > dot_limit) {
|
||||
if (its_face_normal(its, face).dot(down) > dot_limit) {
|
||||
m_triangle_selectors[mesh_id]->set_facet(idx, block ? EnforcerBlockerType::BLOCKER : EnforcerBlockerType::ENFORCER);
|
||||
m_triangle_selectors.back()->request_update_render_data();
|
||||
}
|
||||
++ idx;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace GUI {
|
|||
GLGizmoHollow::GLGizmoHollow(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
|
||||
: GLGizmoBase(parent, icon_filename, sprite_id)
|
||||
{
|
||||
m_vbo_cylinder.init_from(make_cylinder(1., 1.));
|
||||
m_vbo_cylinder.init_from(its_make_cylinder(1., 1.));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ GLGizmoMove3D::GLGizmoMove3D(GLCanvas3D& parent, const std::string& icon_filenam
|
|||
, m_starting_box_center(Vec3d::Zero())
|
||||
, m_starting_box_bottom_center(Vec3d::Zero())
|
||||
{
|
||||
m_vbo_cone.init_from(make_cone(1., 1., 2*PI/36));
|
||||
m_vbo_cone.init_from(its_make_cone(1., 1., 2*PI/36));
|
||||
}
|
||||
|
||||
std::string GLGizmoMove3D::get_tooltip() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue