Big f***ing cleanup part 1

This commit is contained in:
Lynix
2020-02-23 00:42:22 +01:00
parent 67d0e0a689
commit 3d22321109
178 changed files with 2190 additions and 5113 deletions

View File

@@ -1,4 +1,3 @@
#include <Nazara/Core/Directory.hpp>
#include <Nazara/Core/File.hpp>
#include <Nazara/Math/Box.hpp>
#include <Nazara/Utility/Animation.hpp>
@@ -26,25 +25,17 @@ int main()
for (;;)
{
Nz::Directory resourceDirectory("resources");
if (!resourceDirectory.Open())
std::vector<std::filesystem::path> models;
for (auto& p : std::filesystem::directory_iterator("resources"))
{
std::cerr << "Failed to open resource directory" << std::endl;
std::getchar();
return EXIT_FAILURE;
}
if (!p.is_regular_file())
continue;
std::vector<Nz::String> models;
while (resourceDirectory.NextResult())
{
Nz::String path = resourceDirectory.GetResultName();
Nz::String ext = path.SubStringFrom('.', -1, true); // Tout ce qui vient après le dernier '.' de la chaîne
if (Nz::MeshLoader::IsExtensionSupported(ext)) // L'extension est-elle supportée par le MeshLoader ?
models.push_back(path);
const std::filesystem::path& filePath = p.path();
if (Nz::MeshLoader::IsExtensionSupported(filePath.extension().generic_u8string())) // L'extension est-elle supportée par le MeshLoader ?
models.push_back(filePath);
}
resourceDirectory.Close();
if (models.empty())
{
std::cout << "No loadable mesh found in resource directory" << std::endl;
@@ -71,7 +62,7 @@ int main()
if (iChoice == 0)
break;
Nz::MeshRef mesh = Nz::Mesh::LoadFromFile(resourceDirectory.GetPath() + '/' + models[iChoice-1]);
Nz::MeshRef mesh = Nz::Mesh::LoadFromFile(models[iChoice-1]);
if (!mesh)
{
std::cout << "Failed to load mesh" << std::endl;
@@ -123,8 +114,8 @@ int main()
}
}
Nz::String animationPath = mesh->GetAnimation();
if (!animationPath.IsEmpty())
std::filesystem::path animationPath = mesh->GetAnimation();
if (!animationPath.empty())
{
Nz::AnimationRef animation = Nz::Animation::LoadFromFile(animationPath);
if (animation)