diff --git a/include/zeus/CMatrix4f.hpp b/include/zeus/CMatrix4f.hpp index c674ecd..fe98579 100644 --- a/include/zeus/CMatrix4f.hpp +++ b/include/zeus/CMatrix4f.hpp @@ -117,6 +117,13 @@ public: return xfVec.toVec3f() / xfVec.w; } + inline CVector3f multiplyOneOverW(const CVector3f& point, float& wOut) const + { + CVector4f xfVec = *this * point; + wOut = xfVec.w; + return xfVec.toVec3f() / xfVec.w; + } + union { float m[4][4]; struct diff --git a/include/zeus/CVector4f.hpp b/include/zeus/CVector4f.hpp index ff9a957..6814739 100644 --- a/include/zeus/CVector4f.hpp +++ b/include/zeus/CVector4f.hpp @@ -89,6 +89,13 @@ public: w = 1.0f; } + static CVector4f ToClip(const zeus::CVector3f& v, float w) + { + CVector4f ret(v * w); + ret.w = w; + return ret; + } + inline CVector3f toVec3f() const { #if __SSE__