diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fe60dd..e8bdb8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,10 @@ include_directories("${PROJECT_SOURCE_DIR}/thirdparty/include") include(LsystemParser) include_directories(${GENERATED_SOURCE_DIR}) -set(CMAKE_CXX_FLAGS_RELEASE "/MT") -set(CMAKE_CXX_FLAGS_DEBUG "/MTd") +if (MSCV) + set(CMAKE_CXX_FLAGS_RELEASE "/MT") + set(CMAKE_CXX_FLAGS_DEBUG "/MTd") +endif() file(GLOB_RECURSE Pomegranate-NONGENERATED_SRC "${PROJECT_SOURCE_DIR}/src/*.cpp") set(Pomegranate_SRC diff --git a/src/geo/meshcreator.cpp b/src/geo/meshcreator.cpp index aa5bfaf..1a19da2 100644 --- a/src/geo/meshcreator.cpp +++ b/src/geo/meshcreator.cpp @@ -180,7 +180,7 @@ std::vector geo::MeshCreator::findOutermost std::unordered_map outermostIntersections; for (auto& p : points) { - auto& entry = outermostIntersections.find(p.edge.hash()); + auto entry = outermostIntersections.find(p.edge.hash()); if (entry == outermostIntersections.end() || entry->second->t < p.t) { outermostIntersections[p.edge.hash()] = &p; } diff --git a/src/geo/meshlib.cpp b/src/geo/meshlib.cpp index 555a71b..4fc7a42 100644 --- a/src/geo/meshlib.cpp +++ b/src/geo/meshlib.cpp @@ -1,5 +1,7 @@ #include "meshlib.h" +#include + meshlib::Vertex meshlib::Mesh::addVertex(vec3 p) { VertexData data{p}; size_t handle = getNextHandle(); @@ -68,7 +70,7 @@ void meshlib::Mesh::updateFaceVertices(Face& f, std::vector& verts) { // Clear old data for (const auto& vertexHandle : faceData.vertices) { auto& faces = vertices[vertexHandle].faces; - const auto& found = std::find(faces.begin(), faces.end(), getHandle(f)); + auto found = std::find(faces.begin(), faces.end(), getHandle(f)); if (found != faces.end()) { faces.erase(found); } @@ -101,7 +103,7 @@ std::vector meshlib::Mesh::getFaceUVOverriddenVertices(const Fa bool meshlib::Mesh::getFaceVertexUVOverride(const Face& f, const Vertex& v, vec2& result) { auto& uvOverrides = faces[getHandle(f)].vertexUVOverrides; - auto& found = uvOverrides.find(getHandle(v)); + auto found = uvOverrides.find(getHandle(v)); if (found == uvOverrides.end()) return false; result = found->second; @@ -119,12 +121,12 @@ void meshlib::Mesh::mergeVertices(Vertex& a, Vertex& b) { auto& facesContainingA = vertices[getHandle(a)].faces; auto& facesContainingB = vertices[getHandle(b)].faces; for (auto& face : facesContainingB) { - auto& found = std::find(facesContainingA.begin(), facesContainingA.end(), face); + auto found = std::find(facesContainingA.begin(), facesContainingA.end(), face); // Get UV coordinate of B on current face vec2 uvB; auto& vertexUVOverrides = faces[face].vertexUVOverrides; - auto& foundUVOverride = vertexUVOverrides.find(getHandle(b)); + auto foundUVOverride = vertexUVOverrides.find(getHandle(b)); if (foundUVOverride != vertexUVOverrides.end()) { uvB = foundUVOverride->second; vertexUVOverrides.erase(foundUVOverride); @@ -156,7 +158,7 @@ void meshlib::Mesh::mergeVertices(Vertex& a, Vertex& b) { } } - auto& foundUVOverride = vertexUVOverrides.find(getHandle(a)); + auto foundUVOverride = vertexUVOverrides.find(getHandle(a)); if (foundUVOverride != vertexUVOverrides.end()) { vec2 uvA = vertexUVOverrides[getHandle(a)]; vertexUVOverrides[getHandle(a)] = (uvA + uvB) / 2.0f; @@ -207,7 +209,7 @@ void meshlib::Mesh::toOBJ(std::ostream& out) { out << "f "; for (const auto& v : face.second.vertices) { const auto vertexIndex = vertexIndices[v]; - auto& found = uvOverrideIndices.find(v); + auto found = uvOverrideIndices.find(v); const auto uvIndex = (found != uvOverrideIndices.end()) ? found->second : vertexIndex; out << vertexIndex << "/" << uvIndex << " "; }