From 513ae84577106023a914be0d44420a753c90fddb Mon Sep 17 00:00:00 2001 From: h4570 Date: Thu, 3 Dec 2020 23:51:18 +0100 Subject: [PATCH] added const to some vector3 funcs --- src/engine/include/models/math/vector3.hpp | 4 ++-- src/engine/models/math/vector3.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/include/models/math/vector3.hpp b/src/engine/include/models/math/vector3.hpp index a4bb4e0..55f392c 100644 --- a/src/engine/include/models/math/vector3.hpp +++ b/src/engine/include/models/math/vector3.hpp @@ -44,8 +44,8 @@ public: Vector3 operator-(void); static u8 shouldBeBackfaceCulled(const Vector3 *t_cameraPos, const Vector3 *v0, const Vector3 *v1, const Vector3 *v2); - u8 collidesSquare(Vector3 &t_min, Vector3 &t_max); - u8 isOnSquare(Vector3 &t_min, Vector3 &t_max); + u8 collidesSquare(const Vector3 &t_min, const Vector3 &t_max) const; + u8 isOnSquare(const Vector3 &t_min, const Vector3 &t_max) const; float length(); void normalize(); void setByLerp(const Vector3 &v1, const Vector3 &v2, const float &t_interp, const float &t_scale); diff --git a/src/engine/models/math/vector3.cpp b/src/engine/models/math/vector3.cpp index e05b36c..fbb772e 100644 --- a/src/engine/models/math/vector3.cpp +++ b/src/engine/models/math/vector3.cpp @@ -170,13 +170,13 @@ u8 Vector3::shouldBeBackfaceCulled(const Vector3 *t_cameraPos, const Vector3 *v0 } /** Checks intersection with given square */ -u8 Vector3::collidesSquare(Vector3 &t_min, Vector3 &t_max) +u8 Vector3::collidesSquare(const Vector3 &t_min, const Vector3 &t_max) const { return ((this->x <= t_max.x && this->x >= t_min.x) && (this->y < t_max.y && this->y >= t_min.y) && (this->z <= t_max.z && this->z >= t_min.z)) ? 1 : 0; } /** Checks is this vector is on given square */ -u8 Vector3::isOnSquare(Vector3 &t_min, Vector3 &t_max) +u8 Vector3::isOnSquare(const Vector3 &t_min, const Vector3 &t_max) const { return ((this->x <= t_max.x && this->x >= t_min.x) && (this->y >= t_max.y) && (this->z <= t_max.z && this->z >= t_min.z)) ? 1 : 0; }