mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Export to obj file only toolpaths visible in 3D scene
This commit is contained in:
		
							parent
							
								
									1f6aab312b
								
							
						
					
					
						commit
						730283a9e9
					
				
					 2 changed files with 18 additions and 10 deletions
				
			
		|  | @ -872,7 +872,7 @@ void GLVolumeCollection::export_toolpaths_to_obj(const char* filename) const | |||
| 
 | ||||
|     for (const GLVolume* volume : this->volumes) | ||||
|     { | ||||
|         if (!volume->is_extrusion_path) | ||||
|         if (!volume->is_active || !volume->is_extrusion_path) | ||||
|             continue; | ||||
| 
 | ||||
|         std::vector<float> vertices_and_normals_interleaved; | ||||
|  | @ -896,22 +896,30 @@ void GLVolumeCollection::export_toolpaths_to_obj(const char* filename) const | |||
|             triangle_indices = volume->indexed_vertex_array.triangle_indices; | ||||
|         else if ((volume->indexed_vertex_array.triangle_indices_VBO_id != 0) && (volume->indexed_vertex_array.triangle_indices_size != 0)) | ||||
|         { | ||||
|             triangle_indices = std::vector<int>(volume->indexed_vertex_array.triangle_indices_size, 0); | ||||
|             size_t size = std::min(volume->indexed_vertex_array.triangle_indices_size, volume->tverts_range.second - volume->tverts_range.first); | ||||
|             if (size != 0) | ||||
|             { | ||||
|                 triangle_indices = std::vector<int>(size, 0); | ||||
| 
 | ||||
|             glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, volume->indexed_vertex_array.triangle_indices_VBO_id)); | ||||
|             glsafe(::glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, triangle_indices.size() * sizeof(int), triangle_indices.data())); | ||||
|             glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); | ||||
|                 glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, volume->indexed_vertex_array.triangle_indices_VBO_id)); | ||||
|                 glsafe(::glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, volume->tverts_range.first * sizeof(int), size * sizeof(int), triangle_indices.data())); | ||||
|                 glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (!volume->indexed_vertex_array.quad_indices.empty()) | ||||
|             quad_indices = volume->indexed_vertex_array.quad_indices; | ||||
|         if ((volume->indexed_vertex_array.quad_indices_VBO_id != 0) && (volume->indexed_vertex_array.quad_indices_size != 0)) | ||||
|         { | ||||
|             quad_indices = std::vector<int>(volume->indexed_vertex_array.quad_indices_size, 0); | ||||
|             size_t size = std::min(volume->indexed_vertex_array.quad_indices_size, volume->qverts_range.second - volume->qverts_range.first); | ||||
|             if (size != 0) | ||||
|             { | ||||
|                 quad_indices = std::vector<int>(size, 0); | ||||
| 
 | ||||
|             glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, volume->indexed_vertex_array.quad_indices_VBO_id)); | ||||
|             glsafe(::glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, quad_indices.size() * sizeof(int), quad_indices.data())); | ||||
|             glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); | ||||
|                 glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, volume->indexed_vertex_array.quad_indices_VBO_id)); | ||||
|                 glsafe(::glGetBufferSubData(GL_ELEMENT_ARRAY_BUFFER, volume->qverts_range.first * sizeof(int), size * sizeof(int), quad_indices.data())); | ||||
|                 glsafe(::glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0)); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (triangle_indices.empty() && quad_indices.empty()) | ||||
|  |  | |||
|  | @ -439,7 +439,7 @@ public: | |||
| 
 | ||||
|     bool                empty() const { return this->indexed_vertex_array.empty(); } | ||||
| 
 | ||||
|     void                set_range(coordf_t low, coordf_t high); | ||||
|     void                set_range(double low, double high); | ||||
| 
 | ||||
|     void                render() const; | ||||
|     void                render(int color_id, int detection_id, int worldmatrix_id) const; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri