Skip to content

Commit 4d256b8

Browse files
committed
Fix mip pixel range
1 parent e06d489 commit 4d256b8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/nbl/ext/TextRendering/TextRendering.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,14 @@ std::vector<core::smart_refctd_ptr<ICPUBuffer>> FontFace::generateGlyphMSDF(uint
8585
uint32_t mipW = textureExtents.x / (1 << i);
8686
uint32_t mipH = textureExtents.y / (1 << i);
8787
float32_t2 mipExtents = float32_t2(float(mipW), float(mipH));
88+
uint32_t mipPixelRange = msdfPixelRange / (1 << i);
8889

8990
float32_t2 frameSize = float32_t2(
9091
(shapeBounds.r - shapeBounds.l),
9192
(shapeBounds.t - shapeBounds.b)
9293
);
9394

94-
const float32_t2 margin = float32_t2((msdfPixelRange / (1 << i)) * 2.0f);
95+
const float32_t2 margin = float32_t2(mipPixelRange * 2);
9596
const float32_t2 nonUniformScale = (mipExtents - margin) / frameSize;
9697
const float32_t uniformScale = core::min(nonUniformScale.x, nonUniformScale.y);
9798

@@ -103,7 +104,7 @@ std::vector<core::smart_refctd_ptr<ICPUBuffer>> FontFace::generateGlyphMSDF(uint
103104
const float32_t2 shapeSpaceCenter = float32_t2(shapeBounds.l + shapeBounds.r, shapeBounds.t + shapeBounds.b) * float32_t2(0.5);
104105
const float32_t2 translate = mipExtents / (float32_t2(2.0) * uniformScale) - shapeSpaceCenter;
105106

106-
buffers.push_back(m_textRenderer->generateShapeMSDF(shape, msdfPixelRange, mipExtents, float32_t2(uniformScale, uniformScale), translate));
107+
buffers.push_back(m_textRenderer->generateShapeMSDF(shape, mipPixelRange, mipExtents, float32_t2(uniformScale, uniformScale), translate));
107108
}
108109
return buffers;
109110
}

0 commit comments

Comments
 (0)