'gouraud' shader modified to allow to draw an object with two different colors in Cut Gizmo
This commit is contained in:
parent
b40473be51
commit
224ee922c5
10 changed files with 89 additions and 24 deletions
|
@ -413,7 +413,7 @@ void GLGizmoCut3D::update_clipper()
|
|||
Vec3d normal = m_cut_normal = end - beg;
|
||||
m_cut_normal.normalize();
|
||||
|
||||
if (!is_looking_forward()) {
|
||||
if (!is_looking_forward() && m_connectors_editing) {
|
||||
end = beg = m_plane_center;
|
||||
beg[Z] = box.center().z() + m_radius;
|
||||
end[Z] = box.center().z() - m_radius;
|
||||
|
@ -438,6 +438,13 @@ void GLGizmoCut3D::update_clipper()
|
|||
|
||||
put_connectors_on_cut_plane(normal, offset);
|
||||
|
||||
std::array<double, 4> data = m_c->object_clipper()->get_clipping_plane(true)->get_data();
|
||||
// we need to invert the normal for the shader to work properly
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
data[i] = -data[i];
|
||||
}
|
||||
m_parent.set_color_clip_plane(data);
|
||||
|
||||
if (m_raycasters.empty())
|
||||
on_register_raycasters_for_picking();
|
||||
else
|
||||
|
@ -901,6 +908,9 @@ std::string GLGizmoCut3D::on_get_name() const
|
|||
void GLGizmoCut3D::on_set_state()
|
||||
{
|
||||
if (m_state == On) {
|
||||
m_parent.set_use_color_clip_plane(true);
|
||||
m_parent.set_color_clip_plane_colors({ ABOVE_GRABBER_COLOR , BELOW_GRABBER_COLOR });
|
||||
|
||||
update_bb();
|
||||
m_connectors_editing = !m_selected.empty();
|
||||
|
||||
|
@ -916,6 +926,7 @@ void GLGizmoCut3D::on_set_state()
|
|||
oc->release();
|
||||
}
|
||||
m_selected.clear();
|
||||
m_parent.set_use_color_clip_plane(false);
|
||||
}
|
||||
force_update_clipper_on_render = m_state == On;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue