matrix scheme via union.
pull/779/head
Kim Kulling 2016-02-01 16:16:48 +01:00
parent a1bd83d797
commit aaec1656f3
2 changed files with 42 additions and 22 deletions

View File

@ -161,10 +161,15 @@ public:
public:
TReal a1, a2, a3;
TReal b1, b2, b3;
TReal c1, c2, c3;
union {
struct {
TReal a1, a2, a3;
TReal b1, b2, b3;
TReal c1, c2, c3;
};
TReal m[ 3 ][ 3 ];
TReal mData[ 9 ];
};
} PACK_STRUCT;
typedef aiMatrix3x3t<float> aiMatrix3x3;
@ -172,13 +177,18 @@ typedef aiMatrix3x3t<float> aiMatrix3x3;
#else
struct aiMatrix3x3 {
float a1, a2, a3;
float b1, b2, b3;
float c1, c2, c3;
union {
struct {
float a1, a2, a3;
float b1, b2, b3;
float c1, c2, c3;
};
float m[ 3 ][ 3 ];
float mData[ 9 ];
};
} PACK_STRUCT;
#endif
#endif // __cplusplus
#include "./Compiler/poppack1.h"

View File

@ -213,8 +213,8 @@ public:
/** @brief A function for creating a rotation matrix that rotates a
* vector called "from" into another vector called "to".
* Input : from[3], to[3] which both must be *normalized* non-zero vectors
* Output: mtx[3][3] -- a 3x3 matrix in colum-major form
* Authors: Tomas M<EFBFBD>ller, John Hughes
* Output: mtx[3][3] -- a 3x3 matrix in column-major form
* Authors: Tomas Mueller, John Hughes
* "Efficiently Building a Matrix to Rotate One Vector to Another"
* Journal of Graphics Tools, 4(4):1-4, 1999
*/
@ -222,12 +222,16 @@ public:
const aiVector3t<TReal>& to, aiMatrix4x4t& out);
public:
TReal a1, a2, a3, a4;
TReal b1, b2, b3, b4;
TReal c1, c2, c3, c4;
TReal d1, d2, d3, d4;
union {
struct {
TReal a1, a2, a3, a4;
TReal b1, b2, b3, b4;
TReal c1, c2, c3, c4;
TReal d1, d2, d3, d4;
};
TReal m[ 4 ][ 4 ];
TReal mData[ 16 ];
};
} PACK_STRUCT;
typedef aiMatrix4x4t<float> aiMatrix4x4;
@ -235,11 +239,17 @@ typedef aiMatrix4x4t<float> aiMatrix4x4;
#else
struct aiMatrix4x4 {
float a1, a2, a3, a4;
float b1, b2, b3, b4;
float c1, c2, c3, c4;
float d1, d2, d3, d4;
};
union {
struct {
float a1, a2, a3, a4;
float b1, b2, b3, b4;
float c1, c2, c3, c4;
float d1, d2, d3, d4;
};
float m[ 4 ][ 4 ];
float mData[ 16 ];
};
} PACK_STRUCT;
#endif // __cplusplus