summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTwistedTwigleg <beard.noah@gmail.com>2017-06-30 14:47:17 -0400
committerTwistedTwigleg <beard.noah@gmail.com>2017-07-03 16:29:03 -0400
commit44ecfb028d21975944b47b6496712a29f17f3848 (patch)
tree5d9e8259992ef8ef1690235c540a306e073a36f4 /core
parentcb59236ce938fdf3ffe20b1f77c4f7058ddaadf1 (diff)
Fixed syntax inconsistency in Vector3.snap and Vector3.snapped
Diffstat (limited to 'core')
-rw-r--r--core/math/quick_hull.cpp2
-rw-r--r--core/math/triangle_mesh.cpp2
-rw-r--r--core/math/vector3.cpp10
-rw-r--r--core/math/vector3.h4
4 files changed, 9 insertions, 9 deletions
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 9f594ba4fa..54b97ac38c 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -58,7 +58,7 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me
for (int i = 0; i < p_points.size(); i++) {
- Vector3 sp = p_points[i].snapped(0.0001);
+ Vector3 sp = p_points[i].snapped(Vector3(0.0001, 0.0001, 0.0001));
if (valid_cache.has(sp)) {
valid_points[i] = false;
//print_line("INVALIDATED: "+itos(i));
diff --git a/core/math/triangle_mesh.cpp b/core/math/triangle_mesh.cpp
index 08ac08d776..1df3c8c298 100644
--- a/core/math/triangle_mesh.cpp
+++ b/core/math/triangle_mesh.cpp
@@ -117,7 +117,7 @@ void TriangleMesh::create(const PoolVector<Vector3> &p_faces) {
for (int j = 0; j < 3; j++) {
int vidx = -1;
- Vector3 vs = v[j].snapped(0.0001);
+ Vector3 vs = v[j].snapped(Vector3(0.0001, 0.0001, 0.0001));
Map<Vector3, int>::Element *E = db.find(vs);
if (E) {
vidx = E->get();
diff --git a/core/math/vector3.cpp b/core/math/vector3.cpp
index e413cc147d..efffacb36e 100644
--- a/core/math/vector3.cpp
+++ b/core/math/vector3.cpp
@@ -61,13 +61,13 @@ int Vector3::max_axis() const {
return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0);
}
-void Vector3::snap(real_t p_val) {
+void Vector3::snap(Vector3 p_val) {
- x = Math::stepify(x, p_val);
- y = Math::stepify(y, p_val);
- z = Math::stepify(z, p_val);
+ x = Math::stepify(x, p_val.x);
+ y = Math::stepify(y, p_val.y);
+ z = Math::stepify(z, p_val.z);
}
-Vector3 Vector3::snapped(real_t p_val) const {
+Vector3 Vector3::snapped(Vector3 p_val) const {
Vector3 v = *this;
v.snap(p_val);
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 5f4390fbd1..7dfcedd0da 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -81,8 +81,8 @@ struct Vector3 {
_FORCE_INLINE_ void zero();
- void snap(real_t p_val);
- Vector3 snapped(real_t p_val) const;
+ void snap(Vector3 p_val);
+ Vector3 snapped(Vector3 p_val) const;
void rotate(const Vector3 &p_axis, real_t p_phi);
Vector3 rotated(const Vector3 &p_axis, real_t p_phi) const;