summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorSilc Renew <tokage.it.lab@gmail.com>2022-11-24 20:09:34 +0900
committerSilc Renew <tokage.it.lab@gmail.com>2022-11-24 20:31:43 +0900
commitb217c41d360bdd4eeab94a2064c1eb5ab6bd93d5 (patch)
tree7a355c3fb680acfa5fab670ecd2c66de7f7feacf /scene
parentf16c5b564b569497d04deb965a4fd63b3ea2ab2f (diff)
Refactor interpolating functions in some classes to use Math class
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/primitive_meshes.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp
index 4c6d533c72..2e8fcb3717 100644
--- a/scene/resources/primitive_meshes.cpp
+++ b/scene/resources/primitive_meshes.cpp
@@ -2779,13 +2779,7 @@ void TextMesh::_generate_glyph_mesh_data(const GlyphMeshKey &p_key, const Glyph
real_t step = CLAMP(curve_step / (p0 - p3).length(), 0.01, 0.5);
real_t t = step;
while (t < 1.0) {
- real_t omt = (1.0 - t);
- real_t omt2 = omt * omt;
- real_t omt3 = omt2 * omt;
- real_t t2 = t * t;
- real_t t3 = t2 * t;
-
- Vector2 point = p0 * omt3 + p1 * omt2 * t * 3.0 + p2 * omt * t2 * 3.0 + p3 * t3;
+ Vector2 point = p0.bezier_interpolate(p1, p2, p3, t);
Vector2 p = point * pixel_size + origin;
polygon.push_back(ContourPoint(p, false));
t += step;