Quellcode durchsuchen

Datatypes: add missing unions for vector + color types.

Kim Kulling vor 9 Jahren
Ursprung
Commit
59ece7b9fa
3 geänderte Dateien mit 37 neuen und 7 gelöschten Zeilen
  1. 12 2
      include/assimp/color4.h
  2. 13 2
      include/assimp/vector2.h
  3. 12 3
      include/assimp/vector3.h

+ 12 - 2
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<float> aiColor4D;
@@ -94,7 +99,12 @@ typedef aiColor4t<float> aiColor4D;
 #else
 
 struct aiColor4D {
-    float r, g, b, a;
+    union {
+        struct {
+            float r, g, b, a;
+        };
+        float c[ 4 ];
+    };
 } PACK_STRUCT;
 
 #endif // __cplusplus

+ 13 - 2
include/assimp/vector2.h

@@ -95,7 +95,13 @@ public:
     template <typename TOther>
     operator aiVector2t<TOther> () const;
 
-    TReal x, y;
+    union {
+        struct {
+            TReal x, y;
+        };
+        TReal v[ 2 ];
+    };
+
 } PACK_STRUCT;
 
 typedef aiVector2t<float> aiVector2D;
@@ -103,7 +109,12 @@ typedef aiVector2t<float> aiVector2D;
 #else
 
 struct aiVector2D {
-    float x,y;
+    union {
+        struct {
+            float x, y;
+        };
+        float v[ 2 ];
+    };
 };
 
 #endif // __cplusplus

+ 12 - 3
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<float> aiVector3D;
 #else
 
 struct aiVector3D {
-
-    float x,y,z;
+    union {
+        struct {
+            float x, y, z;
+        };
+        float v[ 3 ];
+    };
 } PACK_STRUCT;
 
 #endif // __cplusplus