mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 12:47:50 -06:00
Debug: change the rendering order for debug
Change-Id: I09db011ff6e3346d24b9ac86ca107e07d4a7c542 (cherry picked from commit e217689000e33854b945e8925d84efddf178f716)
This commit is contained in:
parent
a1faa927cc
commit
1e8adabd5c
1 changed files with 16 additions and 14 deletions
|
@ -3825,7 +3825,7 @@ void GCodeViewer::render_toolpaths()
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
this
|
this
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
](std::vector<RenderPath>::iterator it_path, std::vector<RenderPath>::iterator it_end, GLShaderProgram& shader, int uniform_color) {
|
](std::vector<RenderPath>::reverse_iterator it_path, std::vector<RenderPath>::reverse_iterator it_end, GLShaderProgram& shader, int uniform_color) {
|
||||||
glsafe(::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE));
|
glsafe(::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE));
|
||||||
glsafe(::glEnable(GL_POINT_SPRITE));
|
glsafe(::glEnable(GL_POINT_SPRITE));
|
||||||
|
|
||||||
|
@ -3852,7 +3852,7 @@ void GCodeViewer::render_toolpaths()
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
this
|
this
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
](std::vector<RenderPath>::iterator it_path, std::vector<RenderPath>::iterator it_end, GLShaderProgram& shader, int uniform_color) {
|
](std::vector<RenderPath>::reverse_iterator it_path, std::vector<RenderPath>::reverse_iterator it_end, GLShaderProgram& shader, int uniform_color) {
|
||||||
for (auto it = it_path; it != it_end && it_path->ibuffer_id == it->ibuffer_id; ++it) {
|
for (auto it = it_path; it != it_end && it_path->ibuffer_id == it->ibuffer_id; ++it) {
|
||||||
const RenderPath& path = *it;
|
const RenderPath& path = *it;
|
||||||
// Some OpenGL drivers crash on empty glMultiDrawElements, see GH #7415.
|
// Some OpenGL drivers crash on empty glMultiDrawElements, see GH #7415.
|
||||||
|
@ -3870,7 +3870,7 @@ void GCodeViewer::render_toolpaths()
|
||||||
#if ENABLE_GCODE_VIEWER_STATISTICS
|
#if ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
this
|
this
|
||||||
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
#endif // ENABLE_GCODE_VIEWER_STATISTICS
|
||||||
](std::vector<RenderPath>::iterator it_path, std::vector<RenderPath>::iterator it_end, GLShaderProgram& shader, int uniform_color) {
|
](std::vector<RenderPath>::reverse_iterator it_path, std::vector<RenderPath>::reverse_iterator it_end, GLShaderProgram& shader, int uniform_color) {
|
||||||
for (auto it = it_path; it != it_end && it_path->ibuffer_id == it->ibuffer_id; ++it) {
|
for (auto it = it_path; it != it_end && it_path->ibuffer_id == it->ibuffer_id; ++it) {
|
||||||
const RenderPath& path = *it;
|
const RenderPath& path = *it;
|
||||||
// Some OpenGL drivers crash on empty glMultiDrawElements, see GH #7415.
|
// Some OpenGL drivers crash on empty glMultiDrawElements, see GH #7415.
|
||||||
|
@ -4000,13 +4000,15 @@ void GCodeViewer::render_toolpaths()
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
int uniform_color = shader->get_uniform_location("uniform_color");
|
int uniform_color = shader->get_uniform_location("uniform_color");
|
||||||
auto it_path = buffer.render_paths.begin();
|
auto it_path = buffer.render_paths.rbegin();
|
||||||
//BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":buffer indices size %1%, render_path size %2% ")%buffer.indices.size() %buffer.render_paths.size();
|
//BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(":buffer indices size %1%, render_path size %2% ")%buffer.indices.size() %buffer.render_paths.size();
|
||||||
for (unsigned int ibuffer_id = 0; ibuffer_id < static_cast<unsigned int>(buffer.indices.size()); ++ibuffer_id) {
|
unsigned int indices_count = static_cast<unsigned int>(buffer.indices.size());
|
||||||
|
for (unsigned int index = 0; index < indices_count; ++index) {
|
||||||
|
unsigned int ibuffer_id = indices_count - index - 1;
|
||||||
const IBuffer& i_buffer = buffer.indices[ibuffer_id];
|
const IBuffer& i_buffer = buffer.indices[ibuffer_id];
|
||||||
// Skip all paths with ibuffer_id < ibuffer_id.
|
// Skip all paths with ibuffer_id < ibuffer_id.
|
||||||
for (; it_path != buffer.render_paths.end() && it_path->ibuffer_id < ibuffer_id; ++ it_path) ;
|
for (; it_path != buffer.render_paths.rend() && it_path->ibuffer_id > ibuffer_id; ++ it_path) ;
|
||||||
if (it_path == buffer.render_paths.end() || it_path->ibuffer_id > ibuffer_id)
|
if (it_path == buffer.render_paths.rend() || it_path->ibuffer_id < ibuffer_id)
|
||||||
// Not found. This shall not happen.
|
// Not found. This shall not happen.
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -4025,16 +4027,16 @@ void GCodeViewer::render_toolpaths()
|
||||||
switch (buffer.render_primitive_type)
|
switch (buffer.render_primitive_type)
|
||||||
{
|
{
|
||||||
case TBuffer::ERenderPrimitiveType::Point: {
|
case TBuffer::ERenderPrimitiveType::Point: {
|
||||||
render_as_points(it_path, buffer.render_paths.end(), *shader, uniform_color);
|
render_as_points(it_path, buffer.render_paths.rend(), *shader, uniform_color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TBuffer::ERenderPrimitiveType::Line: {
|
case TBuffer::ERenderPrimitiveType::Line: {
|
||||||
glsafe(::glLineWidth(static_cast<GLfloat>(line_width(zoom))));
|
glsafe(::glLineWidth(static_cast<GLfloat>(line_width(zoom))));
|
||||||
render_as_lines(it_path, buffer.render_paths.end(), *shader, uniform_color);
|
render_as_lines(it_path, buffer.render_paths.rend(), *shader, uniform_color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TBuffer::ERenderPrimitiveType::Triangle: {
|
case TBuffer::ERenderPrimitiveType::Triangle: {
|
||||||
render_as_triangles(it_path, buffer.render_paths.end(), *shader, uniform_color);
|
render_as_triangles(it_path, buffer.render_paths.rend(), *shader, uniform_color);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: { break; }
|
default: { break; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue