From 3de3a6861ede55e1835fe8c4b9b448443809c380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 22 Feb 2013 01:19:00 +0100 Subject: [PATCH] MeshTools: got rid of Point2D/3D in favor of Vector2/Vector3. --- src/MeshTools/CombineIndexedArrays.h | 2 +- src/MeshTools/GenerateFlatNormals.cpp | 10 +++++----- src/MeshTools/GenerateFlatNormals.h | 4 ++-- src/MeshTools/Test/GenerateFlatNormalsTest.cpp | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/MeshTools/CombineIndexedArrays.h b/src/MeshTools/CombineIndexedArrays.h index cb8d0bbd4..07cef4980 100644 --- a/src/MeshTools/CombineIndexedArrays.h +++ b/src/MeshTools/CombineIndexedArrays.h @@ -106,7 +106,7 @@ of some STL functions like shown below. Also if one index array is shader by more than one attribute array, just pass the index array more times. Example: @code std::vector vertexIndices; -std::vector positions; +std::vector positions; std::vector normalTextureIndices; std::vector normals; std::vector textureCoordinates; diff --git a/src/MeshTools/GenerateFlatNormals.cpp b/src/MeshTools/GenerateFlatNormals.cpp index 0ea2de883..2c5195728 100644 --- a/src/MeshTools/GenerateFlatNormals.cpp +++ b/src/MeshTools/GenerateFlatNormals.cpp @@ -15,12 +15,12 @@ #include "GenerateFlatNormals.h" -#include "Math/Point3D.h" +#include "Math/Vector3.h" #include "MeshTools/Clean.h" namespace Magnum { namespace MeshTools { -std::tuple, std::vector> generateFlatNormals(const std::vector& indices, const std::vector& positions) { +std::tuple, std::vector> generateFlatNormals(const std::vector& indices, const std::vector& positions) { CORRADE_ASSERT(!(indices.size()%3), "MeshTools::generateFlatNormals(): index count is not divisible by 3!", (std::tuple, std::vector>())); /* Create normal for every triangle (assuming counterclockwise winding) */ @@ -29,8 +29,8 @@ std::tuple, std::vector> generateFlatNormals std::vector normals; normals.reserve(indices.size()/3); for(std::size_t i = 0; i != indices.size(); i += 3) { - Vector3 normal = Vector3::cross(positions[indices[i+2]].xyz()-positions[indices[i+1]].xyz(), - positions[indices[i]].xyz()-positions[indices[i+1]].xyz()).normalized(); + Vector3 normal = Vector3::cross(positions[indices[i+2]]-positions[indices[i+1]], + positions[indices[i]]-positions[indices[i+1]]).normalized(); /* Use the same normal for all three vertices of the face */ normalIndices.push_back(normals.size()); @@ -40,7 +40,7 @@ std::tuple, std::vector> generateFlatNormals } /* Clean duplicate normals and return */ - clean(normalIndices, normals); + MeshTools::clean(normalIndices, normals); return std::make_tuple(normalIndices, normals); } diff --git a/src/MeshTools/GenerateFlatNormals.h b/src/MeshTools/GenerateFlatNormals.h index 35a6e8047..cdccb6d7e 100644 --- a/src/MeshTools/GenerateFlatNormals.h +++ b/src/MeshTools/GenerateFlatNormals.h @@ -39,7 +39,7 @@ For each face generates one normal vector, removes duplicates before returning. Example usage: @code std::vector vertexIndices; -std::vector positions; +std::vector positions; std::vector normalIndices; std::vector normals; @@ -51,7 +51,7 @@ use the same indices. @attention Index count must be divisible by 3, otherwise zero length result is generated. */ -std::tuple, std::vector> MAGNUM_MESHTOOLS_EXPORT generateFlatNormals(const std::vector& indices, const std::vector& positions); +std::tuple, std::vector> MAGNUM_MESHTOOLS_EXPORT generateFlatNormals(const std::vector& indices, const std::vector& positions); }} diff --git a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp b/src/MeshTools/Test/GenerateFlatNormalsTest.cpp index 64107680e..25a867e82 100644 --- a/src/MeshTools/Test/GenerateFlatNormalsTest.cpp +++ b/src/MeshTools/Test/GenerateFlatNormalsTest.cpp @@ -16,7 +16,7 @@ #include #include -#include "Math/Point3D.h" +#include "Math/Vector3.h" #include "MeshTools/GenerateFlatNormals.h" namespace Magnum { namespace MeshTools { namespace Test {