55 lines
No EOL
979 B
C++
55 lines
No EOL
979 B
C++
#pragma once
|
|
|
|
#include <asset.hpp>
|
|
#include <log.hpp>
|
|
#include <utility.hpp>
|
|
#include <filesystem.hpp>
|
|
|
|
#include "modelimporter.hpp"
|
|
|
|
class Model : public Asset
|
|
{
|
|
public:
|
|
Model(const std::string& path)
|
|
{
|
|
m_filepath = path;
|
|
}
|
|
|
|
void Load(Renderer*) override
|
|
{
|
|
ImportedModel imported = ModelImporter::Import(m_filepath);
|
|
submeshes = imported.submeshes;
|
|
submaterials = imported.submaterials;
|
|
|
|
m_loaded = true;
|
|
}
|
|
|
|
void Unload(Renderer*) override
|
|
{
|
|
submeshes.clear();
|
|
submaterials.clear();
|
|
|
|
m_loaded = false;
|
|
}
|
|
|
|
std::string GetName() override
|
|
{
|
|
return Utility::GetFilename(m_filepath);
|
|
}
|
|
|
|
std::string GetPath() override
|
|
{
|
|
return m_filepath;
|
|
}
|
|
|
|
std::type_index GetType() override
|
|
{
|
|
return typeid(Model);
|
|
}
|
|
|
|
std::vector<Submesh> submeshes;
|
|
std::vector<Submaterial> submaterials;
|
|
|
|
private:
|
|
std::string m_filepath;
|
|
}; |