Merge pull request #1698 from ombre5733/patch-2
Clarify the matrix layout in the documentationpull/1699/head^2
commit
7c16a589e7
22
doc/dox.h
22
doc/dox.h
|
@ -561,17 +561,27 @@ The output UV coordinate system has its origin in the lower-left corner:
|
||||||
@endcode
|
@endcode
|
||||||
Use the #aiProcess_FlipUVs flag to get UV coordinates with the upper-left corner als origin.
|
Use the #aiProcess_FlipUVs flag to get UV coordinates with the upper-left corner als origin.
|
||||||
|
|
||||||
All matrices in the library are row-major. That means that the matrices are stored row by row in memory,
|
A typical 4x4 matrix including a translational part looks like this:
|
||||||
which is similar to the OpenGL matrix layout. A typical 4x4 matrix including a translational part looks like this:
|
|
||||||
@code
|
@code
|
||||||
X1 Y1 Z1 T1
|
X1 Y1 Z1 T1
|
||||||
X2 Y2 Z2 T2
|
X2 Y2 Z2 T2
|
||||||
X3 Y3 Z3 T3
|
X3 Y3 Z3 T3
|
||||||
0 0 0 1
|
0 0 0 1
|
||||||
@endcode
|
@endcode
|
||||||
with (X1, X2, X3) being the X base vector, (Y1, Y2, Y3) being the Y base vector, (Z1, Z2, Z3)
|
with <tt>(X1, X2, X3)</tt> being the local X base vector, <tt>(Y1, Y2, Y3)</tt> being the local
|
||||||
being the Z base vector and (T1, T2, T3) being the translation part. If you want to use these matrices
|
Y base vector, <tt>(Z1, Z2, Z3)</tt> being the local Z base vector and <tt>(T1, T2, T3)</tt> being the
|
||||||
in DirectX functions, you have to transpose them.
|
offset of the local origin (the translational part).
|
||||||
|
All matrices in the library use row-major storage order. That means that the matrix elements are
|
||||||
|
stored row-by-row, i.e. they end up like this in memory:
|
||||||
|
<tt>[X1, Y1, Z1, T1, X2, Y2, Z2, T2, X3, Y3, Z3, T3, 0, 0, 0, 1]</tt>.
|
||||||
|
|
||||||
|
Note that this is neither the OpenGL format nor the DirectX format, because both of them specify the
|
||||||
|
matrix layout such that the translational part occupies three consecutive addresses in memory (so those
|
||||||
|
matrices end with <tt>[..., T1, T2, T3, 1]</tt>), whereas the translation in an Assimp matrix is found at
|
||||||
|
the offsets 3, 7 and 11 (spread across the matrix). You can transpose an Assimp matrix to end up with
|
||||||
|
the format that OpenGL and DirectX mandate. To be very precise: The transposition has nothing
|
||||||
|
to do with a left-handed or right-handed coordinate system but 'converts' between row-major and
|
||||||
|
column-major storage format.
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue