-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsmfParser.h
69 lines (55 loc) · 1.43 KB
/
smfParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef SMFPARSER_H
#define SMFPARSER_H
#include <stdio.h>
#include <iostream>
#include <map>
#include <fstream>
#include <sstream>
//Structure defining a winged-edge
struct W_edge
{
struct Vertex *start, *end;
struct Face *left, *right;
struct W_edge *left_prev, *left_next;
struct W_edge *right_prev, *right_next;
};
//Structure defining a vertex in wionged-egde format
struct Vertex
{
float x, y, z;
struct W_edge *edge;
};
//Structure defining a face in winged-edge format
struct Face
{
struct W_edge * edge;
};
//Structure defining a vector (to be used for normals)
struct GLVector
{
float x, y, z;
};
typedef struct Vertex vertex;
typedef struct Face face;
typedef struct W_edge w_edge;
typedef struct GLVector glvector;
//Global variables
extern int numVertices, numFaces;
extern std::map<int, vertex*> vertexMap;
extern std::map<std::string, w_edge*> wingedEdgeMap;
extern std::map<int, face*> faceMap;
extern std::map<std::string, glvector*> faceNormalMap;
extern std::map<vertex*, glvector*> vertexNormalMap;
//main parser function
int initialize(std::string);
//execute command
std::string exec(const char*);
//find all edges of a face
void findAllEdgesofFace(face*, w_edge**);
//function to find all edges incident to a vertex
void findAllEdgesofVertex(int);
//function to calculate faceNormalHash
std::string faceNormalHash(int, vertex*);
//function to find vertexNormal if exists
glvector* findVertexNormal(vertex*);
#endif