mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:50:04 +00:00 
			
		
		
		
	Add threshold geometry shader, refactor vertex and fragment shaders
This commit is contained in:
		
							parent
							
								
									5e1b1a5ba6
								
							
						
					
					
						commit
						69f93d6faf
					
				
					 9 changed files with 83 additions and 14 deletions
				
			
		
							
								
								
									
										41
									
								
								scwx-qt/gl/threshold.geom
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								scwx-qt/gl/threshold.geom
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| #version 330 core | ||||
| 
 | ||||
| layout (triangles) in; | ||||
| layout (triangle_strip, max_vertices = 3) out; | ||||
| 
 | ||||
| uniform float uMapDistance; | ||||
| 
 | ||||
| in VertexData | ||||
| { | ||||
|    int  threshold; | ||||
|    vec2 texCoord; | ||||
|    vec4 color; | ||||
| } gsIn[]; | ||||
| 
 | ||||
| smooth out vec2 texCoord; | ||||
| smooth out vec4 color; | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|    if (gsIn[0].threshold <= 0 ||            // If Threshold: 0 was specified, no threshold | ||||
|        gsIn[0].threshold >= uMapDistance || // If Threshold is above current map distance | ||||
|        gsIn[0].threshold >= 999)            // If Threshold: 999 was specified (or greater), no threshold | ||||
|    { | ||||
|       gl_Position = gl_in[0].gl_Position; | ||||
|       texCoord    = gsIn[0].texCoord; | ||||
|       color       = gsIn[0].color; | ||||
|       EmitVertex(); | ||||
| 
 | ||||
|       gl_Position = gl_in[1].gl_Position; | ||||
|       texCoord    = gsIn[1].texCoord; | ||||
|       color       = gsIn[1].color; | ||||
| 
 | ||||
|       EmitVertex(); | ||||
|       gl_Position = gl_in[2].gl_Position; | ||||
|       texCoord    = gsIn[2].texCoord; | ||||
|       color       = gsIn[2].color; | ||||
| 
 | ||||
|       EmitVertex(); | ||||
|       EndPrimitive(); | ||||
|    } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat