aboutsummaryrefslogtreecommitdiff
path: root/src/o3d/mesh.hpp
blob: d1d3f1c747eb7726b8239a1bdf6682ca40d4178c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef O3D_MESH_HPP
#define O3D_MESH_HPP

#include <vector>
#include <array>
#include <iterator>
#include <cstdint>
#include <cstddef>
#include <tuple>
#include "math/vector.hpp"
#include "vulkan_utils.hpp"

namespace engine::o3d {

struct Mesh {
    static Mesh plane(float width, float height);

    std::vector<engine::math::Vector3> vertices;
    std::vector<engine::math::Vector3> normals;
    std::vector<engine::math::Vector2> uvs;
    std::vector<std::array<std::array<size_t, 3>, 3>> indices;

    // TODO: find a better way to do this. This workaround is due to the fact that vulkan only
    // accepts a single index, not an index for each attributes
    std::tuple<std::vector<engine::vk::Vertex>, std::vector<uint16_t>> linearize_indices() const &;
};

}

#endif // O3D_MESH_HPP