mirror of https://github.com/AxioDL/zeus.git
Make vector constants class-scope
This commit is contained in:
parent
6f215040f4
commit
69627f4bf3
|
@ -224,7 +224,7 @@ public:
|
|||
return skNoRotation;
|
||||
|
||||
CRelAngle realAngle = zeus::clamp<CRelAngle>(-c, normalize_angle(std::acos(up.z) - std::acos(target.z)), c);
|
||||
return CQuaternion::fromAxisAngle(tmp.cross(kUpVec), realAngle) * q;
|
||||
return CQuaternion::fromAxisAngle(tmp.cross(CVector3f::skUp), realAngle) * q;
|
||||
}
|
||||
|
||||
CVector3f transform(const CVector3f& v) const { return rotate(*this, v); }
|
||||
|
|
|
@ -266,7 +266,7 @@ static inline CTransform CTransformFromScaleVector(const CVector3f& scale) { ret
|
|||
CTransform CTransformFromEditorEuler(const CVector3f& eulerVec);
|
||||
CTransform CTransformFromEditorEulers(const CVector3f& eulerVec, const CVector3f& origin);
|
||||
CTransform CTransformFromAxisAngle(const CVector3f& axis, float angle);
|
||||
CTransform lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up = kUpVec);
|
||||
CTransform lookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up = CVector3f::skUp);
|
||||
}
|
||||
|
||||
#endif // CTRANSFORM_HPP
|
||||
|
|
|
@ -382,6 +382,17 @@ public:
|
|||
static const CVector3f skOne;
|
||||
static const CVector3f skNegOne;
|
||||
static const CVector3f skZero;
|
||||
static const CVector3f skForward;
|
||||
static const CVector3f skBack;
|
||||
static const CVector3f skLeft;
|
||||
static const CVector3f skRight;
|
||||
static const CVector3f skUp;
|
||||
static const CVector3f skDown;
|
||||
static const CVector3f skRadToDegVec;
|
||||
static const CVector3f skDegToRadVec;
|
||||
|
||||
static CVector3f radToDeg(const CVector3f& rad) { return rad * skRadToDegVec; }
|
||||
static CVector3f degToRad(const CVector3f& deg) { return deg * skDegToRadVec; }
|
||||
};
|
||||
|
||||
static inline CVector3f operator+(float lhs, const CVector3f& rhs)
|
||||
|
@ -424,16 +435,6 @@ static inline CVector3f operator/(float lhs, const CVector3f& rhs)
|
|||
#endif
|
||||
}
|
||||
|
||||
extern const CVector3f kUpVec;
|
||||
extern const CVector3f kDownVec;
|
||||
extern const CVector3f kRightVec;
|
||||
extern const CVector3f kLeftVec;
|
||||
extern const CVector3f kForwardVec;
|
||||
extern const CVector3f kBackVec;
|
||||
extern const CVector3f kRadToDegVec;
|
||||
extern const CVector3f kDegToRadVec;
|
||||
inline CVector3f radToDeg(const CVector3f& rad) { return rad * kRadToDegVec; }
|
||||
inline CVector3f degToRad(const CVector3f& deg) { return deg * kDegToRadVec; }
|
||||
}
|
||||
|
||||
#endif // CVECTOR3F_HPP
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
|
||||
namespace zeus
|
||||
{
|
||||
const CVector3f CVector3f::skOne = CVector3f(1.f);
|
||||
const CVector3f CVector3f::skNegOne = CVector3f(-1.f);
|
||||
const CVector3f CVector3f::skOne(1.f);
|
||||
const CVector3f CVector3f::skNegOne(-1.f);
|
||||
const CVector3f CVector3f::skZero;
|
||||
const CVector3f CVector3f::skForward(0.f, 1.f, 0.f);
|
||||
const CVector3f CVector3f::skBack(0.f, -1.f, 0.f);
|
||||
const CVector3f CVector3f::skLeft(-1.f, 0.f, 0.f);
|
||||
const CVector3f CVector3f::skRight(1.f, 0.f, 0.f);
|
||||
const CVector3f CVector3f::skUp(0.f, 0.f, 1.f);
|
||||
const CVector3f CVector3f::skDown(0.f, 0.f, -1.f);
|
||||
const CVector3f CVector3f::skRadToDegVec(180.0f / M_PIF);
|
||||
const CVector3f CVector3f::skDegToRadVec(M_PIF / 180.0f);
|
||||
|
||||
const CVector3f kUpVec(0.f, 0.f, 1.f);
|
||||
const CVector3f kDownVec(0.f, 0.f, -1.f);
|
||||
const CVector3f kForwardVec(0.f, 1.f, 0.f);
|
||||
const CVector3f kBackVec(0.f, -1.f, 0.f);
|
||||
const CVector3f kRightVec(1.f, 0.f, 0.f);
|
||||
const CVector3f kLeftVec(-1.f, 0.f, 0.f);
|
||||
const CVector3f kRadToDegVec(180.0f / M_PIF);
|
||||
const CVector3f kDegToRadVec(M_PIF / 180.0f);
|
||||
|
||||
float CVector3f::getAngleDiff(const CVector3f& a, const CVector3f& b)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue