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

35 lines
998 B
C++
Raw Normal View History

2020-06-02 11:46:18 +02:00
#include "MaterialLoader.h"
#include "Material/Material.h"
#include "Graphics/Graphics.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
{
2020-09-19 14:36:50 +02:00
placeholderMaterial = new Material(std::filesystem::absolute("./shaders/Placeholder.asset"));
2020-06-02 11:46:18 +02:00
placeholderMaterial->compile();
2020-09-19 14:36:50 +02:00
graphics->getShaderCompiler()->registerMaterial(placeholderMaterial);
2020-06-02 11:46:18 +02:00
}
MaterialLoader::~MaterialLoader()
{
}
2020-06-08 01:44:47 +02:00
PMaterial MaterialLoader::queueAsset(const std::filesystem::path& filePath)
2020-06-02 11:46:18 +02:00
{
PMaterial result = new Material(filePath);
2020-09-19 14:36:50 +02:00
result->compile();
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
PMaterial MaterialLoader::getPlaceHolderMaterial()
{
return placeholderMaterial;
}