Skip to content

Commit

Permalink
Fixed issues with building on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
i-yam-jeremy committed Mar 19, 2021
1 parent 3411ff9 commit d53ea83
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/geo/meshcreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ std::vector<geo::MeshCreator::IntersectionPoint> geo::MeshCreator::findOutermost
std::unordered_map<size_t, IntersectionPoint*> 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;
}
Expand Down
14 changes: 8 additions & 6 deletions src/geo/meshlib.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "meshlib.h"

#include <algorithm>

meshlib::Vertex meshlib::Mesh::addVertex(vec3 p) {
VertexData data{p};
size_t handle = getNextHandle();
Expand Down Expand Up @@ -68,7 +70,7 @@ void meshlib::Mesh::updateFaceVertices(Face& f, std::vector<Vertex>& 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);
}
Expand Down Expand Up @@ -101,7 +103,7 @@ std::vector<meshlib::Vertex> 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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 << " ";
}
Expand Down

0 comments on commit d53ea83

Please sign in to comment.