diff --git a/common/mesh.cc b/common/mesh.cc index 4aec08c8..f7555680 100644 --- a/common/mesh.cc +++ b/common/mesh.cc @@ -25,7 +25,7 @@ using namespace std; -mesh_t buildMesh(const vector> &faces) +mesh_t buildMesh(const vector> &faces) { // FIXME: this is ugly using pos_t = tuple; @@ -55,11 +55,11 @@ mesh_t buildMesh(const vector> &faces) } // convert posToVertIndex to a vector - vector vertsVec; + vector vertsVec; vertsVec.resize(posToVertIndex.size()); for (const auto &posIndex : posToVertIndex) { const pos_t &pos = posIndex.first; - vertsVec.at(posIndex.second) = glm::vec3(std::get<0>(pos), std::get<1>(pos), std::get<2>(pos)); + vertsVec.at(posIndex.second) = qvec3f(std::get<0>(pos), std::get<1>(pos), std::get<2>(pos)); } mesh_t res; @@ -68,13 +68,13 @@ mesh_t buildMesh(const vector> &faces) return res; } -std::vector> meshToFaces(const mesh_t &mesh) +std::vector> meshToFaces(const mesh_t &mesh) { - std::vector> res; + std::vector> res; for (const auto &meshFace : mesh.faces) { - std::vector points; + std::vector points; for (int vertIndex : meshFace) { - const glm::vec3 point = mesh.verts.at(vertIndex); + const qvec3f point = mesh.verts.at(vertIndex); points.push_back(point); } res.push_back(points); diff --git a/include/common/mesh.hh b/include/common/mesh.hh index e7351f8a..c797cb5e 100644 --- a/include/common/mesh.hh +++ b/include/common/mesh.hh @@ -21,17 +21,17 @@ #define __COMMON_MESH_HH__ #include -#include // FIXME: switch to qvec +#include class mesh_t { public: - std::vector verts; + std::vector verts; std::vector> faces; }; // Welds vertices at exactly the same position -mesh_t buildMesh(const std::vector> &faces); -std::vector> meshToFaces(const mesh_t &mesh); +mesh_t buildMesh(const std::vector> &faces); +std::vector> meshToFaces(const mesh_t &mesh); // Preserves the number and order of faces. // doesn't merge verts. diff --git a/light/test_light.cc b/light/test_light.cc index 6a3e89ed..b8ebdb54 100644 --- a/light/test_light.cc +++ b/light/test_light.cc @@ -530,19 +530,19 @@ TEST(mathlib, FractionOfLine) { // mesh_t TEST(mathlib, meshCreate) { - const vector poly1 { + const vector poly1 { { 0,0,0 }, { 0,64,0 }, { 64,64,0 }, { 64,0,0 } }; - const vector poly2 { + const vector poly2 { { 64,0,0 }, { 64,64,0 }, { 128,64,0 }, { 128,0,0 } }; - const vector> polys { poly1, poly2 }; + const vector> polys { poly1, poly2 }; const mesh_t m = buildMesh(polys); ASSERT_EQ(6, m.verts.size()); @@ -564,26 +564,26 @@ TEST(mathlib, meshFixTJuncs) { poly1 should get a vertex inserted at the + */ - const vector poly1 { + const vector poly1 { { 0,0,0 }, { 0,64,0 }, { 64,64,0 }, { 64,0,0 } }; - const vector poly2 { + const vector poly2 { { 64,32,0 }, { 64,64,0 }, { 128,64,0 }, { 128,32,0 } }; - const vector poly3 { + const vector poly3 { { 64,0,0 }, { 64,32,0 }, { 128,32,0 }, { 128,0,0 } }; - const vector> polys { poly1, poly2, poly3 }; + const vector> polys { poly1, poly2, poly3 }; mesh_t m = buildMesh(polys); ASSERT_EQ(8, m.verts.size());