forked from 1b-agent/opencadstudio-upstream
Inset glyph atlas UVs to prevent texture bleeding
This commit is contained in:
1 parent
143703d809
commit
bd6447d930
1 file changed
+7
-2
@@ -391,8 +391,13 @@ impl GlyphAtlas {
|
||||
|
||||
let (fw, fh) = (self.width as f32, self.height as f32);
|
||||
Some(AtlasEntry {
|
||||
uv_min: [ox as f32 / fw, oy as f32 / fh],
|
||||
uv_max: [(ox + tile.w) as f32 / fw, (oy + tile.h) as f32 / fh],
|
||||
// Sample the centers of the edge texels rather than the tile boundaries.
|
||||
// This prevents bilinear filtering from bleeding into neighbouring tiles.
|
||||
uv_min: [(ox as f32 + 0.5) / fw, (oy as f32 + 0.5) / fh],
|
||||
uv_max: [
|
||||
(ox as f32 + tile.w as f32 - 0.5) / fw,
|
||||
(oy as f32 + tile.h as f32 - 0.5) / fh,
|
||||
],
|
||||
plane_min: tile.plane_min,
|
||||
plane_max: tile.plane_max,
|
||||
advance: tile.advance,
|
||||
|
||||
Reference in new issue
Block a user