From 59ece7b9fa10d5e437434099b43230e1dbc06b48 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 2 Feb 2016 00:59:47 +0100 Subject: [PATCH] Datatypes: add missing unions for vector + color types. --- include/assimp/color4.h | 14 ++++++++++++-- include/assimp/vector2.h | 15 +++++++++++++-- include/assimp/vector3.h | 15 ++++++++++++--- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/include/assimp/color4.h b/include/assimp/color4.h index 6bcab45df..2a2c338c8 100644 --- a/include/assimp/color4.h +++ b/include/assimp/color4.h @@ -86,7 +86,12 @@ public: public: // Red, green, blue and alpha color values - TReal r, g, b, a; + union { + struct { + TReal r, g, b, a; + }; + TReal c[ 4 ]; + }; } PACK_STRUCT; // !struct aiColor4D typedef aiColor4t aiColor4D; @@ -94,7 +99,12 @@ typedef aiColor4t aiColor4D; #else struct aiColor4D { - float r, g, b, a; + union { + struct { + float r, g, b, a; + }; + float c[ 4 ]; + }; } PACK_STRUCT; #endif // __cplusplus diff --git a/include/assimp/vector2.h b/include/assimp/vector2.h index d9901a390..2342f1ebd 100644 --- a/include/assimp/vector2.h +++ b/include/assimp/vector2.h @@ -95,7 +95,13 @@ public: template operator aiVector2t () const; - TReal x, y; + union { + struct { + TReal x, y; + }; + TReal v[ 2 ]; + }; + } PACK_STRUCT; typedef aiVector2t aiVector2D; @@ -103,7 +109,12 @@ typedef aiVector2t aiVector2D; #else struct aiVector2D { - float x,y; + union { + struct { + float x, y; + }; + float v[ 2 ]; + }; }; #endif // __cplusplus diff --git a/include/assimp/vector3.h b/include/assimp/vector3.h index d255d8ff0..0358045e3 100644 --- a/include/assimp/vector3.h +++ b/include/assimp/vector3.h @@ -125,7 +125,12 @@ public: * @param o Second factor */ const aiVector3t SymMul(const aiVector3t& o); - TReal x, y, z; + union { + struct { + TReal x, y, z; + }; + TReal v[ 3 ]; + }; } PACK_STRUCT; @@ -134,8 +139,12 @@ typedef aiVector3t aiVector3D; #else struct aiVector3D { - - float x,y,z; + union { + struct { + float x, y, z; + }; + float v[ 3 ]; + }; } PACK_STRUCT; #endif // __cplusplus