Switch from Nz prefix to namespace Nz

What a huge commit


Former-commit-id: 38ac5eebf70adc1180f571f6006192d28fb99897
This commit is contained in:
Lynix
2015-09-25 19:20:05 +02:00
parent c214251ecf
commit df8da275c4
609 changed files with 68265 additions and 66534 deletions

View File

@@ -15,7 +15,7 @@
#include <iostream>
#include <sstream>
void printCap(std::ostream& o, const NzString& cap, bool b);
void printCap(std::ostream& o, const String& cap, bool b);
int main()
{
@@ -28,68 +28,68 @@ int main()
// 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
// Cela permet d'avoir une initialisation plus rapide et un coût en mémoire moindre
NzInitializer<NzHardwareInfo> hardwareInfo;
Initializer<HardwareInfo> hardwareInfo;
if (hardwareInfo)
{
// On commence par les informations sur le processeur, Nazara en récupère trois caractéristiques:
// 1) La "brand string", qui est une chaîne de 48 caractères identifiant le processeur
// 2) Le concepteur du processeur, accessible via une énumération (GetProcessorVendor) ou une chaîne de caractère (GetProcessorVendorName)
// 3) Le nombre de processeurs logique, alias bien souvent le nombre de coeurs (logiques), cette valeur est renvoyée par l'OS (Le SMT multiplie donc la valeur réelle)
oss << "Identification: " << NzHardwareInfo::GetProcessorBrandString() << std::endl;
oss << "Concepteur: " << NzHardwareInfo::GetProcessorVendorName() << std::endl;
oss << "Nombre de coeurs logiques: " << NzHardwareInfo::GetProcessorCount() << std::endl;
oss << "Identification: " << HardwareInfo::GetProcessorBrandString() << std::endl;
oss << "Concepteur: " << HardwareInfo::GetProcessorVendorName() << std::endl;
oss << "Nombre de coeurs logiques: " << HardwareInfo::GetProcessorCount() << std::endl;
oss << std::endl;
// Ensuite, Nazara récupère les capacités du processeur, dont des jeux d'extensions supplémentaires
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));
printCap(oss, "-FMA4", NzHardwareInfo::HasCapability(nzProcessorCap_FMA4));
printCap(oss, "-MMX", NzHardwareInfo::HasCapability(nzProcessorCap_MMX));
printCap(oss, "-SSE", NzHardwareInfo::HasCapability(nzProcessorCap_SSE));
printCap(oss, "-SSE2", NzHardwareInfo::HasCapability(nzProcessorCap_SSE2));
printCap(oss, "-SSE3", NzHardwareInfo::HasCapability(nzProcessorCap_SSE3));
printCap(oss, "-SSSE3", NzHardwareInfo::HasCapability(nzProcessorCap_SSSE3));
printCap(oss, "-SSE4.1", NzHardwareInfo::HasCapability(nzProcessorCap_SSE41));
printCap(oss, "-SSE4.2", NzHardwareInfo::HasCapability(nzProcessorCap_SSE42));
printCap(oss, "-SSE4.a", NzHardwareInfo::HasCapability(nzProcessorCap_SSE4a));
printCap(oss, "-64bits", HardwareInfo::HasCapability(ProcessorCap_x64));
printCap(oss, "-AVX", HardwareInfo::HasCapability(ProcessorCap_AVX));
printCap(oss, "-FMA3", HardwareInfo::HasCapability(ProcessorCap_FMA3));
printCap(oss, "-FMA4", HardwareInfo::HasCapability(ProcessorCap_FMA4));
printCap(oss, "-MMX", HardwareInfo::HasCapability(ProcessorCap_MMX));
printCap(oss, "-SSE", HardwareInfo::HasCapability(ProcessorCap_SSE));
printCap(oss, "-SSE2", HardwareInfo::HasCapability(ProcessorCap_SSE2));
printCap(oss, "-SSE3", HardwareInfo::HasCapability(ProcessorCap_SSE3));
printCap(oss, "-SSSE3", HardwareInfo::HasCapability(ProcessorCap_SSSE3));
printCap(oss, "-SSE4.1", HardwareInfo::HasCapability(ProcessorCap_SSE41));
printCap(oss, "-SSE4.2", HardwareInfo::HasCapability(ProcessorCap_SSE42));
printCap(oss, "-SSE4.a", HardwareInfo::HasCapability(ProcessorCap_SSE4a));
}
else
oss << "Impossible de retrouver les informations du processeur" << std::endl;
oss << std::endl << "--Carte graphique--" << std::endl;
// La classe NzOpenGL nous donne accès à des informations sur la carte graphique
// La classe OpenGL nous donne accès à des informations sur la carte graphique
// Cependant celle-ci n'est accessible que si le projet est compilé avec NAZARA_RENDERER_OPENGL
// et que les répertoires d'inclusions donnent accès aux includes d'OpenGL (Cette démo utilisent ceux de Nazara)
NzInitializer<NzOpenGL> openGL;
Initializer<OpenGL> openGL;
if (openGL)
{
// Nous récupérons ensuite la version d'OpenGL sous forme d'entier (ex: OpenGL 3.3 donnera 330)
unsigned int openglVersion = NzOpenGL::GetVersion();
unsigned int openglVersion = OpenGL::GetVersion();
// NzOpenGL nous donne accès à trois informations principales:
// OpenGL nous donne accès à trois informations principales:
// 1) La chaîne d'identification du driver ("Renderer name")
// 2) La chaîne d'identification du concepteur ("Vendor name")
// 3) La version d'OpenGL
oss << "Identification: " << NzOpenGL::GetRendererName() << std::endl;
oss << "Concepteur: " << NzOpenGL::GetVendorName() << std::endl;
oss << "Identification: " << OpenGL::GetRendererName() << std::endl;
oss << "Concepteur: " << OpenGL::GetVendorName() << std::endl;
oss << "Version d'OpenGL: " << openglVersion/100 << '.' << openglVersion%100 << std::endl;
oss << std::endl;
// Ainsi qu'un report des capacités de la carte graphique (avec le driver actuel)
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));
printCap(oss, "-Framebuffer Object", NzOpenGL::IsSupported(nzOpenGLExtension_FrameBufferObject));
printCap(oss, "-Mode debug", NzOpenGL::IsSupported(nzOpenGLExtension_DebugOutput));
printCap(oss, "-Pixelbuffer Object", NzOpenGL::IsSupported(nzOpenGLExtension_PixelBufferObject));
printCap(oss, "-Samplers Object", NzOpenGL::IsSupported(nzOpenGLExtension_SamplerObjects));
printCap(oss, "-Separate shader objects", NzOpenGL::IsSupported(nzOpenGLExtension_SeparateShaderObjects));
printCap(oss, "-Texture array", NzOpenGL::IsSupported(nzOpenGLExtension_TextureArray));
printCap(oss, "-Texture storage", NzOpenGL::IsSupported(nzOpenGLExtension_TextureStorage));
printCap(oss, "-Vertex array objects", NzOpenGL::IsSupported(nzOpenGLExtension_VertexArrayObjects));
printCap(oss, "-Calculs 64bits", OpenGL::IsSupported(OpenGLExtension_FP64));
printCap(oss, "-Compression de textures (s3tc)", OpenGL::IsSupported(OpenGLExtension_TextureCompression_s3tc));
printCap(oss, "-Filtrage anisotrope", OpenGL::IsSupported(OpenGLExtension_AnisotropicFilter));
printCap(oss, "-Framebuffer Object", OpenGL::IsSupported(OpenGLExtension_FrameBufferObject));
printCap(oss, "-Mode debug", OpenGL::IsSupported(OpenGLExtension_DebugOutput));
printCap(oss, "-Pixelbuffer Object", OpenGL::IsSupported(OpenGLExtension_PixelBufferObject));
printCap(oss, "-Samplers Object", OpenGL::IsSupported(OpenGLExtension_SamplerObjects));
printCap(oss, "-Separate shader objects", OpenGL::IsSupported(OpenGLExtension_SeparateShaderObjects));
printCap(oss, "-Texture array", OpenGL::IsSupported(OpenGLExtension_TextureArray));
printCap(oss, "-Texture storage", OpenGL::IsSupported(OpenGLExtension_TextureStorage));
printCap(oss, "-Vertex array objects", OpenGL::IsSupported(OpenGLExtension_VertexArrayObjects));
}
else
oss << "Impossible de retrouver les informations de la carte graphique" << std::endl;
@@ -99,10 +99,10 @@ int main()
std::cout << oss.str() << std::endl;
NzFile reportFile("RapportHardwareInfo.txt");
if (reportFile.Open(nzOpenMode_Text | nzOpenMode_Truncate | nzOpenMode_WriteOnly))
File reportFile("RapportHardwareInfo.txt");
if (reportFile.Open(OpenMode_Text | OpenMode_Truncate | OpenMode_WriteOnly))
{
reportFile.Write(oss.str()); // Conversion implicite en NzString
reportFile.Write(oss.str()); // Conversion implicite en String
reportFile.Close();
char accentAigu = static_cast<char>(130); // C'est crade, mais ça marche chez 95% des Windowsiens
@@ -116,7 +116,7 @@ int main()
return 0;
}
void printCap(std::ostream& o, const NzString& cap, bool b)
void printCap(std::ostream& o, const String& cap, bool b)
{
if (b)
o << cap << ": Oui" << std::endl;

View File

@@ -11,7 +11,7 @@
int main()
{
// Pour charger des ressources, il est impératif d'initialiser le module utilitaire
NzInitializer<NzUtility> utility;
Initializer<Utility> utility;
if (!utility)
{
// Ça n'a pas fonctionné, le pourquoi se trouve dans le fichier NazaraLog.log
@@ -22,7 +22,7 @@ int main()
for (;;)
{
NzDirectory resourceDirectory("resources/");
Directory resourceDirectory("resources/");
if (!resourceDirectory.Open())
{
std::cerr << "Failed to open resource directory" << std::endl;
@@ -30,12 +30,12 @@ int main()
return EXIT_FAILURE;
}
std::vector<NzString> models;
std::vector<String> models;
while (resourceDirectory.NextResult())
{
NzString path = resourceDirectory.GetResultName();
NzString ext = path.SubStringFrom('.', -1, true); // Tout ce qui vient après le dernier '.' de la chaîne
if (NzMeshLoader::IsExtensionSupported(ext)) // L'extension est-elle supportée par le MeshLoader ?
String path = resourceDirectory.GetResultName();
String ext = path.SubStringFrom('.', -1, true); // Tout ce qui vient après le dernier '.' de la chaîne
if (MeshLoader::IsExtensionSupported(ext)) // L'extension est-elle supportée par le MeshLoader ?
models.push_back(path);
}
@@ -67,7 +67,7 @@ int main()
if (iChoice == 0)
break;
NzMesh mesh;
Mesh mesh;
if (!mesh.LoadFromFile("resources/" + models[iChoice-1]))
{
std::cout << "Failed to load mesh" << std::endl;
@@ -77,11 +77,11 @@ int main()
switch (mesh.GetAnimationType())
{
case nzAnimationType_Skeletal:
case AnimationType_Skeletal:
std::cout << "This is a skeletal-animated mesh" << std::endl;
break;
case nzAnimationType_Static:
case AnimationType_Static:
std::cout << "This is a static mesh" << std::endl;
break;
@@ -92,9 +92,9 @@ int main()
if (mesh.IsAnimable())
{
if (mesh.GetAnimationType() == nzAnimationType_Skeletal)
if (mesh.GetAnimationType() == AnimationType_Skeletal)
{
const NzSkeleton* skeleton = mesh.GetSkeleton();
const Skeleton* skeleton = mesh.GetSkeleton();
unsigned int jointCount = skeleton->GetJointCount();
std::cout << "It has a skeleton made of " << skeleton->GetJointCount() << " joint(s)." << std::endl;
std::cout << "Print joints ? (Y/N) ";
@@ -107,10 +107,10 @@ int main()
{
for (unsigned int i = 0; i < jointCount; ++i)
{
const NzJoint* joint = skeleton->GetJoint(i);
const Joint* joint = skeleton->GetJoint(i);
std::cout << "\t" << (i+1) << ": " << joint->GetName();
const NzJoint* parent = static_cast<const NzJoint*>(joint->GetParent());
const Joint* parent = static_cast<const Joint*>(joint->GetParent());
if (parent)
std::cout << " (Parent: " << parent->GetName() << ')';
@@ -119,10 +119,10 @@ int main()
}
}
NzString animationPath = mesh.GetAnimation();
String animationPath = mesh.GetAnimation();
if (!animationPath.IsEmpty())
{
NzAnimation animation;
Animation animation;
if (animation.LoadFromFile(animationPath))
{
unsigned int sequenceCount = animation.GetSequenceCount();
@@ -137,7 +137,7 @@ int main()
{
for (unsigned int i = 0; i < sequenceCount; ++i)
{
const NzSequence* sequence = animation.GetSequence(i);
const Sequence* sequence = animation.GetSequence(i);
std::cout << "\t" << (i+1) << ": " << sequence->name << std::endl;
std::cout << "\t\tStart frame: " << sequence->firstFrame << std::endl;
std::cout << "\t\tFrame count: " << sequence->frameCount << std::endl;
@@ -153,7 +153,7 @@ int main()
std::cout << "It's animable but has no animation information" << std::endl;
}
NzBoxf cube = mesh.GetAABB();
Boxf cube = mesh.GetAABB();
std::cout << "Mesh is " << cube.width << " units wide, " << cube.height << " units height and " << cube.depth << " units depth" << std::endl;
unsigned int materialCount = mesh.GetMaterialCount();