finish obj loader
This commit is contained in:
@@ -37,8 +37,9 @@ namespace basalt::shared::object_loader {
|
||||
|
||||
IObjectLoader::~IObjectLoader() {}
|
||||
|
||||
void IObjectLoader::load() {
|
||||
void IObjectLoader::load(ObjectLoaderConfig&& config) {
|
||||
if (this->status != ObjectLoaderStatus::Ready) throw std::runtime_error("unexpected object loader status");
|
||||
this->config = std::move(config);
|
||||
this->status = ObjectLoaderStatus::Loaded;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "math.hpp"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace basalt::shared::object_loader {
|
||||
|
||||
@@ -20,6 +21,10 @@ namespace basalt::shared::object_loader {
|
||||
std::vector<math::Triangle> triangles;
|
||||
};
|
||||
|
||||
struct ObjectLoaderConfig {
|
||||
std::string filename;
|
||||
};
|
||||
|
||||
enum class ObjectLoaderStatus {
|
||||
Ready,
|
||||
Loaded,
|
||||
@@ -37,12 +42,13 @@ namespace basalt::shared::object_loader {
|
||||
virtual ~IObjectLoader();
|
||||
|
||||
public:
|
||||
virtual void load();
|
||||
virtual void load(ObjectLoaderConfig&& config);
|
||||
const Object& get_object(size_t index) const;
|
||||
size_t get_object_count() const;
|
||||
|
||||
protected:
|
||||
ObjectLoaderStatus status;
|
||||
ObjectLoaderConfig config;
|
||||
std::vector<Object> objects;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user