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:
Dan Paulat 2023-08-02 20:22:14 -05:00
parent b735589e9a
commit a536d46bb4

View file

@ -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