mirror of https://github.com/Chlumsky/msdfgen.git
Version bump, example shader update
This commit is contained in:
parent
28ee740a33
commit
208e76c9a1
|
|
@ -151,6 +151,7 @@ The following is an example GLSL fragment shader including anti-aliasing:
|
|||
in vec2 pos;
|
||||
out vec4 color;
|
||||
uniform sampler2D msdf;
|
||||
uniform float pxRange;
|
||||
uniform vec4 bgColor;
|
||||
uniform vec4 fgColor;
|
||||
|
||||
|
|
@ -159,9 +160,11 @@ float median(float r, float g, float b) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
vec2 msdfUnit = pxRange/vec2(textureSize(msdf, 0));
|
||||
vec3 sample = texture(msdf, pos).rgb;
|
||||
float sigDist = median(sample.r, sample.g, sample.b) - 0.5;
|
||||
float opacity = clamp(sigDist/fwidth(sigDist) + 0.5, 0.0, 1.0);
|
||||
sigDist *= dot(msdfUnit, 0.5/fwidth(pos));
|
||||
float opacity = clamp(sigDist + 0.5, 0.0, 1.0);
|
||||
color = mix(bgColor, fgColor, opacity);
|
||||
}
|
||||
```
|
||||
|
|
|
|||
2
main.cpp
2
main.cpp
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
/*
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.4 (2017-02-09) - standalone console program
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.5 (2017-07-23) - standalone console program
|
||||
* --------------------------------------------------------------------------------------------
|
||||
* A utility by Viktor Chlumsky, (c) 2014 - 2017
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
/*
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.4 (2017-02-09) - extensions
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.5 (2017-07-23) - extensions
|
||||
* ----------------------------------------------------------------------------
|
||||
* A utility by Viktor Chlumsky, (c) 2014 - 2017
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
#pragma once
|
||||
|
||||
/*
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.4 (2017-02-09)
|
||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR v1.5 (2017-07-23)
|
||||
* ---------------------------------------------------------------
|
||||
* A utility by Viktor Chlumsky, (c) 2014 - 2017
|
||||
*
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
#include "core/save-bmp.h"
|
||||
#include "core/shape-description.h"
|
||||
|
||||
#define MSDFGEN_VERSION "1.4"
|
||||
#define MSDFGEN_VERSION "1.5"
|
||||
|
||||
namespace msdfgen {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue