diff options
author | vimene <vincent.menegaux@gmail.com> | 2023-12-11 12:42:46 +0100 |
---|---|---|
committer | vimene <vincent.menegaux@gmail.com> | 2023-12-11 12:42:46 +0100 |
commit | 6b765a85cf81bf4b7162e4c9280dd4054581c611 (patch) | |
tree | 4156dff7c632e6511fe18daebeea506744ad1ff7 /src/o3d/mesh.h | |
parent | ff2c784d4c4100f0301628e8a52a6910d776d067 (diff) | |
download | engine-6b765a85cf81bf4b7162e4c9280dd4054581c611.tar.gz |
improved mesh definition
- In the context of mesh definition, splited
indices into vertex index, normal index and
vertex data index to be able to specify
different normals and vertex data for
different faces using the same vertex
Diffstat (limited to 'src/o3d/mesh.h')
-rw-r--r-- | src/o3d/mesh.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/o3d/mesh.h b/src/o3d/mesh.h index 34d1e09..4aad0e4 100644 --- a/src/o3d/mesh.h +++ b/src/o3d/mesh.h @@ -4,7 +4,9 @@ #include <vector> #include <array> #include <iterator> -#include "o3d/vertex.h" +#include <cstddef> +#include "math/vector.h" +#include "o3d/vertex_data.h" namespace engine::o3d { @@ -13,10 +15,15 @@ class Mesh { // static Mesh cube(); // this function should not be in this file static Mesh plane(); // this function should not be in this file - std::vector<Vertex3> pts; - std::vector<std::array<int, 3>> faces; + std::vector<engine::math::Vector4> vertices; + std::vector<engine::math::Vector3> normals; + std::vector<VertexData> vertices_data; + std::vector<std::array<std::array<std::size_t, 3>, 3>> indices; - Mesh(std::vector<Vertex3> pts, std::vector<std::array<int, 3>> faces); + Mesh(std::vector<engine::math::Vector4> vertices, + std::vector<engine::math::Vector3> normals, + std::vector<VertexData> vertices_data, + std::vector<std::array<std::array<std::size_t, 3>, 3>> indices); }; } |