mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 07:20:04 +00:00 
			
		
		
		
	Add geo line shaders
This commit is contained in:
		
							parent
							
								
									bf6b3e3601
								
							
						
					
					
						commit
						bee167764a
					
				
					 4 changed files with 60 additions and 1 deletions
				
			
		
							
								
								
									
										39
									
								
								scwx-qt/gl/geo_line.vert
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								scwx-qt/gl/geo_line.vert
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,39 @@ | |||
| #version 330 core | ||||
| 
 | ||||
| #define DEGREES_MAX   360.0f | ||||
| #define LATITUDE_MAX  85.051128779806604f | ||||
| #define LONGITUDE_MAX 180.0f | ||||
| #define PI            3.1415926535897932384626433f | ||||
| #define RAD2DEG       57.295779513082320876798156332941f | ||||
| 
 | ||||
| layout (location = 0) in vec2 aLatLong; | ||||
| layout (location = 1) in vec2 aXYOffset; | ||||
| layout (location = 2) in vec2 aTexCoord; | ||||
| layout (location = 3) in vec4 aModulate; | ||||
| 
 | ||||
| uniform mat4 uMVPMatrix; | ||||
| uniform vec2 uMapScreenCoord; | ||||
| 
 | ||||
| flat out vec2 texCoord; | ||||
| flat out vec4 modulate; | ||||
| 
 | ||||
| vec2 latLngToScreenCoordinate(in vec2 latLng) | ||||
| { | ||||
|    vec2 p; | ||||
|    latLng.x = clamp(latLng.x, -LATITUDE_MAX, LATITUDE_MAX); | ||||
|    p.xy     = vec2(LONGITUDE_MAX + latLng.y, | ||||
|                    -(LONGITUDE_MAX - RAD2DEG * log(tan(PI / 4 + latLng.x * PI / DEGREES_MAX)))); | ||||
|    return p; | ||||
| } | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|    // Pass the texture coordinate and color modulate to the fragment shader | ||||
|    texCoord = aTexCoord; | ||||
|    modulate = aModulate; | ||||
| 
 | ||||
|    vec2 p = latLngToScreenCoordinate(aLatLong) + aXYOffset - uMapScreenCoord; | ||||
| 
 | ||||
|    // Transform the position to screen coordinates | ||||
|    gl_Position = uMVPMatrix * vec4(p, 0.0f, 1.0f); | ||||
| } | ||||
							
								
								
									
										16
									
								
								scwx-qt/gl/texture2d.frag
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								scwx-qt/gl/texture2d.frag
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| #version 330 core | ||||
| 
 | ||||
| // Lower the default precision to medium | ||||
| precision mediump float; | ||||
| 
 | ||||
| uniform sampler2D uTexture; | ||||
| 
 | ||||
| flat in vec2 texCoord; | ||||
| flat in vec4 modulate; | ||||
| 
 | ||||
| layout (location = 0) out vec4 fragColor; | ||||
| 
 | ||||
| void main() | ||||
| { | ||||
|    fragColor = texture(uTexture, texCoord) * modulate; | ||||
| } | ||||
|  | @ -122,12 +122,14 @@ set(RESOURCE_FILES scwx-qt.qrc) | |||
| 
 | ||||
| set(SHADER_FILES gl/color.frag | ||||
|                  gl/color.vert | ||||
|                  gl/geo_line.vert | ||||
|                  gl/radar.frag | ||||
|                  gl/radar.vert | ||||
|                  gl/text.frag | ||||
|                  gl/text.vert | ||||
|                  gl/texture1d.frag | ||||
|                  gl/texture1d.vert) | ||||
|                  gl/texture1d.vert | ||||
|                  gl/texture2d.frag) | ||||
| 
 | ||||
| set(CMAKE_FILES scwx-qt.cmake) | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,12 +2,14 @@ | |||
|     <qresource prefix="/"> | ||||
|         <file>gl/color.frag</file> | ||||
|         <file>gl/color.vert</file> | ||||
|         <file>gl/geo_line.vert</file> | ||||
|         <file>gl/radar.frag</file> | ||||
|         <file>gl/radar.vert</file> | ||||
|         <file>gl/text.frag</file> | ||||
|         <file>gl/text.vert</file> | ||||
|         <file>gl/texture1d.frag</file> | ||||
|         <file>gl/texture1d.vert</file> | ||||
|         <file>gl/texture2d.frag</file> | ||||
|         <file>res/config/radar_sites.json</file> | ||||
|         <file>res/fonts/din1451alt.ttf</file> | ||||
|         <file>res/fonts/din1451alt_g.ttf</file> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat