Grabbers and support points appearence tweaking, some refactoring
This commit is contained in:
parent
846afdf7f3
commit
2e24e689fa
@ -1,11 +1,12 @@
|
|||||||
#version 110
|
#version 110
|
||||||
|
|
||||||
uniform vec4 uniform_color;
|
uniform vec4 uniform_color;
|
||||||
|
uniform float emission_factor;
|
||||||
|
|
||||||
// x = tainted, y = specular;
|
// x = tainted, y = specular;
|
||||||
varying vec2 intensity;
|
varying vec2 intensity;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_FragColor = vec4(vec3(intensity.y, intensity.y, intensity.y) + uniform_color.rgb * intensity.x, uniform_color.a);
|
gl_FragColor = vec4(vec3(intensity.y) + uniform_color.rgb * (intensity.x + emission_factor), uniform_color.a);
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,7 @@ GLGizmoBase::Grabber::Grabber()
|
|||||||
, dragging(false)
|
, dragging(false)
|
||||||
, enabled(true)
|
, enabled(true)
|
||||||
{
|
{
|
||||||
color[0] = 1.0f;
|
color = { 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
color[1] = 1.0f;
|
|
||||||
color[2] = 1.0f;
|
|
||||||
color[3] = 1.0f;
|
|
||||||
TriangleMesh cube = make_cube(1., 1., 1.);
|
TriangleMesh cube = make_cube(1., 1., 1.);
|
||||||
cube.translate(Vec3f(-0.5, -0.5, -0.5));
|
cube.translate(Vec3f(-0.5, -0.5, -0.5));
|
||||||
VBOCube.init_from(cube);
|
VBOCube.init_from(cube);
|
||||||
@ -35,18 +32,18 @@ GLGizmoBase::Grabber::Grabber()
|
|||||||
|
|
||||||
void GLGizmoBase::Grabber::render(bool hover, float size) const
|
void GLGizmoBase::Grabber::render(bool hover, float size) const
|
||||||
{
|
{
|
||||||
float render_color[4];
|
std::array<float, 4> render_color;
|
||||||
if (hover)
|
if (hover)
|
||||||
{
|
{
|
||||||
render_color[0] = 1.0f - color[0];
|
render_color[0] = (1.0f - color[0]);
|
||||||
render_color[1] = 1.0f - color[1];
|
render_color[1] = (1.0f - color[1]);
|
||||||
render_color[2] = 1.0f - color[2];
|
render_color[2] = (1.0f - color[2]);
|
||||||
render_color[3] = color[3];
|
render_color[3] = color[3];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
::memcpy((void*)render_color, (const void*)color, 4 * sizeof(float));
|
render_color = color;
|
||||||
|
|
||||||
render(size, render_color, true);
|
render(size, render_color, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GLGizmoBase::Grabber::get_half_size(float size) const
|
float GLGizmoBase::Grabber::get_half_size(float size) const
|
||||||
@ -59,14 +56,18 @@ float GLGizmoBase::Grabber::get_dragging_half_size(float size) const
|
|||||||
return get_half_size(size) * DraggingScaleFactor;
|
return get_half_size(size) * DraggingScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoBase::Grabber::render(float size, const float* render_color, bool use_lighting) const
|
void GLGizmoBase::Grabber::render(float size, const std::array<float, 4>& render_color, bool picking) const
|
||||||
{
|
{
|
||||||
float fullsize = 2 * (dragging ? get_dragging_half_size(size) : get_half_size(size));
|
float fullsize = 2 * (dragging ? get_dragging_half_size(size) : get_half_size(size));
|
||||||
|
|
||||||
if (use_lighting)
|
if (! picking)
|
||||||
glsafe(::glEnable(GL_LIGHTING));
|
glsafe(::glEnable(GL_LIGHTING));
|
||||||
|
|
||||||
glsafe(::glColor4fv(render_color));
|
GLShaderProgram* shader = picking ? nullptr : wxGetApp().get_current_shader();
|
||||||
|
if (shader)
|
||||||
|
shader->set_uniform("uniform_color", render_color);
|
||||||
|
else
|
||||||
|
glsafe(::glColor4fv(render_color.data())); // picking
|
||||||
|
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
glsafe(::glTranslated(center(0), center(1), center(2)));
|
glsafe(::glTranslated(center(0), center(1), center(2)));
|
||||||
@ -77,7 +78,7 @@ void GLGizmoBase::Grabber::render(float size, const float* render_color, bool us
|
|||||||
VBOCube.render();
|
VBOCube.render();
|
||||||
glsafe(::glPopMatrix());
|
glsafe(::glPopMatrix());
|
||||||
|
|
||||||
if (use_lighting)
|
if (! picking)
|
||||||
glsafe(::glDisable(GL_LIGHTING));
|
glsafe(::glDisable(GL_LIGHTING));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,11 +189,18 @@ void GLGizmoBase::render_grabbers(const BoundingBoxf3& box) const
|
|||||||
|
|
||||||
void GLGizmoBase::render_grabbers(float size) const
|
void GLGizmoBase::render_grabbers(float size) const
|
||||||
{
|
{
|
||||||
|
GLShaderProgram* shader = wxGetApp().get_shader("gouraud_light");
|
||||||
|
if (! shader)
|
||||||
|
return;
|
||||||
|
shader->start_using();
|
||||||
|
shader->set_uniform("emission_factor", 0.1);
|
||||||
for (int i = 0; i < (int)m_grabbers.size(); ++i)
|
for (int i = 0; i < (int)m_grabbers.size(); ++i)
|
||||||
{
|
{
|
||||||
if (m_grabbers[i].enabled)
|
if (m_grabbers[i].enabled)
|
||||||
m_grabbers[i].render((m_hover_id == i), size);
|
m_grabbers[i].render((m_hover_id == i), size);
|
||||||
}
|
}
|
||||||
|
shader->set_uniform("emission_factor", 0.);
|
||||||
|
shader->stop_using();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
|
void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
|
||||||
@ -204,10 +212,7 @@ void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
|
|||||||
if (m_grabbers[i].enabled)
|
if (m_grabbers[i].enabled)
|
||||||
{
|
{
|
||||||
std::array<float, 4> color = picking_color_component(i);
|
std::array<float, 4> color = picking_color_component(i);
|
||||||
m_grabbers[i].color[0] = color[0];
|
m_grabbers[i].color = color;
|
||||||
m_grabbers[i].color[1] = color[1];
|
|
||||||
m_grabbers[i].color[2] = color[2];
|
|
||||||
m_grabbers[i].color[3] = color[3];
|
|
||||||
m_grabbers[i].render_for_picking(mean_size);
|
m_grabbers[i].render_for_picking(mean_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,6 @@
|
|||||||
#include <cereal/archives/binary.hpp>
|
#include <cereal/archives/binary.hpp>
|
||||||
|
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
class GLUquadric;
|
|
||||||
typedef class GLUquadric GLUquadricObj;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
@ -53,20 +50,20 @@ protected:
|
|||||||
|
|
||||||
Vec3d center;
|
Vec3d center;
|
||||||
Vec3d angles;
|
Vec3d angles;
|
||||||
float color[4];
|
std::array<float, 4> color;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool dragging;
|
bool dragging;
|
||||||
|
|
||||||
Grabber();
|
Grabber();
|
||||||
|
|
||||||
void render(bool hover, float size) const;
|
void render(bool hover, float size) const;
|
||||||
void render_for_picking(float size) const { render(size, color, false); }
|
void render_for_picking(float size) const { render(size, color, true); }
|
||||||
|
|
||||||
float get_half_size(float size) const;
|
float get_half_size(float size) const;
|
||||||
float get_dragging_half_size(float size) const;
|
float get_dragging_half_size(float size) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void render(float size, const float* render_color, bool use_lighting) const;
|
void render(float size, const std::array<float, 4>& render_color, bool picking) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -133,7 +133,7 @@ void GLGizmoCut::on_render() const
|
|||||||
::glVertex3dv(m_grabbers[0].center.data());
|
::glVertex3dv(m_grabbers[0].center.data());
|
||||||
glsafe(::glEnd());
|
glsafe(::glEnd());
|
||||||
|
|
||||||
std::copy(std::begin(GrabberColor), std::end(GrabberColor), m_grabbers[0].color);
|
m_grabbers[0].color = GrabberColor;
|
||||||
m_grabbers[0].render(m_hover_id == 0, (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0));
|
m_grabbers[0].render(m_hover_id == 0, (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,15 +100,15 @@ void GLGizmoMove3D::on_render() const
|
|||||||
|
|
||||||
// x axis
|
// x axis
|
||||||
m_grabbers[0].center = Vec3d(box.max(0) + Offset, center(1), center(2));
|
m_grabbers[0].center = Vec3d(box.max(0) + Offset, center(1), center(2));
|
||||||
::memcpy((void*)m_grabbers[0].color, (const void*)&AXES_COLOR[0], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[0].color.data(), (const void*)&AXES_COLOR[0], 4 * sizeof(float));
|
||||||
|
|
||||||
// y axis
|
// y axis
|
||||||
m_grabbers[1].center = Vec3d(center(0), box.max(1) + Offset, center(2));
|
m_grabbers[1].center = Vec3d(center(0), box.max(1) + Offset, center(2));
|
||||||
::memcpy((void*)m_grabbers[1].color, (const void*)&AXES_COLOR[1], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[1].color.data(), (const void*)&AXES_COLOR[1], 4 * sizeof(float));
|
||||||
|
|
||||||
// z axis
|
// z axis
|
||||||
m_grabbers[2].center = Vec3d(center(0), center(1), box.max(2) + Offset);
|
m_grabbers[2].center = Vec3d(center(0), center(1), box.max(2) + Offset);
|
||||||
::memcpy((void*)m_grabbers[2].color, (const void*)&AXES_COLOR[2], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[2].color.data(), (const void*)&AXES_COLOR[2], 4 * sizeof(float));
|
||||||
|
|
||||||
glsafe(::glLineWidth((m_hover_id != -1) ? 2.0f : 1.5f));
|
glsafe(::glLineWidth((m_hover_id != -1) ? 2.0f : 1.5f));
|
||||||
|
|
||||||
@ -194,8 +194,7 @@ void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box
|
|||||||
float mean_size = (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0);
|
float mean_size = (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0);
|
||||||
double size = m_dragging ? (double)m_grabbers[axis].get_dragging_half_size(mean_size) : (double)m_grabbers[axis].get_half_size(mean_size);
|
double size = m_dragging ? (double)m_grabbers[axis].get_dragging_half_size(mean_size) : (double)m_grabbers[axis].get_half_size(mean_size);
|
||||||
|
|
||||||
float color[4];
|
std::array<float, 4> color = m_grabbers[axis].color;
|
||||||
::memcpy((void*)color, (const void*)m_grabbers[axis].color, 4 * sizeof(float));
|
|
||||||
if (!picking && (m_hover_id != -1))
|
if (!picking && (m_hover_id != -1))
|
||||||
{
|
{
|
||||||
color[0] = 1.0f - color[0];
|
color[0] = 1.0f - color[0];
|
||||||
@ -207,7 +206,7 @@ void GLGizmoMove3D::render_grabber_extension(Axis axis, const BoundingBoxf3& box
|
|||||||
if (!picking)
|
if (!picking)
|
||||||
glsafe(::glEnable(GL_LIGHTING));
|
glsafe(::glEnable(GL_LIGHTING));
|
||||||
|
|
||||||
glsafe(::glColor4fv(color));
|
glsafe(::glColor4fv(color.data()));
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
glsafe(::glTranslated(m_grabbers[axis].center(0), m_grabbers[axis].center(1), m_grabbers[axis].center(2)));
|
glsafe(::glTranslated(m_grabbers[axis].center(0), m_grabbers[axis].center(1), m_grabbers[axis].center(2)));
|
||||||
if (axis == X)
|
if (axis == X)
|
||||||
|
@ -318,7 +318,7 @@ void GLGizmoRotate::render_grabber(const BoundingBoxf3& box) const
|
|||||||
::glVertex3dv(m_grabbers[0].center.data());
|
::glVertex3dv(m_grabbers[0].center.data());
|
||||||
glsafe(::glEnd());
|
glsafe(::glEnd());
|
||||||
|
|
||||||
::memcpy((void*)m_grabbers[0].color, (const void*)m_highlight_color, 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[0].color.data(), (const void*)m_highlight_color, 4 * sizeof(float));
|
||||||
render_grabbers(box);
|
render_grabbers(box);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,8 +327,7 @@ void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool pick
|
|||||||
float mean_size = (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0);
|
float mean_size = (float)((box.size()(0) + box.size()(1) + box.size()(2)) / 3.0);
|
||||||
double size = m_dragging ? (double)m_grabbers[0].get_dragging_half_size(mean_size) : (double)m_grabbers[0].get_half_size(mean_size);
|
double size = m_dragging ? (double)m_grabbers[0].get_dragging_half_size(mean_size) : (double)m_grabbers[0].get_half_size(mean_size);
|
||||||
|
|
||||||
float color[4];
|
std::array<float, 4> color = m_grabbers[0].color;
|
||||||
::memcpy((void*)color, (const void*)m_grabbers[0].color, 4 * sizeof(float));
|
|
||||||
if (!picking && (m_hover_id != -1))
|
if (!picking && (m_hover_id != -1))
|
||||||
{
|
{
|
||||||
color[0] = 1.0f - color[0];
|
color[0] = 1.0f - color[0];
|
||||||
@ -339,7 +338,7 @@ void GLGizmoRotate::render_grabber_extension(const BoundingBoxf3& box, bool pick
|
|||||||
if (!picking)
|
if (!picking)
|
||||||
glsafe(::glEnable(GL_LIGHTING));
|
glsafe(::glEnable(GL_LIGHTING));
|
||||||
|
|
||||||
glsafe(::glColor4fv(color));
|
glsafe(::glColor4fv(color.data()));
|
||||||
glsafe(::glPushMatrix());
|
glsafe(::glPushMatrix());
|
||||||
glsafe(::glTranslated(m_grabbers[0].center(0), m_grabbers[0].center(1), m_grabbers[0].center(2)));
|
glsafe(::glTranslated(m_grabbers[0].center(0), m_grabbers[0].center(1), m_grabbers[0].center(2)));
|
||||||
glsafe(::glRotated(Geometry::rad2deg(m_angle), 0.0, 0.0, 1.0));
|
glsafe(::glRotated(Geometry::rad2deg(m_angle), 0.0, 0.0, 1.0));
|
||||||
|
@ -173,20 +173,20 @@ void GLGizmoScale3D::on_render() const
|
|||||||
// x axis
|
// x axis
|
||||||
m_grabbers[0].center = m_transform * Vec3d(m_box.min(0), center(1), center(2)) - offset_x;
|
m_grabbers[0].center = m_transform * Vec3d(m_box.min(0), center(1), center(2)) - offset_x;
|
||||||
m_grabbers[1].center = m_transform * Vec3d(m_box.max(0), center(1), center(2)) + offset_x;
|
m_grabbers[1].center = m_transform * Vec3d(m_box.max(0), center(1), center(2)) + offset_x;
|
||||||
::memcpy((void*)m_grabbers[0].color, (ctrl_down && (m_hover_id == 1)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[0], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[0].color.data(), (ctrl_down && (m_hover_id == 1)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[0], 4 * sizeof(float));
|
||||||
::memcpy((void*)m_grabbers[1].color, (ctrl_down && (m_hover_id == 0)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[0], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[1].color.data(), (ctrl_down && (m_hover_id == 0)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[0], 4 * sizeof(float));
|
||||||
|
|
||||||
// y axis
|
// y axis
|
||||||
m_grabbers[2].center = m_transform * Vec3d(center(0), m_box.min(1), center(2)) - offset_y;
|
m_grabbers[2].center = m_transform * Vec3d(center(0), m_box.min(1), center(2)) - offset_y;
|
||||||
m_grabbers[3].center = m_transform * Vec3d(center(0), m_box.max(1), center(2)) + offset_y;
|
m_grabbers[3].center = m_transform * Vec3d(center(0), m_box.max(1), center(2)) + offset_y;
|
||||||
::memcpy((void*)m_grabbers[2].color, (ctrl_down && (m_hover_id == 3)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[1], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[2].color.data(), (ctrl_down && (m_hover_id == 3)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[1], 4 * sizeof(float));
|
||||||
::memcpy((void*)m_grabbers[3].color, (ctrl_down && (m_hover_id == 2)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[1], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[3].color.data(), (ctrl_down && (m_hover_id == 2)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[1], 4 * sizeof(float));
|
||||||
|
|
||||||
// z axis
|
// z axis
|
||||||
m_grabbers[4].center = m_transform * Vec3d(center(0), center(1), m_box.min(2)) - offset_z;
|
m_grabbers[4].center = m_transform * Vec3d(center(0), center(1), m_box.min(2)) - offset_z;
|
||||||
m_grabbers[5].center = m_transform * Vec3d(center(0), center(1), m_box.max(2)) + offset_z;
|
m_grabbers[5].center = m_transform * Vec3d(center(0), center(1), m_box.max(2)) + offset_z;
|
||||||
::memcpy((void*)m_grabbers[4].color, (ctrl_down && (m_hover_id == 5)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[2], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[4].color.data(), (ctrl_down && (m_hover_id == 5)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[2], 4 * sizeof(float));
|
||||||
::memcpy((void*)m_grabbers[5].color, (ctrl_down && (m_hover_id == 4)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[2], 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[5].color.data(), (ctrl_down && (m_hover_id == 4)) ? (const void*)CONSTRAINED_COLOR : (const void*)&AXES_COLOR[2], 4 * sizeof(float));
|
||||||
|
|
||||||
// uniform
|
// uniform
|
||||||
m_grabbers[6].center = m_transform * Vec3d(m_box.min(0), m_box.min(1), center(2)) - offset_x - offset_y;
|
m_grabbers[6].center = m_transform * Vec3d(m_box.min(0), m_box.min(1), center(2)) - offset_x - offset_y;
|
||||||
@ -195,7 +195,7 @@ void GLGizmoScale3D::on_render() const
|
|||||||
m_grabbers[9].center = m_transform * Vec3d(m_box.min(0), m_box.max(1), center(2)) - offset_x + offset_y;
|
m_grabbers[9].center = m_transform * Vec3d(m_box.min(0), m_box.max(1), center(2)) - offset_x + offset_y;
|
||||||
for (int i = 6; i < 10; ++i)
|
for (int i = 6; i < 10; ++i)
|
||||||
{
|
{
|
||||||
::memcpy((void*)m_grabbers[i].color, (const void*)m_highlight_color, 4 * sizeof(float));
|
::memcpy((void*)m_grabbers[i].color.data(), (const void*)m_highlight_color, 4 * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets grabbers orientation
|
// sets grabbers orientation
|
||||||
@ -215,17 +215,17 @@ void GLGizmoScale3D::on_render() const
|
|||||||
// draw connections
|
// draw connections
|
||||||
if (m_grabbers[0].enabled && m_grabbers[1].enabled)
|
if (m_grabbers[0].enabled && m_grabbers[1].enabled)
|
||||||
{
|
{
|
||||||
glsafe(::glColor4fv(m_grabbers[0].color));
|
glsafe(::glColor4fv(m_grabbers[0].color.data()));
|
||||||
render_grabbers_connection(0, 1);
|
render_grabbers_connection(0, 1);
|
||||||
}
|
}
|
||||||
if (m_grabbers[2].enabled && m_grabbers[3].enabled)
|
if (m_grabbers[2].enabled && m_grabbers[3].enabled)
|
||||||
{
|
{
|
||||||
glsafe(::glColor4fv(m_grabbers[2].color));
|
glsafe(::glColor4fv(m_grabbers[2].color.data()));
|
||||||
render_grabbers_connection(2, 3);
|
render_grabbers_connection(2, 3);
|
||||||
}
|
}
|
||||||
if (m_grabbers[4].enabled && m_grabbers[5].enabled)
|
if (m_grabbers[4].enabled && m_grabbers[5].enabled)
|
||||||
{
|
{
|
||||||
glsafe(::glColor4fv(m_grabbers[4].color));
|
glsafe(::glColor4fv(m_grabbers[4].color.data()));
|
||||||
render_grabbers_connection(4, 5);
|
render_grabbers_connection(4, 5);
|
||||||
}
|
}
|
||||||
glsafe(::glColor4fv(m_base_color));
|
glsafe(::glColor4fv(m_base_color));
|
||||||
@ -239,7 +239,7 @@ void GLGizmoScale3D::on_render() const
|
|||||||
else if ((m_hover_id == 0) || (m_hover_id == 1))
|
else if ((m_hover_id == 0) || (m_hover_id == 1))
|
||||||
{
|
{
|
||||||
// draw connection
|
// draw connection
|
||||||
glsafe(::glColor4fv(m_grabbers[0].color));
|
glsafe(::glColor4fv(m_grabbers[0].color.data()));
|
||||||
render_grabbers_connection(0, 1);
|
render_grabbers_connection(0, 1);
|
||||||
// draw grabbers
|
// draw grabbers
|
||||||
m_grabbers[0].render(true, grabber_mean_size);
|
m_grabbers[0].render(true, grabber_mean_size);
|
||||||
@ -248,7 +248,7 @@ void GLGizmoScale3D::on_render() const
|
|||||||
else if ((m_hover_id == 2) || (m_hover_id == 3))
|
else if ((m_hover_id == 2) || (m_hover_id == 3))
|
||||||
{
|
{
|
||||||
// draw connection
|
// draw connection
|
||||||
glsafe(::glColor4fv(m_grabbers[2].color));
|
glsafe(::glColor4fv(m_grabbers[2].color.data()));
|
||||||
render_grabbers_connection(2, 3);
|
render_grabbers_connection(2, 3);
|
||||||
// draw grabbers
|
// draw grabbers
|
||||||
m_grabbers[2].render(true, grabber_mean_size);
|
m_grabbers[2].render(true, grabber_mean_size);
|
||||||
@ -257,7 +257,7 @@ void GLGizmoScale3D::on_render() const
|
|||||||
else if ((m_hover_id == 4) || (m_hover_id == 5))
|
else if ((m_hover_id == 4) || (m_hover_id == 5))
|
||||||
{
|
{
|
||||||
// draw connection
|
// draw connection
|
||||||
glsafe(::glColor4fv(m_grabbers[4].color));
|
glsafe(::glColor4fv(m_grabbers[4].color.data()));
|
||||||
render_grabbers_connection(4, 5);
|
render_grabbers_connection(4, 5);
|
||||||
// draw grabbers
|
// draw grabbers
|
||||||
m_grabbers[4].render(true, grabber_mean_size);
|
m_grabbers[4].render(true, grabber_mean_size);
|
||||||
|
@ -121,7 +121,12 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
|
|||||||
GLShaderProgram* shader = picking ? nullptr : wxGetApp().get_shader("gouraud_light");
|
GLShaderProgram* shader = picking ? nullptr : wxGetApp().get_shader("gouraud_light");
|
||||||
if (shader)
|
if (shader)
|
||||||
shader->start_using();
|
shader->start_using();
|
||||||
ScopeGuard guard([shader]() { if (shader) shader->stop_using(); });
|
ScopeGuard guard([shader]() {
|
||||||
|
if (shader) {
|
||||||
|
shader->set_uniform("emission_factor", 0.);
|
||||||
|
shader->stop_using();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const GLVolume* vol = selection.get_volume(*selection.get_volume_idxs().begin());
|
const GLVolume* vol = selection.get_volume(*selection.get_volume_idxs().begin());
|
||||||
const Transform3d& instance_scaling_matrix_inverse = vol->get_instance_transformation().get_matrix(true, true, false, true).inverse();
|
const Transform3d& instance_scaling_matrix_inverse = vol->get_instance_transformation().get_matrix(true, true, false, true).inverse();
|
||||||
@ -162,8 +167,10 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
|
|||||||
render_color = { 0.5f, 0.5f, 0.5f, 1.f };
|
render_color = { 0.5f, 0.5f, 0.5f, 1.f };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (shader && ! picking)
|
if (shader && ! picking) {
|
||||||
shader->set_uniform("uniform_color", render_color);
|
shader->set_uniform("uniform_color", render_color);
|
||||||
|
shader->set_uniform("emission_factor", 0.5);
|
||||||
|
}
|
||||||
else // picking
|
else // picking
|
||||||
glsafe(::glColor4fv(render_color.data()));
|
glsafe(::glColor4fv(render_color.data()));
|
||||||
|
|
||||||
@ -219,8 +226,10 @@ void GLGizmoSlaSupports::render_points(const Selection& selection, bool picking)
|
|||||||
render_color[1] = 0.7f;
|
render_color[1] = 0.7f;
|
||||||
render_color[2] = 0.7f;
|
render_color[2] = 0.7f;
|
||||||
render_color[3] = 0.7f;
|
render_color[3] = 0.7f;
|
||||||
if (shader)
|
if (shader) {
|
||||||
shader->set_uniform("uniform_color", render_color);
|
shader->set_uniform("uniform_color", render_color);
|
||||||
|
shader->set_uniform("emission_factor", 0.5);
|
||||||
|
}
|
||||||
for (const sla::DrainHole& drain_hole : m_c->selection_info()->model_object()->sla_drain_holes) {
|
for (const sla::DrainHole& drain_hole : m_c->selection_info()->model_object()->sla_drain_holes) {
|
||||||
if (is_mesh_point_clipped(drain_hole.pos.cast<double>()))
|
if (is_mesh_point_clipped(drain_hole.pos.cast<double>()))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user