mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 09:20:06 +00:00 
			
		
		
		
	Don't interpolate placefile icon pixels
This is a 90% solution to icon placement/blurring. The pixel coordinates will need rounded in the vertex shader once the MVP and map matrices are broken out for proper rotation.
This commit is contained in:
		
							parent
							
								
									b735589e9a
								
							
						
					
					
						commit
						a536d46bb4
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		|  | @ -52,6 +52,7 @@ struct PlacefileIconInfo | ||||||
| 
 | 
 | ||||||
|       numIcons_ = columns_ * rows_; |       numIcons_ = columns_ * rows_; | ||||||
| 
 | 
 | ||||||
|  |       // Pixel size
 | ||||||
|       float xFactor = 0.0f; |       float xFactor = 0.0f; | ||||||
|       float yFactor = 0.0f; |       float yFactor = 0.0f; | ||||||
| 
 | 
 | ||||||
|  | @ -221,6 +222,10 @@ void PlacefileIcons::Render( | ||||||
|       UseMapProjection( |       UseMapProjection( | ||||||
|          params, p->uMapMatrixLocation_, p->uMapScreenCoordLocation_); |          params, p->uMapMatrixLocation_, p->uMapScreenCoordLocation_); | ||||||
| 
 | 
 | ||||||
|  |       // Don't interpolate texture coordinates
 | ||||||
|  |       gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | ||||||
|  |       gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | ||||||
|  | 
 | ||||||
|       // Draw icons
 |       // Draw icons
 | ||||||
|       gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_); |       gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_); | ||||||
|    } |    } | ||||||
|  | @ -312,10 +317,10 @@ void PlacefileIcons::Impl::Update() | ||||||
|             static_cast<float>(icon.iconFile_->iconHeight_) * 0.5f; |             static_cast<float>(icon.iconFile_->iconHeight_) * 0.5f; | ||||||
| 
 | 
 | ||||||
|          // Final X/Y offsets in pixels
 |          // Final X/Y offsets in pixels
 | ||||||
|          const float lx = x - hw; |          const float lx = std::roundf(x - hw); | ||||||
|          const float rx = x + hw; |          const float rx = std::roundf(x + hw); | ||||||
|          const float by = y - hh; |          const float by = std::roundf(y - hh); | ||||||
|          const float ty = y + hh; |          const float ty = std::roundf(y + hh); | ||||||
| 
 | 
 | ||||||
|          // Angle in degrees
 |          // Angle in degrees
 | ||||||
|          // TODO: Properly convert
 |          // TODO: Properly convert
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat