Exemple #1
0
    /// <summary>
    /// Returns the transposed of the matrix
    /// </summary>
    public SLMat4f Transposed()
    {
        SLMat4f t = new SLMat4f(this);

        t.Transpose();
        return(t);
    }
Exemple #2
0
    /// <summary>
    /// Retrieves the camera vectors eye, at and up if this matrix would be a view matrix
    /// </summary>
    /// <param name="Eye"></param>
    /// <param name="At"></param>
    /// <param name="Up"></param>
    public void GetLookAt(ref SLVec3f Eye, ref SLVec3f At, ref SLVec3f Up)
    {
        SLMat4f invRot      = new SLMat4f(this);
        SLVec3f translation = new SLVec3f(m[12], m[13], m[14]);

        invRot.m[12] = 0;
        invRot.m[13] = 0;
        invRot.m[14] = 0;
        invRot.Transpose();
        Eye.Set(invRot.Multiply(-translation)); // vector to the eye
        Up.Set(m[1], m[5], m[9]);               // normalized look up vector
        At.Set(-m[2], -m[6], -m[10]);           // normalized look at vector
    }