30 lines
832 B
C++
30 lines
832 B
C++
#include <FilesystemHelper.hpp>
|
|
#include <Model.hpp>
|
|
#include <filesystem>
|
|
|
|
namespace Ley {
|
|
|
|
cModel::cModel(const std::string &obj, const std::string &texture) {
|
|
std::filesystem::path asset_path("assets");
|
|
std::filesystem::path obj_path(obj);
|
|
_obj_path = to_utf8(asset_path / obj_path);
|
|
_model = LoadModel(_obj_path.c_str());
|
|
std::filesystem::path texture_path(texture);
|
|
_texture_path = to_utf8(asset_path / texture_path);
|
|
_texture = LoadTexture(_texture_path.c_str());
|
|
_model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = _texture;
|
|
_position = {0.0f, 0.0f, 0.0f};
|
|
}
|
|
|
|
cModel::~cModel() {
|
|
UnloadTexture(_texture);
|
|
UnloadModel(_model);
|
|
}
|
|
|
|
cModel cModel::create(const std::string &obj_path,
|
|
const std::string &texture_path) {
|
|
return cModel(obj_path, texture_path);
|
|
}
|
|
|
|
} // namespace Ley
|