2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2026-01-10 18:51:49 +00:00

refactor: image and obj data loading

This commit is contained in:
Jan
2024-09-24 12:01:42 +01:00
parent 5fee875495
commit 5cc52c42cd
97 changed files with 1784 additions and 1878 deletions

View File

@@ -1,27 +1,73 @@
#include "ImageConverter.h"
#include "Image/Texture.h"
#include "ImageConverterArgs.h"
#include "Utils/StringUtils.h"
class ImageConverterImpl final : public ImageConverter
#include <filesystem>
namespace fs = std::filesystem;
namespace image_converter
{
public:
bool Start(const int argc, const char** argv) override
constexpr auto EXTENSION_IWI = ".iwi";
class ImageLoader
{
auto shouldContinue = true;
if (!m_args.ParseArgs(argc, argv, shouldContinue))
return false;
public:
ImageLoader() = default;
virtual ~ImageLoader() = default;
ImageLoader(const ImageLoader& other) = default;
ImageLoader(ImageLoader&& other) noexcept = default;
ImageLoader& operator=(const ImageLoader& other) = default;
ImageLoader& operator=(ImageLoader&& other) noexcept = default;
// virtual Texture*
};
class ImageConverterImpl final : public ImageConverter
{
public:
ImageConverterImpl()
: m_game_to_convert_to(image_converter::Game::UNKNOWN)
{
}
bool Start(const int argc, const char** argv) override
{
auto shouldContinue = true;
if (!m_args.ParseArgs(argc, argv, shouldContinue))
return false;
if (!shouldContinue)
return true;
m_game_to_convert_to = m_args.m_game_to_convert_to;
for (const auto& file : m_args.m_files_to_convert)
Convert(file);
if (!shouldContinue)
return true;
}
return true;
}
private:
void Convert(const std::string& file)
{
fs::path filePath(file);
auto extension = filePath.extension().string();
utils::MakeStringLowerCase(extension);
private:
ImageConverterArgs m_args;
};
if (extension == EXTENSION_IWI)
{
}
}
ImageConverterArgs m_args;
image_converter::Game m_game_to_convert_to;
};
} // namespace image_converter
std::unique_ptr<ImageConverter> ImageConverter::Create()
{
return std::make_unique<ImageConverterImpl>();
return std::make_unique<image_converter::ImageConverterImpl>();
}