From e730e8bdc69ef89dfa28d2606d260cb8b72f4740 Mon Sep 17 00:00:00 2001 From: vimene Date: Sun, 26 Nov 2023 17:58:30 +0100 Subject: added scenes, camera and meshes --- src/o3d/mesh.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/o3d/mesh.cpp (limited to 'src/o3d/mesh.cpp') 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 +#include +#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 pts, std::vector> faces) : pts{pts}, faces{faces} { +} -- cgit v1.2.3