[core] fix text blurriness at different FOVs

ported from -js: c52a09639ceeeb809cd837360993df9c45b45420

This replaces a hardcoded shader approximation with a more correct,
FOV-dependent one.

`gl_Position.w - 0.5`
is replaced with
`gl_Position.w / tan(fov)`

The `/ tan(fov)` is handled by multiplying `1 / tan(fov)` into `u_gamma`
outside the shader.

I think `- 0.5` was just chosen as something that looked right for the
default fov.lease enter the commit message for your changes. Lines starting
This commit is contained in:
Ansis Brammanis
2016-12-14 13:54:45 -08:00
committed by John Firebaugh
parent 9dd0cdbc57
commit ebd241363d
2 changed files with 3 additions and 3 deletions

View File

@@ -75,9 +75,9 @@ static SymbolSDFProgram::UniformValues makeSDFValues(const style::SymbolProperty
// The default gamma value has to be adjust for the current pixelratio so that we're not
// drawing blurry font on retina screens.
const float gammaBase = 0.105 * values.sdfScale / values.paintSize / pixelRatio;
const float gammaScale = values.pitchAlignment == AlignmentType::Map
const float gammaScale = (values.pitchAlignment == AlignmentType::Map
? 1.0 / std::cos(state.getPitch())
: 1.0;
: 1.0) / state.getAltitude();
return makeValues<SymbolSDFProgram::UniformValues>(
values,