You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
msdfgen: Update to 1.12.1
This commit is contained in:
@@ -517,7 +517,7 @@ License: BSD-2-clause
|
|||||||
|
|
||||||
Files: thirdparty/msdfgen/*
|
Files: thirdparty/msdfgen/*
|
||||||
Comment: Multi-channel signed distance field generator
|
Comment: Multi-channel signed distance field generator
|
||||||
Copyright: 2014-2024, Viktor Chlumsky
|
Copyright: 2014-2025, Viktor Chlumsky
|
||||||
License: Expat
|
License: Expat
|
||||||
|
|
||||||
Files: thirdparty/openxr/*
|
Files: thirdparty/openxr/*
|
||||||
|
|||||||
2
thirdparty/README.md
vendored
2
thirdparty/README.md
vendored
@@ -833,7 +833,7 @@ Collection of single-file libraries used in Godot components.
|
|||||||
## msdfgen
|
## msdfgen
|
||||||
|
|
||||||
- Upstream: https://github.com/Chlumsky/msdfgen
|
- Upstream: https://github.com/Chlumsky/msdfgen
|
||||||
- Version: 1.12 (85e8b3d47b3d1a42e4a5ebda0a24fb1cc2e669e0, 2024)
|
- Version: 1.12.1 (6574da1310df433c97ca0fddcab7e463c31e58f8, 2025)
|
||||||
- License: MIT
|
- License: MIT
|
||||||
|
|
||||||
Files extracted from the upstream source:
|
Files extracted from the upstream source:
|
||||||
|
|||||||
2
thirdparty/msdfgen/LICENSE.txt
vendored
2
thirdparty/msdfgen/LICENSE.txt
vendored
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2014 - 2024 Viktor Chlumsky
|
Copyright (c) 2014 - 2025 Viktor Chlumsky
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ public:
|
|||||||
bool protectedFlag;
|
bool protectedFlag;
|
||||||
inline ShapeDistanceChecker(const BitmapConstRef<float, N> &sdf, const Shape &shape, const Projection &projection, DistanceMapping distanceMapping, double minImproveRatio) : distanceFinder(shape), sdf(sdf), distanceMapping(distanceMapping), minImproveRatio(minImproveRatio) {
|
inline ShapeDistanceChecker(const BitmapConstRef<float, N> &sdf, const Shape &shape, const Projection &projection, DistanceMapping distanceMapping, double minImproveRatio) : distanceFinder(shape), sdf(sdf), distanceMapping(distanceMapping), minImproveRatio(minImproveRatio) {
|
||||||
texelSize = projection.unprojectVector(Vector2(1));
|
texelSize = projection.unprojectVector(Vector2(1));
|
||||||
|
if (shape.inverseYAxis)
|
||||||
|
texelSize.y = -texelSize.y;
|
||||||
}
|
}
|
||||||
inline ArtifactClassifier classifier(const Vector2 &direction, double span) {
|
inline ArtifactClassifier classifier(const Vector2 &direction, double span) {
|
||||||
return ArtifactClassifier(this, direction, span);
|
return ArtifactClassifier(this, direction, span);
|
||||||
@@ -127,10 +129,10 @@ void MSDFErrorCorrection::protectCorners(const Shape &shape) {
|
|||||||
if (!(commonColor&(commonColor-1))) {
|
if (!(commonColor&(commonColor-1))) {
|
||||||
// Find the four texels that envelop the corner and mark them as protected.
|
// Find the four texels that envelop the corner and mark them as protected.
|
||||||
Point2 p = transformation.project((*edge)->point(0));
|
Point2 p = transformation.project((*edge)->point(0));
|
||||||
if (shape.inverseYAxis)
|
|
||||||
p.y = stencil.height-p.y;
|
|
||||||
int l = (int) floor(p.x-.5);
|
int l = (int) floor(p.x-.5);
|
||||||
int b = (int) floor(p.y-.5);
|
int b = (int) floor(p.y-.5);
|
||||||
|
if (shape.inverseYAxis)
|
||||||
|
b = stencil.height-b-2;
|
||||||
int r = l+1;
|
int r = l+1;
|
||||||
int t = b+1;
|
int t = b+1;
|
||||||
// Check that the positions are within bounds.
|
// Check that the positions are within bounds.
|
||||||
|
|||||||
@@ -84,6 +84,12 @@ void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const Proje
|
|||||||
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio) {
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio) {
|
||||||
msdfErrorCorrectionShapeless(sdf, SDFTransformation(projection, range), minDeviationRatio, false);
|
msdfErrorCorrectionShapeless(sdf, SDFTransformation(projection, range), minDeviationRatio, false);
|
||||||
}
|
}
|
||||||
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio) {
|
||||||
|
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, false);
|
||||||
|
}
|
||||||
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio) {
|
||||||
|
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, false);
|
||||||
|
}
|
||||||
|
|
||||||
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTransformation &transformation, double minDeviationRatio) {
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTransformation &transformation, double minDeviationRatio) {
|
||||||
msdfErrorCorrectionShapeless(sdf, transformation, minDeviationRatio, true);
|
msdfErrorCorrectionShapeless(sdf, transformation, minDeviationRatio, true);
|
||||||
@@ -97,6 +103,12 @@ void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const Projectio
|
|||||||
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio) {
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio) {
|
||||||
msdfErrorCorrectionShapeless(sdf, SDFTransformation(projection, range), minDeviationRatio, true);
|
msdfErrorCorrectionShapeless(sdf, SDFTransformation(projection, range), minDeviationRatio, true);
|
||||||
}
|
}
|
||||||
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio) {
|
||||||
|
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, true);
|
||||||
|
}
|
||||||
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio) {
|
||||||
|
msdfErrorCorrectionShapeless(sdf, SDFTransformation(Projection(), pxRange), minDeviationRatio, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Legacy version
|
// Legacy version
|
||||||
|
|||||||
@@ -22,12 +22,16 @@ void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTr
|
|||||||
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
|
void msdfFastDistanceErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
|
|
||||||
/// Applies the simplified error correction to edges only (EDGE_ONLY mode). Does not need shape or translation.
|
/// Applies the simplified error correction to edges only (EDGE_ONLY mode). Does not need shape or translation.
|
||||||
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const SDFTransformation &transformation, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, const Projection &projection, Range range, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 3> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
|
void msdfFastEdgeErrorCorrection(const BitmapRef<float, 4> &sdf, Range pxRange, double minDeviationRatio = ErrorCorrectionConfig::defaultMinDeviationRatio);
|
||||||
|
|
||||||
/// The original version of the error correction algorithm.
|
/// The original version of the error correction algorithm.
|
||||||
void msdfErrorCorrection_legacy(const BitmapRef<float, 3> &output, const Vector2 &threshold);
|
void msdfErrorCorrection_legacy(const BitmapRef<float, 3> &output, const Vector2 &threshold);
|
||||||
|
|||||||
2
thirdparty/msdfgen/core/rasterization.cpp
vendored
2
thirdparty/msdfgen/core/rasterization.cpp
vendored
@@ -33,7 +33,7 @@ void distanceSignCorrection(const BitmapRef<float, 1> &sdf, const Shape &shape,
|
|||||||
template <int N>
|
template <int N>
|
||||||
static void multiDistanceSignCorrection(const BitmapRef<float, N> &sdf, const Shape &shape, const Projection &projection, FillRule fillRule) {
|
static void multiDistanceSignCorrection(const BitmapRef<float, N> &sdf, const Shape &shape, const Projection &projection, FillRule fillRule) {
|
||||||
int w = sdf.width, h = sdf.height;
|
int w = sdf.width, h = sdf.height;
|
||||||
if (!(w*h))
|
if (!(w && h))
|
||||||
return;
|
return;
|
||||||
Scanline scanline;
|
Scanline scanline;
|
||||||
bool ambiguous = false;
|
bool ambiguous = false;
|
||||||
|
|||||||
2
thirdparty/msdfgen/core/save-bmp.cpp
vendored
2
thirdparty/msdfgen/core/save-bmp.cpp
vendored
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "save-bmp.h"
|
#include "save-bmp.h"
|
||||||
|
|
||||||
|
|||||||
2
thirdparty/msdfgen/core/save-tiff.cpp
vendored
2
thirdparty/msdfgen/core/save-tiff.cpp
vendored
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "save-tiff.h"
|
#include "save-tiff.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
|
|
||||||
|
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "shape-description.h"
|
#include "shape-description.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|||||||
2
thirdparty/msdfgen/msdfgen.h
vendored
2
thirdparty/msdfgen/msdfgen.h
vendored
@@ -4,7 +4,7 @@
|
|||||||
/*
|
/*
|
||||||
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR
|
* MULTI-CHANNEL SIGNED DISTANCE FIELD GENERATOR
|
||||||
* ---------------------------------------------
|
* ---------------------------------------------
|
||||||
* A utility by Viktor Chlumsky, (c) 2014 - 2024
|
* A utility by Viktor Chlumsky, (c) 2014 - 2025
|
||||||
*
|
*
|
||||||
* The technique used to generate multi-channel distance fields in this code
|
* The technique used to generate multi-channel distance fields in this code
|
||||||
* has been developed by Viktor Chlumsky in 2014 for his master's thesis,
|
* has been developed by Viktor Chlumsky in 2014 for his master's thesis,
|
||||||
|
|||||||
Reference in New Issue
Block a user