Core/Misc: update g3dlite lib (#2904)

* Core/Misc: update g3dlite lib

* update

Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
Viste
2020-07-30 13:35:45 +03:00
committed by GitHub
parent 91bbbf08eb
commit fcaf91b8b2
183 changed files with 13258 additions and 8022 deletions

View File

@@ -1,10 +1,10 @@
/**
@file SmallArray.h
\file G3D/SmallArray.h
@created 2009-04-26
@edited 2010-02-26
\created 2009-04-26
\edited 2012-07-23
Copyright 2000-2010, Morgan McGuire, http://graphics.cs.williams.edu
Copyright 2000-2012, Morgan McGuire, http://graphics.cs.williams.edu
All rights reserved.
*/
#ifndef G3D_SmallArray_h
@@ -83,6 +83,35 @@ public:
push(v);
}
inline void append(const T& v, const T& v2) {
push(v);
push(v2);
}
inline void append(const T& v, const T& v2, const T& v3) {
push(v);
push(v2);
push(v3);
}
inline void append(const T& v, const T& v2, const T& v3, const T& v4) {
push(v);
push(v2);
push(v3);
push(v4);
}
/** Find the index of \a v or -1 if not found */
int findIndex(const T& v) {
for (int i = 0; i < N; ++i) {
if (m_embedded[i] == v) {
return i;
}
}
return m_rest.findIndex(v) + N;
}
void fastRemove(int i, bool shrinkIfNecessary = false) {
debugAssert(i < m_size && i >= 0);
if (i < N) {
@@ -139,8 +168,8 @@ public:
return m_rest.contains(value);
}
template<int MIN_ELEMENTS, int MIN_BYTES>
SmallArray<T, N>& operator=(const Array<T, MIN_ELEMENTS, MIN_BYTES>& src) {
template<int MIN_ELEMENTS>
SmallArray<T, N>& operator=(const Array<T, MIN_ELEMENTS>& src) {
resize(src.size());
for (int i = 0; i < src.size(); ++i) {
(*this)[i] = src[i];
@@ -148,13 +177,13 @@ public:
return *this;
}
inline const T& last() const {
return (*this)[size() - 1];
}
inline const T& last() const {
return (*this)[size() - 1];
}
inline T& last() {
return (*this)[size() - 1];
}
inline T& last() {
return (*this)[size() - 1];
}
};
}