mirror of https://github.com/AxioDL/zeus.git
Make vector float constructors `explicit`
This commit is contained in:
parent
1535b3efcd
commit
9ab271cd04
|
@ -45,10 +45,12 @@ public:
|
||||||
CVector3f max;
|
CVector3f max;
|
||||||
|
|
||||||
// set default AABox to insane inverse min/max to allow for accumulation
|
// set default AABox to insane inverse min/max to allow for accumulation
|
||||||
inline CAABox() : min(1e16f), max(-1e16f) {}
|
CAABox() : CAABox(1e16f, -1e16f) {}
|
||||||
|
|
||||||
CAABox(const CVector3f& min, const CVector3f& max) : min(min), max(max) {}
|
CAABox(const CVector3f& min, const CVector3f& max) : min(min), max(max) {}
|
||||||
|
|
||||||
|
CAABox(float min, float max) : min(CVector3f(min)), max(CVector3f(max)) {}
|
||||||
|
|
||||||
CAABox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
|
CAABox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
|
||||||
: min(minX, minY, minZ), max(maxX, maxY, maxZ)
|
: min(minX, minY, minZ), max(maxX, maxY, maxZ)
|
||||||
{
|
{
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CVector2f(float xy) { splat(xy); }
|
explicit CVector2f(float xy) { splat(xy); }
|
||||||
void assign(float x, float y)
|
void assign(float x, float y)
|
||||||
{
|
{
|
||||||
v[0] = x;
|
v[0] = x;
|
||||||
|
@ -262,7 +262,7 @@ public:
|
||||||
{
|
{
|
||||||
float mag = magnitude();
|
float mag = magnitude();
|
||||||
mag = 1.f / mag;
|
mag = 1.f / mag;
|
||||||
*this *= mag;
|
*this *= CVector2f(mag);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CVector2f normalized() const
|
inline CVector2f normalized() const
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CVector3d(double xyz) { splat(xyz); }
|
explicit CVector3d(double xyz) { splat(xyz); }
|
||||||
|
|
||||||
CVector3d(const CVector3f& vec)
|
CVector3d(const CVector3f& vec)
|
||||||
{
|
{
|
||||||
|
@ -63,11 +63,7 @@ public:
|
||||||
|
|
||||||
CVector3f asCVector3f()
|
CVector3f asCVector3f()
|
||||||
{
|
{
|
||||||
CVector3f ret;
|
return CVector3f(float(x), float(y), float(z));
|
||||||
ret.x = float(x);
|
|
||||||
ret.y = float(y);
|
|
||||||
ret.z = float(z);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double magSquared() const
|
double magSquared() const
|
||||||
|
|
|
@ -89,7 +89,7 @@ public:
|
||||||
|
|
||||||
CVector3f(const CVector3d& vec);
|
CVector3f(const CVector3d& vec);
|
||||||
|
|
||||||
CVector3f(float xyz) { splat(xyz); }
|
explicit CVector3f(float xyz) { splat(xyz); }
|
||||||
void assign(float x, float y, float z)
|
void assign(float x, float y, float z)
|
||||||
{
|
{
|
||||||
v[0] = x;
|
v[0] = x;
|
||||||
|
@ -261,7 +261,7 @@ public:
|
||||||
{
|
{
|
||||||
float mag = magnitude();
|
float mag = magnitude();
|
||||||
mag = 1.f / mag;
|
mag = 1.f / mag;
|
||||||
*this *= mag;
|
*this *= CVector3f(mag);
|
||||||
}
|
}
|
||||||
inline CVector3f normalized() const
|
inline CVector3f normalized() const
|
||||||
{
|
{
|
||||||
|
@ -354,7 +354,7 @@ public:
|
||||||
|
|
||||||
length = std::sqrt(length);
|
length = std::sqrt(length);
|
||||||
float scalar = newLength / length;
|
float scalar = newLength / length;
|
||||||
*this *= scalar;
|
*this *= CVector3f(scalar);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline CVector3f scaledToLength(float newLength) const
|
inline CVector3f scaledToLength(float newLength) const
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CVector4f(float xyzw) { splat(xyzw); }
|
explicit CVector4f(float xyzw) { splat(xyzw); }
|
||||||
void assign(float x, float y, float z, float w)
|
void assign(float x, float y, float z, float w)
|
||||||
{
|
{
|
||||||
v[0] = x;
|
v[0] = x;
|
||||||
|
@ -299,7 +299,7 @@ public:
|
||||||
{
|
{
|
||||||
float mag = magnitude();
|
float mag = magnitude();
|
||||||
mag = 1.f / mag;
|
mag = 1.f / mag;
|
||||||
*this *= mag;
|
*this *= CVector4f(mag);
|
||||||
}
|
}
|
||||||
inline CVector4f normalized() const
|
inline CVector4f normalized() const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue