Fixed some of the pull request code in order to merge it
Former-commit-id: 76d71f15b335535e7dfcaf986440a00e85e45c1b
This commit is contained in:
parent
62daced765
commit
eceabcd241
|
|
@ -24,9 +24,6 @@ int main()
|
|||
// On va afficher le tout via un ostringstream, pour écrire dans la console et aussi dans un fichier
|
||||
std::ostringstream oss;
|
||||
|
||||
|
||||
char accentAigu = static_cast<char>(130); // C'est crade, mais ça marche chez 95% des Windowsiens
|
||||
|
||||
oss << "--Processeur--" << std::endl;
|
||||
// Plutôt que d'initialiser le Renderer de Nazara, nous initialisons les deux classes utilisées ici
|
||||
// Elles sont compatibles avec NzInitialiser et seront donc libérées automatiquement
|
||||
|
|
@ -44,7 +41,7 @@ int main()
|
|||
oss << std::endl;
|
||||
|
||||
// Ensuite, Nazara récupère les capacités du processeur, dont des jeux d'extensions supplémentaires
|
||||
oss << "Report des capacit" << accentAigu << "s: " << std::endl;
|
||||
oss << "Rapport des capacites: " << std::endl;// Pas d'accent car écriture dans un fichier (et on ne va pas s'embêter avec ça)
|
||||
printCap(oss, "-64bits", NzHardwareInfo::HasCapability(nzProcessorCap_x64));
|
||||
printCap(oss, "-AVX", NzHardwareInfo::HasCapability(nzProcessorCap_AVX));
|
||||
printCap(oss, "-FMA3", NzHardwareInfo::HasCapability(nzProcessorCap_FMA3));
|
||||
|
|
@ -81,7 +78,7 @@ int main()
|
|||
oss << std::endl;
|
||||
|
||||
// Ainsi qu'un report des capacités de la carte graphique (avec le driver actuel)
|
||||
oss << "Report des capacit" << accentAigu << "s: " << std::endl;
|
||||
oss << "Rapport des capacites: " << std::endl; // Pas d'accent car écriture dans un fichier (et on ne va pas s'embêter avec ça)
|
||||
printCap(oss, "-Calculs 64bits", NzOpenGL::IsSupported(nzOpenGLExtension_FP64));
|
||||
printCap(oss, "-Compression de textures (s3tc)", NzOpenGL::IsSupported(nzOpenGLExtension_TextureCompression_s3tc));
|
||||
printCap(oss, "-Filtrage anisotrope", NzOpenGL::IsSupported(nzOpenGLExtension_AnisotropicFilter));
|
||||
|
|
@ -108,6 +105,7 @@ int main()
|
|||
reportFile.Write(oss.str()); // Conversion implicite en NzString
|
||||
reportFile.Close();
|
||||
|
||||
char accentAigu = static_cast<char>(130); // C'est crade, mais ça marche chez 95% des Windowsiens
|
||||
std::cout << "Un fichier (RapportHardwareInfo.txt) contenant le rapport a " << accentAigu << 't' << accentAigu << " cr" << accentAigu << accentAigu << std::endl;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ NzSphere<T> NzBox<T>::GetBoundingSphere() const
|
|||
template<typename T>
|
||||
NzVector3<T> NzBox<T>::GetCenter() const
|
||||
{
|
||||
return GetPosition() + F(0.5)*GetLengths();
|
||||
return GetPosition() + GetLengths()/F(2.0);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -237,7 +237,7 @@ template<typename T>
|
|||
T NzBox<T>::GetSquaredRadius() const
|
||||
{
|
||||
NzVector3<T> size(GetLengths());
|
||||
size *= F(0.5); // La taille étant relative à la position (minimum) de la boite et non pas à son centre
|
||||
size /= F(2.0); // La taille étant relative à la position (minimum) de la boite et non pas à son centre
|
||||
|
||||
return size.GetSquaredLength();
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ template<typename T>
|
|||
NzBox<T>& NzBox<T>::Transform(const NzMatrix4<T>& matrix, bool applyTranslation)
|
||||
{
|
||||
NzVector3<T> center = matrix.Transform(GetCenter(), (applyTranslation) ? F(1.0) : F(0.0)); // Valeur multipliant la translation
|
||||
NzVector3<T> halfSize = GetLengths() * F(0.5);
|
||||
NzVector3<T> halfSize = GetLengths()/F(2.0);
|
||||
|
||||
halfSize.Set(std::fabs(matrix(0,0))*halfSize.x + std::fabs(matrix(1,0))*halfSize.y + std::fabs(matrix(2,0))*halfSize.z,
|
||||
std::fabs(matrix(0,1))*halfSize.x + std::fabs(matrix(1,1))*halfSize.y + std::fabs(matrix(2,1))*halfSize.z,
|
||||
|
|
@ -465,6 +465,7 @@ NzBox<T>& NzBox<T>::operator*=(T scalar)
|
|||
width *= scalar;
|
||||
height *= scalar;
|
||||
depth *= scalar;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -474,6 +475,7 @@ NzBox<T>& NzBox<T>::operator*=(const NzVector3<T>& vec)
|
|||
width *= vec.x;
|
||||
height *= vec.y;
|
||||
depth *= vec.z;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ template<typename T>
|
|||
NzFrustum<T>& NzFrustum<T>::Build(T angle, T ratio, T zNear, T zFar, const NzVector3<T>& eye, const NzVector3<T>& target, const NzVector3<T>& up)
|
||||
{
|
||||
#if NAZARA_MATH_ANGLE_RADIAN
|
||||
angle *= F(0.5);
|
||||
angle /= F(2.0);
|
||||
#else
|
||||
angle = NzDegreeToRadian(angle * F(0.5));
|
||||
angle = NzDegreeToRadian(angle/F(2.0));
|
||||
#endif
|
||||
|
||||
T tangent = std::tan(angle);
|
||||
|
|
|
|||
|
|
@ -573,9 +573,9 @@ NzMatrix4<T>& NzMatrix4<T>::MakePerspective(T angle, T ratio, T zNear, T zFar)
|
|||
{
|
||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb204945(v=vs.85).aspx
|
||||
#if NAZARA_MATH_ANGLE_RADIAN
|
||||
angle *= F(0.5);
|
||||
angle /= F(2.0);
|
||||
#else
|
||||
angle = NzDegreeToRadian(angle * F(0.5));
|
||||
angle = NzDegreeToRadian(angle/F(2.0));
|
||||
#endif
|
||||
|
||||
T yScale = F(1.0) / std::tan(angle);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include <cstring>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
///DOC: Pour que les coins soient valides, la méthode Update doit être appelée
|
||||
|
||||
#define F(a) static_cast<T>(a)
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -60,8 +62,7 @@ template<typename T>
|
|||
NzOrientedBox<T>& NzOrientedBox<T>::MakeZero()
|
||||
{
|
||||
localBox.MakeZero();
|
||||
for (unsigned int i = 0; i <= nzCorner_Max; ++i)
|
||||
m_corners[i].Set(NzVector3<T>::Zero());
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -70,8 +71,6 @@ NzOrientedBox<T>& NzOrientedBox<T>::Set(T X, T Y, T Z, T Width, T Height, T Dept
|
|||
{
|
||||
localBox.Set(X, Y, Z, Width, Height, Depth);
|
||||
|
||||
for (unsigned int i = 0; i <= nzCorner_Max; ++i)
|
||||
m_corners[i].Set(localBox.GetCorner(static_cast<nzCorner>(i)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -80,8 +79,6 @@ NzOrientedBox<T>& NzOrientedBox<T>::Set(const NzBox<T>& box)
|
|||
{
|
||||
localBox.Set(box);
|
||||
|
||||
for (unsigned int i = 0; i <= nzCorner_Max; ++i)
|
||||
m_corners[i].Set(localBox.GetCorner(static_cast<nzCorner>(i)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -98,8 +95,6 @@ NzOrientedBox<T>& NzOrientedBox<T>::Set(const NzVector3<T>& vec1, const NzVector
|
|||
{
|
||||
localBox.Set(vec1, vec2);
|
||||
|
||||
for (unsigned int i = 0; i <= nzCorner_Max; ++i)
|
||||
m_corners[i].Set(localBox.GetCorner(static_cast<nzCorner>(i)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -134,7 +129,7 @@ template<typename T>
|
|||
void NzOrientedBox<T>::Update(const NzMatrix4<T>& transformMatrix)
|
||||
{
|
||||
for (unsigned int i = 0; i <= nzCorner_Max; ++i)
|
||||
m_corners[i] = transformMatrix.Transform(m_corners[i]);
|
||||
m_corners[i] = transformMatrix.Transform(localBox.GetCorner(static_cast<nzCorner>(i)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
@ -189,8 +184,6 @@ NzOrientedBox<T> NzOrientedBox<T>::operator*(T scalar) const
|
|||
NzOrientedBox box(*this);
|
||||
box *= scalar;
|
||||
|
||||
for (unsigned int i = 0; i <= nzCorner_Max; ++i)
|
||||
box.m_corners[i].Set(box.GetCorner(static_cast<nzCorner>(i)));
|
||||
return box;
|
||||
}
|
||||
|
||||
|
|
@ -199,8 +192,6 @@ NzOrientedBox<T>& NzOrientedBox<T>::operator*=(T scalar)
|
|||
{
|
||||
localBox *= scalar;
|
||||
|
||||
for (unsigned int i = 0; i <= nzCorner_Max; ++i)
|
||||
m_corners[i].Set(localBox.GetCorner(static_cast<nzCorner>(i)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class NzRect
|
|||
|
||||
NzRect& operator*=(T scalar);
|
||||
NzRect& operator*=(const NzVector2<T>& vec);
|
||||
NzRect& operator/=(T scalar);
|
||||
NzRect& operator/=(T scalar);
|
||||
NzRect& operator/=(const NzVector2<T>& vec);
|
||||
|
||||
bool operator==(const NzRect& rect) const;
|
||||
|
|
|
|||
|
|
@ -353,6 +353,7 @@ NzRect<T>& NzRect<T>::operator*=(T scalar)
|
|||
{
|
||||
width *= scalar;
|
||||
height *= scalar;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -361,6 +362,7 @@ NzRect<T>& NzRect<T>::operator*=(const NzVector2<T>& vec)
|
|||
{
|
||||
width *= vec.x;
|
||||
height *= vec.y;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#define NAZARA_SPHERE_HPP
|
||||
|
||||
#include <Nazara/Core/String.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <Nazara/Math/Basic.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
|
@ -81,7 +82,6 @@ template<typename T>
|
|||
NzSphere<T>& NzSphere<T>::ExtendTo(T X, T Y, T Z)
|
||||
{
|
||||
T distance = SquaredDistance(X, Y, Z);
|
||||
|
||||
if (distance > radius*radius)
|
||||
radius = std::sqrt(distance);
|
||||
|
||||
|
|
@ -120,32 +120,48 @@ NzVector3<T> NzSphere<T>::GetPositiveVertex(const NzVector3<T>& normal) const
|
|||
template<typename T>
|
||||
bool NzSphere<T>::Intersect(const NzBox<T>& box) const
|
||||
{
|
||||
// Arvo's algorithm.
|
||||
T dmin = T(0);
|
||||
if (x < box.x)
|
||||
dmin += (x - box.x) * (x - box.x);
|
||||
else if (x > box.x + box.width)
|
||||
dmin += (x - (box.x + box.width)) * (x - (box.x + box.width));
|
||||
// Arvo's algorithm.
|
||||
T squaredDistance = T(0.0);
|
||||
if (x < box.x)
|
||||
{
|
||||
T diff = x - box.x;
|
||||
squaredDistance += diff*diff;
|
||||
}
|
||||
else if (x > box.x + box.width)
|
||||
{
|
||||
T diff = x - (box.x + box.width);
|
||||
squaredDistance += diff*diff;
|
||||
}
|
||||
|
||||
if (y < box.y)
|
||||
dmin += (y - box.y) * (y - box.y);
|
||||
else if (x > box.x + box.width)
|
||||
dmin += (y - (box.y + box.height)) * (y - (box.y + box.height));
|
||||
if (y < box.y)
|
||||
{
|
||||
T diff = y - box.y;
|
||||
squaredDistance += diff*diff;
|
||||
}
|
||||
else if (y > box.y + box.height)
|
||||
{
|
||||
T diff = y - (box.y + box.height);
|
||||
squaredDistance += diff*diff;
|
||||
}
|
||||
|
||||
if (z < box.z)
|
||||
dmin += (z - box.z) * (z - box.z);
|
||||
else if (x > box.x + box.width)
|
||||
dmin += (z - (box.z + box.depth)) * (z - (box.z + box.depth));
|
||||
if (z < box.z)
|
||||
{
|
||||
T diff = z - box.z;
|
||||
squaredDistance += diff*diff;
|
||||
}
|
||||
else if (z > box.z + box.depth)
|
||||
{
|
||||
T diff = z - (box.z + box.depth);
|
||||
squaredDistance += diff*diff;
|
||||
}
|
||||
|
||||
if (dmin <= radius * radius)
|
||||
return true;
|
||||
return false;
|
||||
return squaredDistance <= radius * radius;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool NzSphere<T>::Intersect(const NzSphere& sphere) const
|
||||
{
|
||||
return std::abs(SquaredDistance(sphere.x, sphere.y, sphere.z) - radius*radius) <= sphere.radius*sphere.radius;
|
||||
return SquaredDistance(sphere.x, sphere.y, sphere.z) - radius*radius <= sphere.radius*sphere.radius;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
#include <Nazara/Core/Win32/TaskSchedulerImpl.hpp>
|
||||
#include <Nazara/Core/Config.hpp>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <cstdlib>
|
||||
#include <cstdlib> // std::ldiv
|
||||
#include <process.h>
|
||||
#include <Nazara/Core/Debug.hpp>
|
||||
|
||||
bool NzTaskSchedulerImpl::Initialize(unsigned int workerCount)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue