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.
30 lines
935 B
C++
30 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);
|
|
}
|
|
|
|
}
|