mirror of
https://github.com/godotengine/godot.git
synced 2026-01-06 10:11:57 +03:00
Revert "Implement Skew in Node2D"
This reverts commit 7f61710183.
See #38868, in its current implementation a small skew value might end up
serialized to scene files due to floating point precision errors, which is
detrimental to VCS.
This can be cherry-picked anew once a fix for #38868 has been found.
This commit is contained in:
@@ -70,18 +70,6 @@ void Transform2D::rotate(real_t p_phi) {
|
||||
*this = Transform2D(p_phi, Vector2()) * (*this);
|
||||
}
|
||||
|
||||
real_t Transform2D::get_skew() const {
|
||||
|
||||
real_t det = basis_determinant();
|
||||
return Math::acos(elements[0].normalized().dot(SGN(det) * elements[1].normalized())) - Math_PI * 0.5;
|
||||
}
|
||||
|
||||
void Transform2D::set_skew(float p_angle) {
|
||||
|
||||
real_t det = basis_determinant();
|
||||
elements[1] = SGN(det) * elements[0].rotated((Math_PI * 0.5 + p_angle)).normalized() * elements[1].length();
|
||||
}
|
||||
|
||||
real_t Transform2D::get_rotation() const {
|
||||
return Math::atan2(elements[0].y, elements[0].x);
|
||||
}
|
||||
|
||||
@@ -71,10 +71,7 @@ struct Transform2D {
|
||||
|
||||
void set_rotation(real_t p_rot);
|
||||
real_t get_rotation() const;
|
||||
real_t get_skew() const;
|
||||
void set_skew(float p_angle);
|
||||
_FORCE_INLINE_ void set_rotation_and_scale(real_t p_rot, const Size2 &p_scale);
|
||||
_FORCE_INLINE_ void set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew);
|
||||
void rotate(real_t p_phi);
|
||||
|
||||
void scale(const Size2 &p_scale);
|
||||
@@ -188,14 +185,6 @@ void Transform2D::set_rotation_and_scale(real_t p_rot, const Size2 &p_scale) {
|
||||
elements[0][1] = Math::sin(p_rot) * p_scale.x;
|
||||
}
|
||||
|
||||
void Transform2D::set_rotation_scale_and_skew(real_t p_rot, const Size2 &p_scale, float p_skew) {
|
||||
|
||||
elements[0][0] = Math::cos(p_rot) * p_scale.x;
|
||||
elements[1][1] = Math::cos(p_rot + p_skew) * p_scale.y;
|
||||
elements[1][0] = -Math::sin(p_rot + p_skew) * p_scale.y;
|
||||
elements[0][1] = Math::sin(p_rot) * p_scale.x;
|
||||
}
|
||||
|
||||
Rect2 Transform2D::xform_inv(const Rect2 &p_rect) const {
|
||||
|
||||
Vector2 ends[4] = {
|
||||
|
||||
Reference in New Issue
Block a user