Ticket #1854: 0001-Simplify-the-construction-of-the-transformation-matr.patch

File 0001-Simplify-the-construction-of-the-transformation-matr.patch, 1.3 KB (added by sbte, 11 years ago)

Transformation matrix patch

  • source/simulation2/components/CCmpPosition.cpp

    From 894a0da322902c30444fdf5e6aaf44703d5e0cd6 Mon Sep 17 00:00:00 2001
    From: "Sven (Sbte)" <svenb.linux@gmail.com>
    Date: Wed, 6 Mar 2013 21:53:04 +0100
    Subject: Simplify the construction of the transformation matrix in
     GetInterpolatedTransform
    
    ---
     source/simulation2/components/CCmpPosition.cpp | 23 ++++++-----------------
     1 file changed, 6 insertions(+), 17 deletions(-)
    
    diff --git a/source/simulation2/components/CCmpPosition.cpp b/source/simulation2/components/CCmpPosition.cpp
    index 97110dc..33e249d 100644
    a b public:  
    404404
    405405        // TODO: do something with m_AnchorType
    406406
    407         CMatrix3D m;
    408         CMatrix3D mXZ;
    409         float Cos = cosf(rotY);
    410         float Sin = sinf(rotY);
    411 
    412         m.SetIdentity();
    413         m._11 = -Cos;
    414         m._13 = -Sin;
    415         m._31 = Sin;
    416         m._33 = -Cos;
    417 
    418         mXZ.SetIdentity();
    419         mXZ.SetXRotation(m_RotX.ToFloat());
    420         mXZ.RotateZ(m_RotZ.ToFloat());
    421407        // TODO: is this all done in the correct order?
    422         mXZ = m * mXZ;
    423         mXZ.Translate(CVector3D(x, y, z));
     408        CMatrix3D m;
     409        m.SetXRotation(m_RotX.ToFloat());
     410        m.RotateZ(m_RotZ.ToFloat());
     411        m.RotateY(rotY + (float)M_PI);
     412        m.Translate(CVector3D(x, y, z));
    424413
    425         return mXZ;
     414        return m;
    426415    }
    427416
    428417    virtual void HandleMessage(const CMessage& msg, bool UNUSED(global))