-
Notifications
You must be signed in to change notification settings - Fork 0
/
PolySurf.h
executable file
·111 lines (94 loc) · 2.76 KB
/
PolySurf.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
* PolySurf.h
*
*
* Created by Donald House on 2/18/11.
* Copyright 2011 Clemson University. All rights reserved.
*
*/
#ifndef __POLYSURF__
#define __POLYSURF__
#include "Vector.h"
#include "Face.h"
#include "Line.h"
#include "Group.h"
#include "Material.h"
class PolySurf{
private:
int nverts, maxverts;
Vector3d *verts;
int nnorms, maxnorms;
Vector3d *norms;
int nuvs, maxuvs;
Vector2d *uvs;
int npoints, maxpoints;
int *points;
int nfaces, maxfaces;
Face *faces;
int nlines, maxlines;
Line *lines;
int ngroups, maxgroups;
Group *groups;
int nmaterials, maxmaterials;
Vector2d *edges;
int nedges, maxedges;
Vector3d *facematches;
int nfm, maxfm;
int *edgegrps;
int neg, mneg;
Vector2d *edgefaces;
int nef, maxef;
Material *materials;
public:
PolySurf();
~PolySurf();
void addVertex(const Vector3d &v);
void addNormal(const Vector3d &n);
Vector3d computeNormal(int face);
void addUV(const Vector2d &u);
void addEdge(const Vector2d &e, int groupid, int fid);
void addEdgeFace(int e, int face);
void addFaceMatch(const Vector3d &fm);
void addPoint(int p);
int newFace(int g, int m);
void addFaceVert(int f, int v, int n = -1, int u = -1);
int newLine();
void addLinePoint(int l, int p);
int setGroup(char *gname);
void addFaceGroup(int f, int g);
int newMaterial(char *mname);
int idxMaterial(char *mname);
void setMaterialK(int m, int k, const Color &c);
void setMaterialTransmission(int m, const Color &c);
void setMaterialAlpha(int m, double alfa);
void setMaterialExp(int m, double spexp);
void setMaterialIOR(int m, double ior);
void setMaterialIllum(int m, int n);
void setMaterialMap(int m, int mtype, Pixmap *p);
// added getters for faces
int getFaceCnt() { return nfaces; }
Vector3d getNormal(int ndx) { return norms[ndx]; }
Face getFaces(int ndx) { return faces[ndx]; }
Vector3d getVert(int ndx) { return verts[ndx]; }
Vector3d getNorm(int ndx) { return norms[ndx]; }
Vector2d getUV(int ndx) { return uvs[ndx]; }
Material getMat(int ndx) { return materials[ndx]; }
int getNMaterials() { return nmaterials; }
int getVertCnt() { return nverts; }
Vector2d getEdge(int indx) { return edges[indx]; }
int getEdgeCnt() { return nedges; }
int getEdgeFaceCnt() { return nef; }
Vector2d getEdgeFace(int indx){ return edgefaces[indx]; }
Vector3d getFaceMatch(int indx) { return facematches[indx]; }
int getFMCnt() { return nfm; }
int getEdgeGrp(int indx) { return edgegrps[indx]; }
Group getGroup(int indx) { return groups[indx]; }
void addFaceMaterial(int f, int m);
Vector3d Centroid();
Vector3d MinBBox();
Vector3d MaxBBox();
void DrawPoints();
void Draw(int wireframe);
friend ostream& operator<< (ostream& os, const PolySurf& ps);
};
#endif