Indentations
Former-commit-id: 0d82a4464cb9369bc4ca5cf2d7780c921eff953d
This commit is contained in:
parent
0b390e45a1
commit
376df6a3b7
|
|
@ -14,7 +14,7 @@ template<unsigned int N>
|
||||||
struct NzImplTupleUnpack
|
struct NzImplTupleUnpack
|
||||||
{
|
{
|
||||||
template <typename F, typename... ArgsT, typename... Args>
|
template <typename F, typename... ArgsT, typename... Args>
|
||||||
void operator()(F func, const std::tuple<ArgsT...>& t, Args&... args)
|
void operator()(F func, const std::tuple<ArgsT...>& t, Args&... args)
|
||||||
{
|
{
|
||||||
NzImplTupleUnpack<N-1>()(func, t, std::get<N-1>(t), args...);
|
NzImplTupleUnpack<N-1>()(func, t, std::get<N-1>(t), args...);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -312,8 +312,8 @@ inline void NzColor::ToHSV(const NzColor& color, float* hue, float* saturation,
|
||||||
float g = color.g / 255.f;
|
float g = color.g / 255.f;
|
||||||
float b = color.b / 255.f;
|
float b = color.b / 255.f;
|
||||||
|
|
||||||
float min = std::min(std::min(r, g), b); //Min. value of RGB
|
float min = std::min({r, g, b}); //Min. value of RGB
|
||||||
float max = std::max(std::max(r, g), b); //Max. value of RGB
|
float max = std::max({r, g, b}); //Max. value of RGB
|
||||||
|
|
||||||
float deltaMax = max - min; //Delta RGB value
|
float deltaMax = max - min; //Delta RGB value
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
#include <Nazara/Core/ThreadSafetyOff.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using NzDynLibFunc = int (*)(); // Type "générique" de pointeur sur fonction
|
using NzDynLibFunc = int (*)(); // Type "générique" de pointeur sur fonction
|
||||||
|
|
||||||
class NzDynLibImpl;
|
class NzDynLibImpl;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ class NzMatrix4
|
||||||
NzMatrix4& Set(const T matrix[16]);
|
NzMatrix4& Set(const T matrix[16]);
|
||||||
//NzMatrix4(const NzMatrix3<T>& matrix);
|
//NzMatrix4(const NzMatrix3<T>& matrix);
|
||||||
NzMatrix4& Set(const NzMatrix4& matrix);
|
NzMatrix4& Set(const NzMatrix4& matrix);
|
||||||
NzMatrix4& Set(NzMatrix4&& matrix);
|
|
||||||
template<typename U> NzMatrix4& Set(const NzMatrix4<U>& matrix);
|
template<typename U> NzMatrix4& Set(const NzMatrix4<U>& matrix);
|
||||||
NzMatrix4& SetRotation(const NzQuaternion<T>& rotation);
|
NzMatrix4& SetRotation(const NzQuaternion<T>& rotation);
|
||||||
NzMatrix4& SetScale(const NzVector3<T>& scale);
|
NzMatrix4& SetScale(const NzVector3<T>& scale);
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,12 @@ class NzVector3
|
||||||
~NzVector3() = default;
|
~NzVector3() = default;
|
||||||
|
|
||||||
T AbsDotProduct(const NzVector3& vec) const;
|
T AbsDotProduct(const NzVector3& vec) const;
|
||||||
|
|
||||||
T AngleBetween(const NzVector3& vec) const;
|
T AngleBetween(const NzVector3& vec) const;
|
||||||
|
|
||||||
NzVector3 CrossProduct(const NzVector3& vec) const;
|
NzVector3 CrossProduct(const NzVector3& vec) const;
|
||||||
|
|
||||||
T Distance(const NzVector3& vec) const;
|
T Distance(const NzVector3& vec) const;
|
||||||
float Distancef(const NzVector3& vec) const;
|
float Distancef(const NzVector3& vec) const;
|
||||||
|
|
||||||
T DotProduct(const NzVector3& vec) const;
|
T DotProduct(const NzVector3& vec) const;
|
||||||
|
|
||||||
T GetLength() const;
|
T GetLength() const;
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,9 @@ template<typename T>
|
||||||
T NzVector3<T>::AngleBetween(const NzVector3& vec) const
|
T NzVector3<T>::AngleBetween(const NzVector3& vec) const
|
||||||
{
|
{
|
||||||
// sqrt(a) * sqrt(b) = sqrt(a*b)
|
// sqrt(a) * sqrt(b) = sqrt(a*b)
|
||||||
T divisor = std::sqrt(GetSquaredLength() * vec.GetSquaredLength());
|
T divisor = std::sqrt(GetSquaredLength() * vec.GetSquaredLength());
|
||||||
|
|
||||||
#if NAZARA_MATH_SAFE
|
#if NAZARA_MATH_SAFE
|
||||||
if (NzNumberEquals(divisor, F(0.0)))
|
if (NzNumberEquals(divisor, F(0.0)))
|
||||||
{
|
{
|
||||||
NzString error("Division by zero");
|
NzString error("Division by zero");
|
||||||
|
|
@ -325,7 +325,7 @@ NzVector3<T>& NzVector3<T>::Set(const NzVector4<T>& vec)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T NzVector3<T>::SquaredDistance(const NzVector3& vec) const
|
T NzVector3<T>::SquaredDistance(const NzVector3& vec) const
|
||||||
{
|
{
|
||||||
return operator-(vec).GetSquaredLength();
|
return (*this - vec).GetSquaredLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
||||||
|
|
@ -121,11 +121,11 @@ NzVector4<T>& NzVector4<T>::Maximize(const NzVector4& vec)
|
||||||
if (vec.y > y)
|
if (vec.y > y)
|
||||||
y = vec.y;
|
y = vec.y;
|
||||||
|
|
||||||
if (vec.z > z)
|
if (vec.z > z)
|
||||||
z = vec.z;
|
z = vec.z;
|
||||||
|
|
||||||
if (vec.w > w)
|
if (vec.w > w)
|
||||||
w = vec.w;
|
w = vec.w;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
@ -139,11 +139,11 @@ NzVector4<T>& NzVector4<T>::Minimize(const NzVector4& vec)
|
||||||
if (vec.y < y)
|
if (vec.y < y)
|
||||||
y = vec.y;
|
y = vec.y;
|
||||||
|
|
||||||
if (vec.z < z)
|
if (vec.z < z)
|
||||||
z = vec.z;
|
z = vec.z;
|
||||||
|
|
||||||
if (vec.w < w)
|
if (vec.w < w)
|
||||||
w = vec.w;
|
w = vec.w;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
@ -447,9 +447,9 @@ template<typename T>
|
||||||
bool NzVector4<T>::operator==(const NzVector4& vec) const
|
bool NzVector4<T>::operator==(const NzVector4& vec) const
|
||||||
{
|
{
|
||||||
return NzNumberEquals(x, vec.x) &&
|
return NzNumberEquals(x, vec.x) &&
|
||||||
NzNumberEquals(y, vec.y) &&
|
NzNumberEquals(y, vec.y) &&
|
||||||
NzNumberEquals(z, vec.z) &&
|
NzNumberEquals(z, vec.z) &&
|
||||||
NzNumberEquals(w, vec.w);
|
NzNumberEquals(w, vec.w);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <Nazara/Core/Unicode.hpp>
|
#include <Nazara/Core/Unicode.hpp>
|
||||||
#include <Nazara/Math/Algorithm.hpp>
|
#include <Nazara/Math/Algorithm.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
@ -50,24 +51,24 @@ inline char nzToUpper(char character)
|
||||||
|
|
||||||
inline int nzStrcasecmp(const char* s1, const char* s2)
|
inline int nzStrcasecmp(const char* s1, const char* s2)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
while (!(ret = static_cast<unsigned char>(nzToLower(*s1)) - static_cast<unsigned char>(nzToLower(*s2))) && *s2)
|
while (!(ret = static_cast<unsigned char>(nzToLower(*s1)) - static_cast<unsigned char>(nzToLower(*s2))) && *s2)
|
||||||
++s1, ++s2;
|
++s1, ++s2;
|
||||||
|
|
||||||
return ret != 0 ? (ret > 0 ? 1 : -1) : 0;
|
return ret != 0 ? (ret > 0 ? 1 : -1) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int nzUnicodecasecmp(const char* s1, const char* s2)
|
inline int nzUnicodecasecmp(const char* s1, const char* s2)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
utf8::unchecked::iterator<const char*> it1(s1);
|
utf8::unchecked::iterator<const char*> it1(s1);
|
||||||
utf8::unchecked::iterator<const char*> it2(s2);
|
utf8::unchecked::iterator<const char*> it2(s2);
|
||||||
|
|
||||||
while (!(ret = NzUnicode::GetLowercase(*it1) - NzUnicode::GetLowercase(*it2)) && *it2)
|
while (!(ret = NzUnicode::GetLowercase(*it1) - NzUnicode::GetLowercase(*it2)) && *it2)
|
||||||
++it1, ++it2;
|
++it1, ++it2;
|
||||||
|
|
||||||
return ret != 0 ? (ret > 0 ? 1 : -1) : 0;
|
return ret != 0 ? (ret > 0 ? 1 : -1) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NzString::NzString() :
|
NzString::NzString() :
|
||||||
|
|
@ -2087,8 +2088,8 @@ bool NzString::Match(const char* pattern) const
|
||||||
if (!*++pattern)
|
if (!*++pattern)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
mp = pattern;
|
mp = pattern;
|
||||||
cp = str+1;
|
cp = str+1;
|
||||||
}
|
}
|
||||||
else if (*pattern == *str || *pattern == '?')
|
else if (*pattern == *str || *pattern == '?')
|
||||||
{
|
{
|
||||||
|
|
@ -3977,7 +3978,7 @@ NzString NzString::Unicode(char32_t character)
|
||||||
count = 2;
|
count = 2;
|
||||||
else if (character < 0x10000)
|
else if (character < 0x10000)
|
||||||
count = 3;
|
count = 3;
|
||||||
else
|
else
|
||||||
count = 4;
|
count = 4;
|
||||||
|
|
||||||
char* str = new char[count+1];
|
char* str = new char[count+1];
|
||||||
|
|
@ -4028,7 +4029,7 @@ NzString NzString::Unicode(const char32_t* u32String)
|
||||||
count += 2;
|
count += 2;
|
||||||
else if (cp < 0x10000)
|
else if (cp < 0x10000)
|
||||||
count += 3;
|
count += 3;
|
||||||
else
|
else
|
||||||
count += 4;
|
count += 4;
|
||||||
}
|
}
|
||||||
while (*++ptr);
|
while (*++ptr);
|
||||||
|
|
@ -4056,7 +4057,7 @@ NzString NzString::Unicode(const wchar_t* wString)
|
||||||
count += 2;
|
count += 2;
|
||||||
else if (cp < 0x10000)
|
else if (cp < 0x10000)
|
||||||
count += 3;
|
count += 3;
|
||||||
else
|
else
|
||||||
count += 4;
|
count += 4;
|
||||||
}
|
}
|
||||||
while (*++ptr);
|
while (*++ptr);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ bool NzVertexBuffer::FillRaw(const void* data, unsigned int offset, unsigned int
|
||||||
if (!m_buffer)
|
if (!m_buffer)
|
||||||
{
|
{
|
||||||
NazaraError("No buffer");
|
NazaraError("No buffer");
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_startOffset + offset + size > m_endOffset)
|
if (m_startOffset + offset + size > m_endOffset)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue