Examples: Fix MeshInfos

Former-commit-id: b6c5ea953f60d2b22eaa6aae06d1618efdb09bc1
This commit is contained in:
Lynix 2015-09-28 12:41:41 +02:00
parent 05056d41de
commit f54eb0402f
1 changed files with 17 additions and 17 deletions

View File

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