mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 17:10:05 +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_;
|
||||
|
||||
// Pixel size
|
||||
float xFactor = 0.0f;
|
||||
float yFactor = 0.0f;
|
||||
|
||||
|
|
@ -221,6 +222,10 @@ void PlacefileIcons::Render(
|
|||
UseMapProjection(
|
||||
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
|
||||
gl.glDrawArrays(GL_TRIANGLES, 0, p->numVertices_);
|
||||
}
|
||||
|
|
@ -312,10 +317,10 @@ void PlacefileIcons::Impl::Update()
|
|||
static_cast<float>(icon.iconFile_->iconHeight_) * 0.5f;
|
||||
|
||||
// Final X/Y offsets in pixels
|
||||
const float lx = x - hw;
|
||||
const float rx = x + hw;
|
||||
const float by = y - hh;
|
||||
const float ty = y + hh;
|
||||
const float lx = std::roundf(x - hw);
|
||||
const float rx = std::roundf(x + hw);
|
||||
const float by = std::roundf(y - hh);
|
||||
const float ty = std::roundf(y + hh);
|
||||
|
||||
// Angle in degrees
|
||||
// TODO: Properly convert
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue