initial commit
This commit is contained in:
commit
54f87ce8d7
26
Makefile
Normal file
26
Makefile
Normal file
@ -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
|
17
src/main.cpp
Normal file
17
src/main.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "my_mesh.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
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;
|
||||
}
|
28
src/my_mesh.h
Normal file
28
src/my_mesh.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef MY_MESH_H
|
||||
#define MY_MESH_H
|
||||
|
||||
#include <OpenMesh/Core/IO/MeshIO.hh>
|
||||
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
||||
#include <OpenMesh/Core/Geometry/VectorT.hh>
|
||||
|
||||
|
||||
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<MyTraits> MyMesh;
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user