Skip to content

Commit 0fad211

Browse files
authored
XMFLOAT3X4 data type and load/store functions (#71)
1 parent 9226cd4 commit 0fad211

File tree

3 files changed

+374
-2
lines changed

3 files changed

+374
-2
lines changed

Inc/DirectXMath.h

Lines changed: 61 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ struct XMFLOAT3X3
748748
};
749749

750750
//------------------------------------------------------------------------------
751-
// 4x3 Matrix: 32 bit floating point components
751+
// 4x3 Row-major Matrix: 32 bit floating point components
752752
struct XMFLOAT4X3
753753
{
754754
union
@@ -761,6 +761,7 @@ struct XMFLOAT4X3
761761
float _41, _42, _43;
762762
};
763763
float m[4][3];
764+
float f[12];
764765
};
765766

766767
XMFLOAT4X3() = default;
@@ -785,7 +786,7 @@ struct XMFLOAT4X3
785786
float& operator() (size_t Row, size_t Column) { return m[Row][Column]; }
786787
};
787788

788-
// 4x3 Matrix: 32 bit floating point components aligned on a 16 byte boundary
789+
// 4x3 Row-major Matrix: 32 bit floating point components aligned on a 16 byte boundary
789790
__declspec(align(16)) struct XMFLOAT4X3A : public XMFLOAT4X3
790791
{
791792
XMFLOAT4X3A() = default;
@@ -804,6 +805,60 @@ __declspec(align(16)) struct XMFLOAT4X3A : public XMFLOAT4X3
804805
explicit XMFLOAT4X3A(_In_reads_(12) const float *pArray) : XMFLOAT4X3(pArray) {}
805806
};
806807

808+
//------------------------------------------------------------------------------
809+
// 3x4 Column-major Matrix: 32 bit floating point components
810+
struct XMFLOAT3X4
811+
{
812+
union
813+
{
814+
struct
815+
{
816+
float _11, _12, _13, _14;
817+
float _21, _22, _23, _24;
818+
float _31, _32, _33, _34;
819+
};
820+
float m[3][4];
821+
float f[12];
822+
};
823+
824+
XMFLOAT3X4() = default;
825+
826+
XMFLOAT3X4(const XMFLOAT3X4&) = default;
827+
XMFLOAT3X4& operator=(const XMFLOAT3X4&) = default;
828+
829+
XMFLOAT3X4(XMFLOAT3X4&&) = default;
830+
XMFLOAT3X4& operator=(XMFLOAT3X4&&) = default;
831+
832+
XM_CONSTEXPR XMFLOAT3X4(float m00, float m01, float m02, float m03,
833+
float m10, float m11, float m12, float m13,
834+
float m20, float m21, float m22, float m23)
835+
: _11(m00), _12(m01), _13(m02), _14(m03),
836+
_21(m10), _22(m11), _23(m12), _24(m13),
837+
_31(m20), _32(m21), _33(m22), _34(m23) {}
838+
explicit XMFLOAT3X4(_In_reads_(12) const float *pArray);
839+
840+
float operator() (size_t Row, size_t Column) const { return m[Row][Column]; }
841+
float& operator() (size_t Row, size_t Column) { return m[Row][Column]; }
842+
};
843+
844+
// 3x4 Column-major Matrix: 32 bit floating point components aligned on a 16 byte boundary
845+
__declspec(align(16)) struct XMFLOAT3X4A : public XMFLOAT3X4
846+
{
847+
XMFLOAT3X4A() = default;
848+
849+
XMFLOAT3X4A(const XMFLOAT3X4A&) = default;
850+
XMFLOAT3X4A& operator=(const XMFLOAT3X4A&) = default;
851+
852+
XMFLOAT3X4A(XMFLOAT3X4A&&) = default;
853+
XMFLOAT3X4A& operator=(XMFLOAT3X4A&&) = default;
854+
855+
XM_CONSTEXPR XMFLOAT3X4A(float m00, float m01, float m02, float m03,
856+
float m10, float m11, float m12, float m13,
857+
float m20, float m21, float m22, float m23) :
858+
XMFLOAT3X4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23) {}
859+
explicit XMFLOAT3X4A(_In_reads_(12) const float *pArray) : XMFLOAT3X4(pArray) {}
860+
};
861+
807862
//------------------------------------------------------------------------------
808863
// 4x4 Matrix: 32 bit floating point components
809864
struct XMFLOAT4X4
@@ -923,6 +978,8 @@ XMVECTOR XM_CALLCONV XMLoadUInt4(_In_ const XMUINT4* pSource);
923978
XMMATRIX XM_CALLCONV XMLoadFloat3x3(_In_ const XMFLOAT3X3* pSource);
924979
XMMATRIX XM_CALLCONV XMLoadFloat4x3(_In_ const XMFLOAT4X3* pSource);
925980
XMMATRIX XM_CALLCONV XMLoadFloat4x3A(_In_ const XMFLOAT4X3A* pSource);
981+
XMMATRIX XM_CALLCONV XMLoadFloat3x4(_In_ const XMFLOAT3X4* pSource);
982+
XMMATRIX XM_CALLCONV XMLoadFloat3x4A(_In_ const XMFLOAT3X4A* pSource);
926983
XMMATRIX XM_CALLCONV XMLoadFloat4x4(_In_ const XMFLOAT4X4* pSource);
927984
XMMATRIX XM_CALLCONV XMLoadFloat4x4A(_In_ const XMFLOAT4X4A* pSource);
928985

@@ -959,6 +1016,8 @@ void XM_CALLCONV XMStoreUInt4(_Out_ XMUINT4* pDestination, _In_ FXMVE
9591016
void XM_CALLCONV XMStoreFloat3x3(_Out_ XMFLOAT3X3* pDestination, _In_ FXMMATRIX M);
9601017
void XM_CALLCONV XMStoreFloat4x3(_Out_ XMFLOAT4X3* pDestination, _In_ FXMMATRIX M);
9611018
void XM_CALLCONV XMStoreFloat4x3A(_Out_ XMFLOAT4X3A* pDestination, _In_ FXMMATRIX M);
1019+
void XM_CALLCONV XMStoreFloat3x4(_Out_ XMFLOAT3X4* pDestination, _In_ FXMMATRIX M);
1020+
void XM_CALLCONV XMStoreFloat3x4A(_Out_ XMFLOAT3X4A* pDestination, _In_ FXMMATRIX M);
9621021
void XM_CALLCONV XMStoreFloat4x4(_Out_ XMFLOAT4X4* pDestination, _In_ FXMMATRIX M);
9631022
void XM_CALLCONV XMStoreFloat4x4A(_Out_ XMFLOAT4X4A* pDestination, _In_ FXMMATRIX M);
9641023

0 commit comments

Comments
 (0)