Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
graphite/engine/assets/include/model.hpp

55 lines
979 B
C++
Raw Permalink Normal View History

2024-01-03 16:05:02 -05:00
#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;
};