2020-06-02 11:46:18 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "MinimalEngine.h"
|
|
|
|
|
#include "Containers/List.h"
|
|
|
|
|
#include <thread>
|
|
|
|
|
#include <future>
|
2020-08-11 22:38:19 +02:00
|
|
|
#include <filesystem>
|
2020-06-02 11:46:18 +02:00
|
|
|
|
2020-10-03 11:00:10 +02:00
|
|
|
struct aiScene;
|
|
|
|
|
struct aiTexel;
|
2020-06-02 11:46:18 +02:00
|
|
|
namespace Seele
|
|
|
|
|
{
|
2021-04-01 16:40:14 +02:00
|
|
|
DECLARE_REF(Mesh)
|
|
|
|
|
DECLARE_REF(MeshAsset)
|
|
|
|
|
DECLARE_REF(MaterialAsset)
|
|
|
|
|
DECLARE_NAME_REF(Gfx, Graphics)
|
2020-06-02 11:46:18 +02:00
|
|
|
class MeshLoader
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
MeshLoader(Gfx::PGraphics graphic);
|
|
|
|
|
~MeshLoader();
|
2020-06-08 01:44:47 +02:00
|
|
|
void importAsset(const std::filesystem::path& filePath);
|
2020-06-02 11:46:18 +02:00
|
|
|
private:
|
2020-10-03 11:00:10 +02:00
|
|
|
void loadMaterials(const aiScene* scene, Array<PMaterialAsset>& globalMaterials, Gfx::PGraphics graphics);
|
2021-04-01 16:40:14 +02:00
|
|
|
void loadTextures(const aiScene* scene, const std::filesystem::path& meshPath);
|
2020-10-14 01:49:43 +02:00
|
|
|
void loadGlobalMeshes(const aiScene* scene, Array<PMesh>& globalMeshes, const Array<PMaterialAsset>& materials, Gfx::PGraphics graphics);
|
2020-10-03 11:00:10 +02:00
|
|
|
void convertAssimpARGB(unsigned char* dst, aiTexel* src, uint32 numPixels);
|
|
|
|
|
|
2020-06-08 01:44:47 +02:00
|
|
|
void import(const std::filesystem::path& path);
|
2020-06-02 11:46:18 +02:00
|
|
|
List<std::future<void>> futures;
|
|
|
|
|
Gfx::PGraphics graphics;
|
|
|
|
|
};
|
2021-04-01 16:40:14 +02:00
|
|
|
DEFINE_REF(MeshLoader)
|
2020-06-02 11:46:18 +02:00
|
|
|
} // namespace Seele
|