Add clip-space constructor for CVector4f

This commit is contained in:
Jack Andersen 2018-06-23 15:01:02 -10:00
parent 8a062453ef
commit 1347e23597
2 changed files with 14 additions and 0 deletions

View File

@ -117,6 +117,13 @@ public:
return xfVec.toVec3f() / xfVec.w; 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 { union {
float m[4][4]; float m[4][4];
struct struct

View File

@ -89,6 +89,13 @@ public:
w = 1.0f; 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 inline CVector3f toVec3f() const
{ {
#if __SSE__ #if __SSE__