bru
h
This commit is contained in:
parent
5018ccbbb0
commit
7552d2fa2a
16 changed files with 3719 additions and 10 deletions
27
text_rendering/msdf_c/Readme.md
Normal file
27
text_rendering/msdf_c/Readme.md
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# msdf_c 0.1
|
||||
A pure C99 multi-channel signed distance field generator. Handles MSDF bitmap
|
||||
Generation from given ttf/otf font (outlines).
|
||||
Single Header STB-style library
|
||||
|
||||
---
|
||||
|
||||
[This library is my take on improving msdf-c with some fixes and improving its API](https://github.com/solenum/msdf-c)
|
||||
|
||||
[Based on the C++ implementation by Viktor Chlumský.](https://github.com/Chlumsky/msdfgen)
|
||||
|
||||
~~~
|
||||
// example fragment shader
|
||||
// scale is render_width/glyph_width
|
||||
// render_width being the width of each rendered glyph
|
||||
float median(float r, float g, float b) {
|
||||
return max(min(r, g), min(max(r, g), b));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 sample = texture(u_texture, uv).rgb;
|
||||
float dist = scale * (median(sample.r, sample.g, sample.b) - 0.5);
|
||||
float o = clamp(dist + 0.5, 0.0, 1.0);
|
||||
color = vec4(vec3(1.0), o);
|
||||
}
|
||||
~~~
|
||||
Loading…
Add table
Add a link
Reference in a new issue