summaryrefslogtreecommitdiff
path: root/core/math/basis.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-11 16:01:55 +0100
committerGitHub <noreply@github.com>2020-02-11 16:01:55 +0100
commit1eb424ec9549bdd086dfb54c847d107519be73d9 (patch)
treed9a3ec0c72f3a4eda02e16ed883f560e02cf1ccf /core/math/basis.cpp
parent3e3f8a47616327d7faeb17f558bb81a943385e82 (diff)
parentdb81928e08cb58d5f67908c6dfcf9433e572ffe8 (diff)
Merge pull request #36098 from godotengine/vulkan
Add initial Vulkan support, master branch goes UNSTABLE
Diffstat (limited to 'core/math/basis.cpp')
-rw-r--r--core/math/basis.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index ddf5f13d55..14079f811d 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -244,6 +244,18 @@ void Basis::scale_local(const Vector3 &p_scale) {
*this = scaled_local(p_scale);
}
+float Basis::get_uniform_scale() const {
+ return (elements[0].length() + elements[1].length() + elements[2].length()) / 3.0;
+}
+
+void Basis::make_scale_uniform() {
+ float l = (elements[0].length() + elements[1].length() + elements[2].length()) / 3.0;
+ for (int i = 0; i < 3; i++) {
+ elements[i].normalize();
+ elements[i] *= l;
+ }
+}
+
Basis Basis::scaled_local(const Vector3 &p_scale) const {
Basis b;
b.set_diagonal(p_scale);