diff options
Diffstat (limited to 'src/o3d/mesh.cpp')
-rw-r--r-- | src/o3d/mesh.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/o3d/mesh.cpp b/src/o3d/mesh.cpp new file mode 100644 index 0000000..7da77aa --- /dev/null +++ b/src/o3d/mesh.cpp @@ -0,0 +1,33 @@ +#include "o3d/mesh.h" +#include <vector> +#include <array> +#include "math/math_vector.h" +#include "o3d/vertex.h" + +using namespace engine::o3d; + +Mesh Mesh::cube() { + return { + { + { engine::math::MathVector3(-1.f, -1.f, -1.f), {} }, + { engine::math::MathVector3(+1.f, -1.f, -1.f), {} }, + { engine::math::MathVector3(-1.f, +1.f, -1.f), {} }, + { engine::math::MathVector3(+1.f, +1.f, -1.f), {} }, + { engine::math::MathVector3(-1.f, -1.f, +1.f), {} }, + { engine::math::MathVector3(+1.f, -1.f, +1.f), {} }, + { engine::math::MathVector3(-1.f, +1.f, +1.f), {} }, + { engine::math::MathVector3(+1.f, +1.f, +1.f), {} }, + }, + { + { 0, 2, 3 }, { 0, 3, 1 }, // face 1 + { 0, 4, 6 }, { 0, 6, 2 }, // face 2 + { 0, 1, 5 }, { 0, 5, 4 }, // face 3 + { 7, 6, 4 }, { 7, 4, 5 }, // face 4 + { 7, 3, 2 }, { 7, 2, 6 }, // face 5 + { 7, 5, 1 }, { 7, 1, 3 }, // face 6 + } + }; +} + +Mesh::Mesh(std::vector<Vertex3> pts, std::vector<std::array<int, 3>> faces) : pts{pts}, faces{faces} { +} |