commit 54f87ce8d7c38e0de94a789bc126d3eec735744b Author: ccolin Date: Wed Sep 23 14:54:08 2020 +0200 initial commit diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e2c9381 --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +CC := g++ -Wall -Wextra -Wpedantic -Iinclude -Ilibs/OpenMesh/inc -g + +LDFLAGS := $(LDFLAGS) -Llibs/OpenMesh/liblinux/ -lOpenMeshCore +CFLAGS := $(CFLAGS) + +BUILD_DIR ?= build + +OUT := $(notdir $(shell pwd)) + +SRC := $(wildcard src/*.cpp) +OBJS := $(patsubst src/%.cpp,$(BUILD_DIR)/%.o,$(SRC)) +DEPS := $(wildcard $(BUILD_DIR)/*.d) + + +$(BUILD_DIR)/$(OUT): $(OBJS) + $(CC) $(LDFLAGS) -o $@ $^ + + +-include $(DEPS) +$(BUILD_DIR)/%.o: src/%.cpp + $(CC) $(CFLAGS) -MP -MD $< -c -o $@ + + +clean: + -rm -f $(BUILD_DIR)/*.o + -rm -f $(BUILD_DIR)/*.d diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..dd0671c --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,17 @@ +#include "my_mesh.h" + +#include + + +int main(int argc, char *argv[]) { + using namespace std; + + if (argc != 2) { + cerr << "Utilisation : " << argv[0] << " [fichier.obj]" << endl; + return 1; + } + MyMesh mesh; + OpenMesh::IO::read_mesh(mesh, argv[1]); + + return 0; +} diff --git a/src/my_mesh.h b/src/my_mesh.h new file mode 100644 index 0000000..0ca0ce0 --- /dev/null +++ b/src/my_mesh.h @@ -0,0 +1,28 @@ +#ifndef MY_MESH_H +#define MY_MESH_H + +#include +#include +#include + + +using namespace OpenMesh; +using namespace OpenMesh::Attributes; + +struct MyTraits : public OpenMesh::DefaultTraits { + // use vertex normals and vertex colors + VertexAttributes( OpenMesh::Attributes::Normal | OpenMesh::Attributes::Color ); + // store the previous halfedge + HalfedgeAttributes( OpenMesh::Attributes::PrevHalfedge ); + // use face normals face colors + FaceAttributes( OpenMesh::Attributes::Normal | OpenMesh::Attributes::Color ); + EdgeAttributes( OpenMesh::Attributes::Color ); + // vertex thickness + VertexTraits{float thickness; float value; Color faceShadingColor;}; + // edge thickness + EdgeTraits{float thickness;}; +}; +typedef OpenMesh::TriMesh_ArrayKernelT MyMesh; + + +#endif