diff options
| author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2020-12-27 15:30:33 +0200 |
|---|---|---|
| committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-08-27 15:43:18 +0300 |
| commit | 4c3f7d1290311456519ca2416590c7e62465b7f2 (patch) | |
| tree | d8b2373cb7bcb4b7aff47d81e35f36a0b9bf993c /thirdparty/msdfgen/core/SignedDistance.cpp | |
| parent | 00268e37a0e40630ce76b5144cb272c4cc73a672 (diff) | |
| download | redot-engine-4c3f7d1290311456519ca2416590c7e62465b7f2.tar.gz | |
Makes FontData importable resource.
Adds multi-channel SDF font texture generation and rendering support.
Adds per-font oversampling support.
Adds FontData import plugins (for dynamic fonts, BMFonts and monospaced image fonts), font texture cache pre-generation and loading.
Adds BMFont binary format and outline support.
Diffstat (limited to 'thirdparty/msdfgen/core/SignedDistance.cpp')
| -rw-r--r-- | thirdparty/msdfgen/core/SignedDistance.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/thirdparty/msdfgen/core/SignedDistance.cpp b/thirdparty/msdfgen/core/SignedDistance.cpp new file mode 100644 index 0000000000..18c9d2c424 --- /dev/null +++ b/thirdparty/msdfgen/core/SignedDistance.cpp @@ -0,0 +1,30 @@ + +#include "SignedDistance.h" + +#include <cmath> + +namespace msdfgen { + +const SignedDistance SignedDistance::INFINITE(-1e240, 1); + +SignedDistance::SignedDistance() : distance(-1e240), dot(1) { } + +SignedDistance::SignedDistance(double dist, double d) : distance(dist), dot(d) { } + +bool operator<(SignedDistance a, SignedDistance b) { + return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot < b.dot); +} + +bool operator>(SignedDistance a, SignedDistance b) { + return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot > b.dot); +} + +bool operator<=(SignedDistance a, SignedDistance b) { + return fabs(a.distance) < fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot <= b.dot); +} + +bool operator>=(SignedDistance a, SignedDistance b) { + return fabs(a.distance) > fabs(b.distance) || (fabs(a.distance) == fabs(b.distance) && a.dot >= b.dot); +} + +} |
