Merge branch 'master' into nonascii_chars_in_fbxmaterial_cpp

pull/1644/head
Kim Kulling 2017-12-17 20:41:52 +01:00 committed by GitHub
commit 39e36371f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 42 deletions

View File

@ -415,6 +415,7 @@ void MDLImporter::InternReadFile_Quake1( )
else else
{ {
// get the first frame in the group // get the first frame in the group
#if 1 #if 1
// FIXME: the cast is wrong and causea a warning on clang 5.0 // FIXME: the cast is wrong and causea a warning on clang 5.0
// disable thi code for now, fix it later // disable thi code for now, fix it later

View File

@ -904,12 +904,14 @@ aiVector2D XGLImporter::ReadVec2()
} }
const char* s = m_reader->getNodeData(); const char* s = m_reader->getNodeData();
for(int i = 0; i < 2; ++i) { ai_real v[2];
for(int i = 0; i < 2; ++i) {
if(!SkipSpaces(&s)) { if(!SkipSpaces(&s)) {
LogError("unexpected EOL, failed to parse vec2"); LogError("unexpected EOL, failed to parse vec2");
return vec; return vec;
} }
vec[i] = fast_atof(&s);
v[i] = fast_atof(&s);
SkipSpaces(&s); SkipSpaces(&s);
if (i != 1 && *s != ',') { if (i != 1 && *s != ',') {
@ -918,6 +920,8 @@ aiVector2D XGLImporter::ReadVec2()
} }
++s; ++s;
} }
vec.x = v[0];
vec.y = v[1];
return vec; return vec;
} }

View File

@ -85,7 +85,6 @@ public:
const aiVector2t& operator /= (TReal f); const aiVector2t& operator /= (TReal f);
TReal operator[](unsigned int i) const; TReal operator[](unsigned int i) const;
TReal& operator[](unsigned int i);
bool operator== (const aiVector2t& other) const; bool operator== (const aiVector2t& other) const;
bool operator!= (const aiVector2t& other) const; bool operator!= (const aiVector2t& other) const;

View File

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