2022-09-02 11:06:59 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-09-07 09:02:01 +00:00
|
|
|
#include "engine_api.h"
|
2022-09-02 23:02:09 +00:00
|
|
|
|
2022-09-02 11:06:59 +00:00
|
|
|
#include "resource.hpp"
|
|
|
|
|
2022-10-24 08:34:09 +00:00
|
|
|
#include "gfx.hpp"
|
2022-09-02 11:06:59 +00:00
|
|
|
|
|
|
|
#include <glm/vec3.hpp>
|
|
|
|
#include <glm/vec2.hpp>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
struct Vertex {
|
|
|
|
glm::vec3 pos;
|
|
|
|
glm::vec3 norm;
|
|
|
|
glm::vec2 uv;
|
|
|
|
};
|
|
|
|
|
2022-10-06 10:30:44 +00:00
|
|
|
namespace engine::resources {
|
2022-09-02 11:06:59 +00:00
|
|
|
|
2022-09-03 04:56:51 +00:00
|
|
|
class ENGINE_API Mesh : public Resource {
|
2022-09-02 11:06:59 +00:00
|
|
|
|
|
|
|
public:
|
2022-10-27 16:58:30 +00:00
|
|
|
Mesh(const std::vector<Vertex>& vertices);
|
|
|
|
Mesh(const std::vector<Vertex>& vertices, const std::vector<uint32_t>& indices);
|
|
|
|
Mesh(const std::filesystem::path& resPath);
|
2022-09-02 11:06:59 +00:00
|
|
|
~Mesh() override;
|
|
|
|
|
|
|
|
std::vector<Vertex> m_vertices;
|
2022-10-24 08:34:09 +00:00
|
|
|
std::vector<uint32_t> m_indices;
|
2022-09-02 11:06:59 +00:00
|
|
|
|
2022-10-24 08:34:09 +00:00
|
|
|
const gfx::Buffer* vb;
|
|
|
|
const gfx::Buffer* ib;
|
2022-09-02 11:06:59 +00:00
|
|
|
|
2022-10-27 16:58:30 +00:00
|
|
|
private:
|
2022-09-02 11:06:59 +00:00
|
|
|
|
|
|
|
void initMesh();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|