mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
4c3f7d1290
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.
31 lines
935 B
C++
31 lines
935 B
C++
|
|
#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);
|
|
}
|
|
|
|
}
|