mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-06 13:03:36 +00:00
fix: Vec3 construct wasn't constexpr
This commit is contained in:
parent
659b9c32cb
commit
b630ec8800
|
|
@ -5,15 +5,6 @@
|
|||
|
||||
#include "AABB.h"
|
||||
|
||||
Vec3::Vec3(double x, double y, double z) {
|
||||
if (x == -0.0) x = 0.0;
|
||||
if (y == -0.0) y = 0.0;
|
||||
if (z == -0.0) z = 0.0;
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
}
|
||||
|
||||
Vec3 Vec3::vectorTo(const Vec3& p) const { return {p.x - x, p.y - y, p.z - z}; }
|
||||
|
||||
Vec3 Vec3::normalize() const {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ class Vec3 {
|
|||
public:
|
||||
double x, y, z;
|
||||
|
||||
Vec3() {}
|
||||
Vec3(double x, double y, double z);
|
||||
constexpr Vec3() = default;
|
||||
constexpr Vec3(const double x, const double y, const double z)
|
||||
: x(x), y(y), z(z) {}
|
||||
|
||||
Vec3 vectorTo(const Vec3& p) const;
|
||||
Vec3 normalize() const;
|
||||
|
|
|
|||
Loading…
Reference in a new issue