diff options
Diffstat (limited to 'src/o3d/mesh.cpp')
-rw-r--r-- | src/o3d/mesh.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/o3d/mesh.cpp b/src/o3d/mesh.cpp index bf60cc8..2dba328 100644 --- a/src/o3d/mesh.cpp +++ b/src/o3d/mesh.cpp @@ -1,8 +1,8 @@ #include "o3d/mesh.h" #include <vector> #include <array> +#include <cstddef> #include "math/vector.h" -#include "o3d/vertex.h" using namespace engine::o3d; @@ -32,16 +32,30 @@ using namespace engine::o3d; Mesh Mesh::plane() { return { { - { engine::math::Vector3(-1.f, 0.f, -1.f), {0.f, 0.f} }, - { engine::math::Vector3(+1.f, 0.f, -1.f), {1.f, 0.f} }, - { engine::math::Vector3(+1.f, 0.f, +1.f), {1.f, 1.f} }, - { engine::math::Vector3(-1.f, 0.f, +1.f), {0.f, 1.f} }, + {-1.f, 0.f, -1.f, 1.f}, + {+1.f, 0.f, -1.f, 1.f}, + {+1.f, 0.f, +1.f, 1.f}, + {-1.f, 0.f, +1.f, 1.f}, }, + { {0.f, 0.f, -1.f} }, { - { 0, 1, 2 }, { 2, 3, 0 }, + {0.f, 0.f}, + {1.f, 0.f}, + {1.f, 1.f}, + {0.f, 1.f}, + }, + { + {{ {{0, 0, 0}}, {{1, 0, 1}}, {{2, 0, 2}} }}, + {{ {{2, 0, 2}}, {{3, 0, 3}}, {{0, 0, 0}} }}, + {{ {{0, 0, 0}}, {{3, 0, 3}}, {{2, 0, 2}} }}, + {{ {{2, 0, 2}}, {{1, 0, 1}}, {{0, 0, 0}} }}, } }; } -Mesh::Mesh(std::vector<Vertex3> pts, std::vector<std::array<int, 3>> faces) : pts{pts}, faces{faces} { +Mesh::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) + : vertices{vertices}, normals{normals}, vertices_data{vertices_data}, indices{indices} { } |