Commits

Lazar Sumar committed 3144f1c

Made the code Mac OS X friendly.

Comments (0)

Files changed (7)

MeshSimplification/HEdge.cpp

 	last_file = filename;
 	cout << " \"" << filename << "\"..." << endl;
 
-	fp_in.open(filename, ios::in);
+	fp_in.open(filename.c_str(), ios::in);
 	if(!fp_in.is_open())
 	{
 		cout << "Error opening mesh file" << endl;

MeshSimplification/HEdge.h

 #include <map>
 #include <vector>
 #include <utility>
+#ifdef __APPLE__
+#include <OpenGL/OpenGL.h>
+#include <GLUT/glut.h>
+#else
 #include <GL/glut.h>
+#endif
 
 #include "Vector3.h"
 

MeshSimplification/collapse.h

 #include <string>
 #include <map>
 #include <utility>
+#ifdef __APPLE__
+#include <OpenGL/OpenGL.h>
+#include <GLUT/glut.h>
+#else
 #include <GL/glut.h>
+#endif
 
 #include "Vector3.h"
 #include "HEdge.h"

MeshSimplification/decimation.cpp

 int decimate(HE_vert* vert, map<int, HE_vert*>& del_verts, bool save_boundary) {
 	vector<HE_vert*> boundary;
 	vector<HE_face*> new_faces;
-	vector<pair<pair<int, int>, int>> new_faces_points;
+	vector<pair<pair<int, int>, int> > new_faces_points;
 	int ret;
 	int error_count = 0;
 
 	ret = retriangulate_boundary(vert, boundary, &new_faces, &new_faces_points);
 	
 	vector<HE_face*>::iterator nfiter = new_faces.begin();
-	vector<pair<pair<int, int>, int>>::iterator nfpiter = new_faces_points.begin();
+	vector<pair<pair<int, int>, int> >::iterator nfpiter = new_faces_points.begin();
 	for (; nfiter != new_faces.end() && nfpiter != new_faces_points.end(); nfiter++, nfpiter++) {
 		if (!test_face(*nfiter, nfpiter->first.first, nfpiter->first.second, nfpiter->second)) {
 			error_count--;
 //============================================================
 
 int retriangulate_boundary(HE_vert* vert, vector<HE_vert*>& boundary, 
-	vector<HE_face*>* new_faces, vector<pair<pair<int, int>, int>>* new_faces_points) {
+	vector<HE_face*>* new_faces, vector<pair<pair<int, int>, int> >* new_faces_points) {
 
 	pair<int, int> e1, e2, e3;
 	int sz = boundary.size();

MeshSimplification/decimation.h

 int delete_vertex(HE_vert* vert, map<int, HE_vert*>& del_verts);
 int construct_boundary(HE_vert* vert, vector<HE_vert*>& boundary);
 int retriangulate_boundary(HE_vert* vert, vector<HE_vert*>& boundary, 
-	vector<HE_face*>* new_faces = NULL, vector<pair<pair<int, int>, int>>* new_faces_points = NULL);
+	vector<HE_face*>* new_faces = NULL, vector<pair<pair<int, int>, int> >* new_faces_points = NULL);
 
 double local_curvature(HE_vert* vert, int type = NORMAL_DOT_PRODUCT);
 double normal_dot_product(HE_vert* vert);

MeshSimplification/main.cpp

 #include <string>
 #include <map>
 #include <utility>
+#ifdef __APPLE__
+#include <OpenGL/OpenGL.h>
+#include <GLUT/glut.h>
+#else
 #include <GL/glut.h>
+#endif
 
 #include "HEdge.h"
 #include "decimation.h"

MeshSimplification/makefile

+# Mesh simplification Mac OS X makefile
+# author: Lazar Sumar
+CC=g++
+CFLAGS=-c -Wall
+# Mac OS X specific library flags
+LDFLAGS=-framework OpenGL -framework GLUT
+HEADERS=Vector3.h util.h HEdge.h collapse.h decimation.h
+SOURCES=main.cpp Vector3.cpp util.cpp HEdge.cpp collapse.cpp decimation.cpp
+OBJECTS=$(SOURCES:.cpp=.o)
+EXECUTABLE=meshsimp
+
+all: $(SOURCES) $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS) 
+	$(CC) $(LDFLAGS) $(OBJECTS) -o $@
+
+.cpp.o:
+	$(CC) $(CFLAGS) $< -o $@