Work Out the Solid Model's Flat Face Cut-Off From Each Object's Layer Height and Walls

This commit is contained in:
Hanif Koh authored and HanifKoh committed 2026-11-29 03:10:00 +08:00
1 parent dac25fd5b0
commit 5131f4fc8e
7 files changed
+99 -32

No files matched your search

+5 -4
View File
@@ -1131,12 +1131,13 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type,
shader->set_uniform("uniform_color_clip_plane_1", m_color_clip_plane_colors[0]);
shader->set_uniform("uniform_color_clip_plane_2", m_color_clip_plane_colors[1]);
const unsigned int volume_id = volume.second.first;
const bool flat_face_colors = volume_id < m_flat_face_colors.size() &&
(m_flat_face_colors[volume_id][0].has_value() || m_flat_face_colors[volume_id][1].has_value());
const FlatFaces* flat_faces = volume_id < m_flat_faces.size() ? &m_flat_faces[volume_id] : nullptr;
const bool flat_face_colors = flat_faces != nullptr && (flat_faces->colors[0].has_value() || flat_faces->colors[1].has_value());
shader->set_uniform("use_flat_face_colors", flat_face_colors);
if (flat_face_colors) {
shader->set_uniform("up_face_color", m_flat_face_colors[volume_id][0].value_or(volume.first->render_color));
shader->set_uniform("down_face_color", m_flat_face_colors[volume_id][1].value_or(volume.first->render_color));
shader->set_uniform("up_face_color", flat_faces->colors[0].value_or(volume.first->render_color));
shader->set_uniform("down_face_color", flat_faces->colors[1].value_or(volume.first->render_color));
shader->set_uniform("flat_face_normal_z", flat_faces->normal_z);
}
//BOOST_LOG_TRIVIAL(info) << boost::format("set uniform_color to {%1%, %2%, %3%, %4%}, with_outline=%5%, selected %6%")
// %volume.first->render_color[0]%volume.first->render_color[1]%volume.first->render_color[2]%volume.first->render_color[3]