Issue-1169: fix [] operator of vector3.
parent
2afeddd5cb
commit
695439fad0
|
@ -125,6 +125,12 @@ public:
|
||||||
* @param o Second factor */
|
* @param o Second factor */
|
||||||
const aiVector3t SymMul(const aiVector3t& o);
|
const aiVector3t SymMul(const aiVector3t& o);
|
||||||
|
|
||||||
|
/*union vector3 {
|
||||||
|
TReal values[3];
|
||||||
|
struct {
|
||||||
|
TReal x, y, z;
|
||||||
|
};
|
||||||
|
};*/
|
||||||
TReal x, y, z;
|
TReal x, y, z;
|
||||||
} PACK_STRUCT;
|
} PACK_STRUCT;
|
||||||
|
|
||||||
|
@ -143,8 +149,6 @@ struct aiVector3D {
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // AI_VECTOR3D_H_INC
|
#endif // AI_VECTOR3D_H_INC
|
||||||
|
|
|
@ -141,12 +141,34 @@ AI_FORCE_INLINE aiVector3t<TReal>& aiVector3t<TReal>::operator *= (const aiMatri
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
template <typename TReal>
|
template <typename TReal>
|
||||||
AI_FORCE_INLINE TReal aiVector3t<TReal>::operator[](unsigned int i) const {
|
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>
|
template <typename TReal>
|
||||||
AI_FORCE_INLINE TReal& aiVector3t<TReal>::operator[](unsigned int i) {
|
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>
|
template <typename TReal>
|
||||||
|
|
Loading…
Reference in New Issue