Moving from gitlab
This commit is contained in:
29
srcs/Model.cpp
Normal file
29
srcs/Model.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <FilesystemHelper.hpp>
|
||||
#include <Model.hpp>
|
||||
#include <filesystem>
|
||||
|
||||
namespace Ley {
|
||||
|
||||
Model::Model(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 = rl::LoadModel(_obj_path.c_str());
|
||||
std::filesystem::path texture_path(texture);
|
||||
_texture_path = to_utf8(asset_path / texture_path);
|
||||
_texture = rl::LoadTexture(_texture_path.c_str());
|
||||
_model.materials[0].maps[rl::MATERIAL_MAP_DIFFUSE].texture = _texture;
|
||||
_position = {0.0f, 0.0f, 0.0f};
|
||||
}
|
||||
|
||||
Model::~Model() {
|
||||
rl::UnloadTexture(_texture);
|
||||
rl::UnloadModel(_model);
|
||||
}
|
||||
|
||||
Model Model::create(const std::string &obj_path,
|
||||
const std::string &texture_path) {
|
||||
return Model(obj_path, texture_path);
|
||||
}
|
||||
|
||||
} // namespace Ley
|
||||
Reference in New Issue
Block a user