Issue-1169: fix [] operator of vector3.

pull/1181/head
Kim Kulling 2017-02-21 10:58:27 +01:00
parent 2afeddd5cb
commit 695439fad0
3 changed files with 235 additions and 209 deletions

View File

@ -125,6 +125,12 @@ public:
* @param o Second factor */
const aiVector3t SymMul(const aiVector3t& o);
/*union vector3 {
TReal values[3];
struct {
TReal x, y, z;
};
};*/
TReal x, y, z;
} PACK_STRUCT;
@ -143,8 +149,6 @@ struct aiVector3D {
#ifdef __cplusplus
#endif // __cplusplus
#endif // AI_VECTOR3D_H_INC

View File

@ -141,12 +141,34 @@ AI_FORCE_INLINE aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatri
// ------------------------------------------------------------------------------------------------
template <typename TReal>
AI_FORCE_INLINE TReal aiVector3t<TReal>::operator[](unsigned int i) const {
return *(&x + i);
// return *(&x + i);
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
default:
break;
}
return x;
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
AI_FORCE_INLINE TReal& aiVector3t<TReal>::operator[](unsigned int i) {
return *(&x + i);
// return *(&x + i);
switch (i) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
default:
break;
}
return x;
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>