Hello Guys,
I'm using scharpDX 4, and wonder why the matrix class uses row_major matrixes, because HLSL uses column_major
Can anyone tell me if there is a specific reason why the matrix class uses exactly the wrong matrix order?
Hello Guys,
I'm using scharpDX 4, and wonder why the matrix class uses row_major matrixes, because HLSL uses column_major
Can anyone tell me if there is a specific reason why the matrix class uses exactly the wrong matrix order?
HLSL can use any ordering that you specify. Last I checked, though this may be a more recent feature, you can specify the row_major keyword in your shader code. Insofar as why is a hand-wavy, "Historical reasons". Generally 2D Arrays are stored in row_major on the CPU side, so my guess is they just kept with that convention.
It's not a wrong ordering, it's a perfectly valid one, and iirc, it's more efficient to work with a row_major organized data-construct for looping on the cpu side if you plan to modify the matrices sub-elements e.g., but it is a different ordering, and ultimately one you want to be aware of in D3D in particular.