write shit
This commit is contained in:
@@ -1,13 +1,57 @@
|
||||
#include "object_loader.hpp"
|
||||
#include "anime_loader.hpp"
|
||||
|
||||
using ::basalt::shared::math::Triangle;
|
||||
using ::basalt::shared::math::Vector3;
|
||||
|
||||
namespace basalt::shared::object_loader {
|
||||
|
||||
IObjectLoader::IObjectLoader() {
|
||||
#pragma region Object
|
||||
|
||||
Object::Object(std::vector<Vector3>&& vertices, std::vector<Triangle>&& triangles) :
|
||||
vertices(std::move(vertices)), triangles(std::move(triangles)) {}
|
||||
|
||||
Object::~Object() {}
|
||||
|
||||
size_t Object::get_vertices_count() const {
|
||||
return this->vertices.size();
|
||||
}
|
||||
|
||||
IObjectLoader::~IObjectLoader() {
|
||||
|
||||
const math::Vector3* Object::get_vertices() const {
|
||||
return this->vertices.data();
|
||||
}
|
||||
|
||||
}
|
||||
size_t Object::get_triangle_count() const {
|
||||
return this->triangles.size();
|
||||
}
|
||||
|
||||
const math::Triangle* Object::get_triangles() const {
|
||||
return this->triangles.data();
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
#pragma region Object Loader
|
||||
|
||||
IObjectLoader::IObjectLoader() : status(ObjectLoaderStatus::Ready) {}
|
||||
|
||||
IObjectLoader::~IObjectLoader() {}
|
||||
|
||||
void IObjectLoader::load() {
|
||||
if (this->status != ObjectLoaderStatus::Ready) throw std::runtime_error("unexpected object loader status");
|
||||
this->status = ObjectLoaderStatus::Loaded;
|
||||
}
|
||||
|
||||
const Object& IObjectLoader::get_object(size_t index) const {
|
||||
if (this->status != ObjectLoaderStatus::Loaded) throw std::runtime_error("unexpected object loader status");
|
||||
return this->objects.at(index);
|
||||
}
|
||||
|
||||
size_t IObjectLoader::get_object_count() const {
|
||||
if (this->status != ObjectLoaderStatus::Loaded) throw std::runtime_error("unexpected object loader status");
|
||||
return this->objects.size();
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
} // namespace basalt::shared::object_loader
|
||||
|
||||
Reference in New Issue
Block a user