Closed carmineos closed 3 years ago
System.Numerics.Matrix4x4 is row-major, although DataReader/DataWriter reads/writes the matrix as a colum-major one by reading the floats 1 by 1. In ReadArray/WriteArray this will break because the MemoryMarshal will follow the System.Numerics.Matrix4x4 struct layout instead. Furthermore in dev/performance branch it also breaks reading single matrices.
A temporary solution, to have at least coherent reading/writing of matrices everywhere, could be restoring the using of RAGE_Matrix4x4 wrapper which stores the values as generic four Vector4.
Some blocks seems to store 4x4 matrices in row-major order, some examples seems to be:
TODO: check all the matrices and update DataReader/DataWriter to handle both single matrices and arrays