1
0
Files
BasaltMeter/BasaltPresenter/Shared/basalt/object_loader.hpp
2026-01-09 22:50:24 +08:00

56 lines
1.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#include "math.hpp"
#include <vector>
#include <string>
namespace basalt::shared::object_loader {
class Object {
public:
Object(std::vector<math::Vector3>&& vertices, std::vector<math::Triangle>&& triangles);
~Object();
public:
size_t get_vertices_count() const;
const math::Vector3* get_vertices() const;
size_t get_triangle_count() const;
const math::Triangle* get_triangles() const;
private:
std::vector<math::Vector3> vertices;
std::vector<math::Triangle> triangles;
};
struct ObjectLoaderConfig {
std::string filename;
};
enum class ObjectLoaderStatus {
Ready,
Loaded,
};
/**
* @brief
* @details
* \li 加载的模型的坐标系与Blender一致。
* \li 加载的模型的顶点顺序为CCW即右手定则确认法线方向。
*/
class IObjectLoader {
public:
IObjectLoader();
virtual ~IObjectLoader();
public:
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;
};
} // namespace basalt::shared::object_loader