mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Various fixes
This commit is contained in:
		
							parent
							
								
									a50c5a2b7a
								
							
						
					
					
						commit
						fe78e40cb4
					
				
					 26 changed files with 176 additions and 58 deletions
				
			
		
							
								
								
									
										15
									
								
								resources/shaders/110/flat_clip.fs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								resources/shaders/110/flat_clip.fs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| #version 110 | ||||
| 
 | ||||
| const vec3 ZERO = vec3(0.0, 0.0, 0.0); | ||||
| 
 | ||||
| uniform vec4 uniform_color; | ||||
| 
 | ||||
| varying vec3 clipping_planes_dots; | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|     if (any(lessThan(clipping_planes_dots, ZERO))) | ||||
|         discard; | ||||
| 
 | ||||
|     gl_FragColor = uniform_color; | ||||
| } | ||||
							
								
								
									
										23
									
								
								resources/shaders/110/flat_clip.vs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								resources/shaders/110/flat_clip.vs
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| #version 110 | ||||
| 
 | ||||
| uniform mat4 view_model_matrix; | ||||
| uniform mat4 projection_matrix; | ||||
| uniform mat4 volume_world_matrix; | ||||
| 
 | ||||
| // Clipping plane, x = min z, y = max z. Used by the FFF and SLA previews to clip with a top / bottom plane. | ||||
| uniform vec2 z_range; | ||||
| // Clipping plane - general orientation. Used by the SLA gizmo. | ||||
| uniform vec4 clipping_plane; | ||||
| 
 | ||||
| attribute vec3 v_position; | ||||
| 
 | ||||
| varying vec3 clipping_planes_dots; | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|     // Fill in the scalars for fragment shader clipping. Fragments with any of these components lower than zero are discarded. | ||||
|     vec4 world_pos = volume_world_matrix * vec4(v_position, 1.0); | ||||
|     clipping_planes_dots = vec3(dot(world_pos, clipping_plane), world_pos.z - z_range.x, z_range.y - world_pos.z); | ||||
| 
 | ||||
|     gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0); | ||||
| } | ||||
|  | @ -34,8 +34,6 @@ uniform SlopeDetection slope; | |||
| //BBS: add outline_color | ||||
| uniform bool is_outline; | ||||
| 
 | ||||
| uniform bool offset_depth_buffer; | ||||
| 
 | ||||
| #ifdef ENABLE_ENVIRONMENT_MAP | ||||
|     uniform sampler2D environment_tex; | ||||
|     uniform bool use_environment_tex; | ||||
|  | @ -97,9 +95,4 @@ void main() | |||
| #endif | ||||
| 	else | ||||
|         gl_FragColor = vec4(vec3(intensity.y) + color * intensity.x, alpha); | ||||
| 		 | ||||
|     // In the support painting gizmo and the seam painting gizmo are painted triangles rendered over the already | ||||
|     // rendered object. To resolved z-fighting between previously rendered object and painted triangles, values | ||||
|     // inside the depth buffer are offset by small epsilon for painted triangles inside those gizmos. | ||||
|     gl_FragDepth = gl_FragCoord.z - (offset_depth_buffer ? EPSILON : 0.0); | ||||
| } | ||||
|  | @ -1,13 +1,8 @@ | |||
| #version 110 | ||||
| 
 | ||||
| const float EPSILON = 0.0001; | ||||
| 
 | ||||
| uniform vec4 uniform_color; | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|     gl_FragColor = uniform_color; | ||||
|     // Values inside depth buffer for fragments of the contour of a selected area are offset | ||||
|     // by small epsilon to solve z-fighting between painted triangles and contour lines. | ||||
|     gl_FragDepth = gl_FragCoord.z - EPSILON; | ||||
| } | ||||
|  |  | |||
|  | @ -2,10 +2,14 @@ | |||
| 
 | ||||
| uniform mat4 view_model_matrix; | ||||
| uniform mat4 projection_matrix; | ||||
| uniform float offset; | ||||
| 
 | ||||
| attribute vec3 v_position; | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|     gl_Position = projection_matrix * view_model_matrix * vec4(v_position, 1.0); | ||||
|     // Add small epsilon to z to solve z-fighting between painted triangles and contour lines. | ||||
| 	vec4 clip_position = projection_matrix * view_model_matrix * vec4(v_position, 1.0); | ||||
| 	clip_position.z -= offset * abs(clip_position.w); | ||||
|     gl_Position = clip_position; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 enricoturri1966
						enricoturri1966