Files
Seele/src/Engine/Asset/MaterialLoader.cpp
T

35 lines
1022 B
C++
Raw Normal View History

2020-06-02 11:46:18 +02:00
#include "MaterialLoader.h"
#include "Graphics/Graphics.h"
2021-10-19 23:04:38 +02:00
#include "Material/MaterialAsset.h"
2020-10-03 11:00:10 +02:00
#include "AssetRegistry.h"
2020-06-02 11:46:18 +02:00
using namespace Seele;
MaterialLoader::MaterialLoader(Gfx::PGraphics graphics)
2020-09-19 14:36:50 +02:00
: graphics(graphics)
2020-06-02 11:46:18 +02:00
{
2021-10-19 23:04:38 +02:00
placeholderMaterial = new MaterialAsset(std::filesystem::absolute("./shaders/Placeholder.asset"));
placeholderMaterial->load();
2020-09-19 14:36:50 +02:00
graphics->getShaderCompiler()->registerMaterial(placeholderMaterial);
2020-06-02 11:46:18 +02:00
}
MaterialLoader::~MaterialLoader()
{
}
2021-10-19 23:04:38 +02:00
PMaterialAsset MaterialLoader::queueAsset(const std::filesystem::path& filePath)
2020-06-02 11:46:18 +02:00
{
2021-10-19 23:04:38 +02:00
PMaterialAsset result = new MaterialAsset(filePath);
result->load();
2020-09-19 14:36:50 +02:00
graphics->getShaderCompiler()->registerMaterial(result);
2020-10-03 11:00:10 +02:00
AssetRegistry::get().registerMaterial(result);
2020-06-08 01:44:47 +02:00
// TODO: There is actually no real reason to import a standalone material,
// maybe in the future there could be a substance loader or something
2020-06-02 11:46:18 +02:00
return result;
}
2020-10-03 11:00:10 +02:00
2021-10-19 23:04:38 +02:00
PMaterialAsset MaterialLoader::getPlaceHolderMaterial()
2020-10-03 11:00:10 +02:00
{
return placeholderMaterial;
}