aiMatrix4x4 confirmation

Avithohol
2013-10-21
2013-11-02
  • Avithohol

    Avithohol - 2013-10-21

    Hello,

    could you please just a help a little with the variable names in the aiMatrix4x4 class?

    I see the class has the following member variables, these are the elements of the matrix itself.

    TReal a1, a2, a3, a4;
    TReal b1, b2, b3, b4;
    TReal c1, c2, c3, c4;
    TReal d1, d2, d3, d4;
    

    The documentation (http://assimp.sourceforge.net/lib_html/data.html)
    says: "All matrices in the library are row-major."

    So if I am a guy who uses Direct3D (prefers row major matrix) and wish to lay out those variables in a continuous array,
    then I should do this:

    float myRowMajorMatrix[] = { a1,a2,a3,a4, b1,b2,b3,b3, c1,c2,c3,c4, d1,d2,d3,d4 };

    but if I am guy who uses OpenGL (prefers column major matrix) and wish to lay out those variables in a continuous array,
    then I should do this:

    float myColumnMajor[] = { a1,b1,c1,d1, a2,b2,c2,d2, a3,b3,c3,d3, a4,b4,c4,d4 };

    Could you please confirm that these two layouts are correct as it?

    Thank you for your time for both reading and creating this awesome lib :) !
    A

     
  • Thomas Ziegenhagen

    Yes, it should be like this. At least I think so, because Direct3D itsself wants you to transpose the matrix sometimes before uploading to the shader :)

     
  • Avithohol

    Avithohol - 2013-11-02

    Thank You Thomas!
    Meanwhile I just fiddled with it, and I can confirm its working as described above (at least the opengl one).

    Cheers
    A

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks