#include "o3d/mesh.h" #include #include #include "math/vector.h" #include "o3d/vertex.h" using namespace engine::o3d; // Mesh Mesh::cube() { // return { // { // { engine::math::Vector3(-1.f, -1.f, -1.f), {} }, // { engine::math::Vector3(+1.f, -1.f, -1.f), {} }, // { engine::math::Vector3(-1.f, +1.f, -1.f), {} }, // { engine::math::Vector3(+1.f, +1.f, -1.f), {} }, // { engine::math::Vector3(-1.f, -1.f, +1.f), {} }, // { engine::math::Vector3(+1.f, -1.f, +1.f), {} }, // { engine::math::Vector3(-1.f, +1.f, +1.f), {} }, // { engine::math::Vector3(+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::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} }, }, { { 0, 1, 2 }, { 2, 3, 0 }, } }; } Mesh::Mesh(std::vector pts, std::vector> faces) : pts{pts}, faces{faces} { }