Merge branch 'master' into iosystem-patch

This commit is contained in:
Kim Kulling
2017-12-18 08:59:14 +01:00
committed by GitHub
28 changed files with 301 additions and 101 deletions

View File

@@ -491,7 +491,7 @@ struct aiUVTransform
}
#endif
} PACK_STRUCT;
};
#include "./Compiler/poppack1.h"

View File

@@ -85,7 +85,6 @@ public:
const aiVector2t& operator /= (TReal f);
TReal operator[](unsigned int i) const;
TReal& operator[](unsigned int i);
bool operator== (const aiVector2t& other) const;
bool operator!= (const aiVector2t& other) const;
@@ -99,7 +98,7 @@ public:
operator aiVector2t<TOther> () const;
TReal x, y;
} PACK_STRUCT;
};
typedef aiVector2t<ai_real> aiVector2D;

View File

@@ -60,24 +60,28 @@ aiVector2t<TReal>::operator aiVector2t<TOther> () const {
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
void aiVector2t<TReal>::Set( TReal pX, TReal pY) {
x = pX; y = pY;
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
TReal aiVector2t<TReal>::SquareLength() const {
return x*x + y*y;
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
TReal aiVector2t<TReal>::Length() const {
return std::sqrt( SquareLength());
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
aiVector2t<TReal>& aiVector2t<TReal>::Normalize() {
*this /= Length();
return *this;
@@ -85,6 +89,7 @@ aiVector2t<TReal>& aiVector2t<TReal>::Normalize() {
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
const aiVector2t<TReal>& aiVector2t<TReal>::operator += (const aiVector2t& o) {
x += o.x; y += o.y;
return *this;
@@ -92,6 +97,7 @@ const aiVector2t<TReal>& aiVector2t<TReal>::operator += (const aiVector2t& o) {
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
const aiVector2t<TReal>& aiVector2t<TReal>::operator -= (const aiVector2t& o) {
x -= o.x; y -= o.y;
return *this;
@@ -99,6 +105,7 @@ const aiVector2t<TReal>& aiVector2t<TReal>::operator -= (const aiVector2t& o) {
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
const aiVector2t<TReal>& aiVector2t<TReal>::operator *= (TReal f) {
x *= f; y *= f;
return *this;
@@ -106,6 +113,7 @@ const aiVector2t<TReal>& aiVector2t<TReal>::operator *= (TReal f) {
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
const aiVector2t<TReal>& aiVector2t<TReal>::operator /= (TReal f) {
x /= f; y /= f;
return *this;
@@ -113,30 +121,37 @@ const aiVector2t<TReal>& aiVector2t<TReal>::operator /= (TReal f) {
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
TReal aiVector2t<TReal>::operator[](unsigned int i) const {
return *(&x + i);
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
TReal& aiVector2t<TReal>::operator[](unsigned int i) {
return *(&x + i);
switch (i) {
case 0:
return x;
case 1:
return y;
default:
break;
}
return x;
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
bool aiVector2t<TReal>::operator== (const aiVector2t& other) const {
return x == other.x && y == other.y;
}
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
bool aiVector2t<TReal>::operator!= (const aiVector2t& other) const {
return x != other.x || y != other.y;
}
// ---------------------------------------------------------------------------
template<typename TReal>
inline
bool aiVector2t<TReal>::Equal(const aiVector2t& other, TReal epsilon) const {
return
std::abs(x - other.x) <= epsilon &&
@@ -145,6 +160,7 @@ bool aiVector2t<TReal>::Equal(const aiVector2t& other, TReal epsilon) const {
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
aiVector2t<TReal>& aiVector2t<TReal>::operator= (TReal f) {
x = y = f;
return *this;
@@ -152,6 +168,7 @@ aiVector2t<TReal>& aiVector2t<TReal>::operator= (TReal f) {
// ------------------------------------------------------------------------------------------------
template <typename TReal>
inline
const aiVector2t<TReal> aiVector2t<TReal>::SymMul(const aiVector2t& o) {
return aiVector2t(x*o.x,y*o.y);
}
@@ -160,65 +177,64 @@ const aiVector2t<TReal> aiVector2t<TReal>::SymMul(const aiVector2t& o) {
// ------------------------------------------------------------------------------------------------
// symmetric addition
template <typename TReal>
inline aiVector2t<TReal> operator + (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2)
{
inline
aiVector2t<TReal> operator + (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2) {
return aiVector2t<TReal>( v1.x + v2.x, v1.y + v2.y);
}
// ------------------------------------------------------------------------------------------------
// symmetric subtraction
template <typename TReal>
inline aiVector2t<TReal> operator - (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2)
{
inline
aiVector2t<TReal> operator - (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2) {
return aiVector2t<TReal>( v1.x - v2.x, v1.y - v2.y);
}
// ------------------------------------------------------------------------------------------------
// scalar product
template <typename TReal>
inline TReal operator * (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2)
{
inline
TReal operator * (const aiVector2t<TReal>& v1, const aiVector2t<TReal>& v2) {
return v1.x*v2.x + v1.y*v2.y;
}
// ------------------------------------------------------------------------------------------------
// scalar multiplication
template <typename TReal>
inline aiVector2t<TReal> operator * ( TReal f, const aiVector2t<TReal>& v)
{
inline
aiVector2t<TReal> operator * ( TReal f, const aiVector2t<TReal>& v) {
return aiVector2t<TReal>( f*v.x, f*v.y);
}
// ------------------------------------------------------------------------------------------------
// and the other way around
template <typename TReal>
inline aiVector2t<TReal> operator * ( const aiVector2t<TReal>& v, TReal f)
{
inline
aiVector2t<TReal> operator * ( const aiVector2t<TReal>& v, TReal f) {
return aiVector2t<TReal>( f*v.x, f*v.y);
}
// ------------------------------------------------------------------------------------------------
// scalar division
template <typename TReal>
inline aiVector2t<TReal> operator / ( const aiVector2t<TReal>& v, TReal f)
{
inline
aiVector2t<TReal> operator / ( const aiVector2t<TReal>& v, TReal f) {
return v * (1/f);
}
// ------------------------------------------------------------------------------------------------
// vector division
template <typename TReal>
inline aiVector2t<TReal> operator / ( const aiVector2t<TReal>& v, const aiVector2t<TReal>& v2)
{
inline
aiVector2t<TReal> operator / ( const aiVector2t<TReal>& v, const aiVector2t<TReal>& v2) {
return aiVector2t<TReal>(v.x / v2.x,v.y / v2.y);
}
// ------------------------------------------------------------------------------------------------
// vector negation
template <typename TReal>
inline aiVector2t<TReal> operator - ( const aiVector2t<TReal>& v)
{
inline
aiVector2t<TReal> operator - ( const aiVector2t<TReal>& v) {
return aiVector2t<TReal>( -v.x, -v.y);
}

View File

@@ -142,7 +142,6 @@ 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);
switch (i) {
case 0:
return x;