mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Fix draw cut line
This commit is contained in:
		
							parent
							
								
									fe78e40cb4
								
							
						
					
					
						commit
						5ce3ec716e
					
				
					 2 changed files with 36 additions and 9 deletions
				
			
		|  | @ -1054,15 +1054,41 @@ void GLGizmoAdvancedCut::render_cut_line() | |||
|     if (!cut_line_processing() || m_cut_line_end == Vec3d::Zero()) | ||||
|         return; | ||||
| 
 | ||||
|     glsafe(::glEnable(GL_DEPTH_TEST)); | ||||
|     glsafe(::glClear(GL_DEPTH_BUFFER_BIT)); | ||||
|     glsafe(::glColor3f(0.0, 1.0, 0.0)); | ||||
|     glEnable(GL_LINE_STIPPLE); | ||||
|     ::glBegin(GL_LINES); | ||||
|     ::glVertex3dv(m_cut_line_begin.data()); | ||||
|     ::glVertex3dv(m_cut_line_end.data()); | ||||
|     glsafe(::glEnd()); | ||||
|     glDisable(GL_LINE_STIPPLE); | ||||
|     glsafe(::glDisable(GL_DEPTH_TEST)); | ||||
| 
 | ||||
|     GLShaderProgram *shader = wxGetApp().get_shader("flat"); | ||||
|     if (shader != nullptr) { | ||||
|         shader->start_using(); | ||||
| 
 | ||||
|         { | ||||
|             m_cut_line.reset(); | ||||
| 
 | ||||
|             GLModel::Geometry init_data; | ||||
|             init_data.format = {GLModel::Geometry::EPrimitiveType::Lines, GLModel::Geometry::EVertexLayout::P3}; | ||||
|             init_data.color  = ColorRGBA::GREEN(); | ||||
|             init_data.reserve_vertices(2); | ||||
|             init_data.reserve_vertices(2); | ||||
| 
 | ||||
|             // vertices
 | ||||
|             init_data.add_vertex((Vec3f) m_cut_line_begin.cast<float>()); | ||||
|             init_data.add_vertex((Vec3f) m_cut_line_end.cast<float>()); | ||||
| 
 | ||||
|             // indices
 | ||||
|             init_data.add_line(0, 1); | ||||
| 
 | ||||
|             m_cut_line.init_from(std::move(init_data)); | ||||
|         } | ||||
|         const Camera &camera = wxGetApp().plater()->get_camera(); | ||||
|         shader->set_uniform("view_model_matrix", camera.get_view_matrix()); | ||||
|         shader->set_uniform("projection_matrix", camera.get_projection_matrix()); | ||||
| 
 | ||||
|         glEnable(GL_LINE_STIPPLE); | ||||
|         glLineStipple(1, 0x0FFF); | ||||
|         m_cut_line.render(); | ||||
|         glDisable(GL_LINE_STIPPLE); | ||||
| 
 | ||||
|         shader->stop_using(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void GLGizmoAdvancedCut::render_connector_model(GLModel &model, const ColorRGBA &color, Transform3d view_model_matrix, bool for_picking) | ||||
|  |  | |||
|  | @ -55,6 +55,7 @@ private: | |||
|     bool m_rotate_lower{false}; | ||||
|     GLModel m_plane; | ||||
|     GLModel m_grabber_connection; | ||||
|     GLModel m_cut_line; | ||||
| 
 | ||||
|     bool m_do_segment; | ||||
|     double m_segment_smoothing_alpha; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Noisyfox
						Noisyfox