-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathWorkingMesh.h
executable file
·204 lines (143 loc) · 3.36 KB
/
WorkingMesh.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#ifndef WORKINGMESH_INCLUDED
#define WORKINGMESH_INCLUDED
#include "Unwrapper/Unwrap.h"
#include <vector>
#include <set>
#include <maya/MFloatArray.h>
#include <maya/MIntArray.h>
#include <maya/MDagPath.h>
#include <maya/MString.h>
#include <maya/MFnMesh.h>
#include <maya/MFloatPointArray.h>
using namespace std;
struct LinkedEdge
{
int EnteredEdgeIndex1;
int PolygonIndex1;
int EnteredEdgeIndex2;
int PolygonIndex2;
};
class QuickFace
{
public:
~QuickFace()
{
m_VertexIndices.setLength(0);
m_UVIndices.setLength(0);
m_EdgeIndices.setLength(0);
}
bool m_hasUVs;
bool m_selected;
int m_numberOfVerts;
bool m_visited;
MIntArray m_VertexIndices;
MIntArray m_EdgeIndices;
MIntArray m_UVIndices;
};
class QuickEdge
{
public:
~QuickEdge()
{
m_ConnectedFaces.setLength(0);
}
int m_vertexIndex1;
int m_vertexIndex2;
bool m_Split;
int m_thisIndex;
int m_matchedWith;
MIntArray m_ConnectedFaces;
};
class QuickVertex
{
public:
~QuickVertex()
{
m_AttachedFaces.setLength(0);
m_AttachedEdges.setLength(0);
}
MIntArray m_AttachedFaces;
MIntArray m_AttachedEdges;
};
class Block
{
public:
Block()
{
m_doneWith = false;
m_selected = false;
m_UVId = -1;
m_outerEdge1 = -1;
m_outerEdge2 = -1;
m_outerFace1 = -1;
m_outerFace2 = -1;
}
bool m_doneWith;
bool m_selected;
int m_UVId;
int m_outerEdge1;
int m_outerEdge2;
int m_outerFace1;
int m_outerFace2;
};
class WorkingMesh
{
public:
WorkingMesh()
{
m_QuickVerts = NULL;
m_QuickEdges = NULL;
m_QuickFaces = NULL;
m_edgesToCut.clear();
m_untextured = true;
};
~WorkingMesh()
{
if(m_QuickVerts) delete[] m_QuickVerts;
m_QuickVerts = NULL;
if(m_QuickEdges) delete[] m_QuickEdges;
m_QuickEdges = NULL;
if(m_QuickFaces) delete[] m_QuickFaces;
m_QuickFaces = NULL;
m_edgesToCut.clear();
m_UCoords.setLength(0);
m_VCoords.setLength(0);
m_SelectedFaces.setLength(0);
};
MDagPath m_MeshNode;
MIntArray m_SelectedFaces;
MIntArray m_SelectedEdges;
MString m_selUVSet;
MString m_meshNodeName;
void SplitSingletons();
void issuePolyCut(bool hasHistory);
void GetUVToFaceRatio();
void ScaleUVs(double Scale);
void SymmetryCut();
void AddToUnwrapper(Unwrap* pUnwrapper);
void SetNewUVs(Unwrap* pUnwrapper);
// void DeselectEdges();
// void SelectEdges(bool hasHistory, bool AddOrRemove);
bool m_untextured;
double m_UvToFaceRatio;
MFloatArray m_UCoords;
MFloatArray m_VCoords;
private:
void splitWheel(int VertID);
bool growBlock(Block* pBlock, int VertID, MIntArray& wheelFaces, MIntArray& wheelEdges);
int getUVId(int faceIndex, int VertID);
int getEdgeID(int faceIndex, int VertID, bool nextEdge, MIntArray& wheelEdges);
bool CutZeroAreas(QuickFace* pTestFace, MFloatPointArray& vertices);
int FindNinety(int VertIndex1, int VertIndex2, int VertIndex3);
bool MatchUpEdges();
int FindEdgeIndex(int PolyIndex, int EdgeIndex);
void BodgyGetTriangles(MFnMesh& mesh, MIntArray& triangleCounts, MIntArray& triangleVertices);
MString ftransName;
QuickVertex* m_QuickVerts;
QuickEdge* m_QuickEdges;
QuickFace* m_QuickFaces;
set<int> m_edgesToCut;
unsigned int m_numUVs;
int m_UVBase;
};
#endif // WORKINGMESH_INCLUDED