-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMirror.vsl
41 lines (33 loc) · 834 Bytes
/
Mirror.vsl
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
////////////////////////
// Description : Edit by ghomist
extern CKAXIS axis;
extern bool IfCopy;
void main()
{
int count = ac.selection.Size();
for (int i=0; i<count; ++i) {
Entity3D ent = Entity3D.Cast(ac.selection[i]);
if (!ent) continue;
if (IfCopy) {
Entity3D ent1 = Entity3D.Cast(ac.Copy(ent,false,true));
ent = ent1;
}
Mesh m = ent.GetCurrentMesh();
int vCount = m.GetVertexCount();
for (int ind=0; ind<vCount; ind++) {
Vector v(0);
m.GetVertexPosition(ind,v);
v[axis] = -v[axis];
m.SetVertexPosition(ind,v);
m.GetVertexNormal(ind,v);
v[axis] = -v[axis];
m.SetVertexNormal(ind,v);
}
int fCount = m.GetFaceCount();
for (int ind=0; ind<fCount; ind++) {
int v1,v2,v3;
m.GetFaceVertexIndex(ind,v1,v2,v3);
m.SetFaceVertexIndex(ind,v3,v2,v1);
}
}
}