SSE2: More alignment workarounds

--HG--
branch : sse2
hg/feature/sse2
kaetemi 11 years ago
parent 35737498b5
commit 00b8ad4c91

@ -43,7 +43,7 @@ template <>
inline CPlaneBasis PSBinOpModulate(const CPlaneBasis &p1, const CPlaneBasis &p2)
{
// we compute p1 * p2
NLMISC::CVector z = p1.X ^ p1.Y;
NLMISC::CVector z = CVector(p1.X) ^ CVector(p1.Y);
CPlaneBasis r;
r.X.x = p2.X.x * p1.X.x + p2.X.y * p1.Y.x + p2.X.z * z.x;
r.X.y = p2.X.x * p1.X.y + p2.X.y * p1.Y.y + p2.X.z * z.y;

@ -37,8 +37,8 @@ namespace NL3D {
struct CPlaneBasis
{
NLMISC::CVector X ;
NLMISC::CVector Y ;
NLMISC::CVectorPacked X ;
NLMISC::CVectorPacked Y ;
// default ctor
@ -62,7 +62,7 @@ struct CPlaneBasis
/// compute the normal of the plane basis
NLMISC::CVector getNormal(void) const
{
return X ^ Y ;
return CVector(X) ^ CVector(Y) ;
}

@ -212,6 +212,34 @@ public:
{
return CVector(*this) - v;
}
bool operator==(const CVectorPacked &v) const
{
return x==v.x && y==v.y && z==v.z;
}
bool operator!=(const CVectorPacked &v) const
{
return !(*this==v);
}
bool operator<(const CVectorPacked &v) const
{
if(x!=v.x)
return x<v.x;
if(y!=v.y)
return y<v.y;
return z<v.z;
}
CVector operator^(const CVector &v) const
{
CVector ret;
ret.x= y*v.z - z*v.y;
ret.y= z*v.x - x*v.z;
ret.z= x*v.y - y*v.x;
return ret;
}
};
// blend (faster version than the generic version found in algo.h)

@ -404,8 +404,8 @@ void CPSMesh::updatePos()
mat.setRot( ptBasis->X * CPSUtil::getCos((sint32) *ptCurrAngle) + ptBasis->Y * CPSUtil::getSin((sint32) *ptCurrAngle)
, ptBasis->X * CPSUtil::getCos((sint32) *ptCurrAngle + 64) + ptBasis->Y * CPSUtil::getSin((sint32) *ptCurrAngle + 64)
mat.setRot( CVector(ptBasis->X) * CPSUtil::getCos((sint32) *ptCurrAngle) + CVector(ptBasis->Y) * CPSUtil::getSin((sint32) *ptCurrAngle)
, CVector(ptBasis->X) * CPSUtil::getCos((sint32) *ptCurrAngle + 64) + CVector(ptBasis->Y) * CPSUtil::getSin((sint32) *ptCurrAngle + 64)
, ptBasis->X ^ ptBasis->Y
);

Loading…
Cancel
Save