public void GetContour (List<List<Pathfinding.ClipperLib.IntPoint>> buffer) {
if (circleResolution < 3) circleResolution = 3;
Vector3 woffset = tr.position;
switch (type) {
case MeshType.Rectangle:
List<Pathfinding.ClipperLib.IntPoint> buffer0 = Pathfinding.Util.ListPool<Pathfinding.ClipperLib.IntPoint>.Claim();
if (useRotation) {
Matrix4x4 m = tr.localToWorldMatrix;//Matrix4x4.TRS (tr.position, tr.rotation, Vector3.one);
buffer0.Add (V3ToIntPoint(m.MultiplyPoint3x4(center + new Vector3(-rectangleSize.x,0,-rectangleSize.y)*0.5f)));
buffer0.Add (V3ToIntPoint(m.MultiplyPoint3x4(center + new Vector3(rectangleSize.x,0,-rectangleSize.y)*0.5f)));
buffer0.Add (V3ToIntPoint(m.MultiplyPoint3x4(center + new Vector3(rectangleSize.x,0,rectangleSize.y)*0.5f)));
buffer0.Add (V3ToIntPoint(m.MultiplyPoint3x4(center + new Vector3(-rectangleSize.x,0,rectangleSize.y)*0.5f)));
} else {
woffset += center;
buffer0.Add (V3ToIntPoint(woffset + new Vector3(-rectangleSize.x,0,-rectangleSize.y)*0.5f));
buffer0.Add (V3ToIntPoint(woffset + new Vector3(rectangleSize.x,0,-rectangleSize.y)*0.5f));
buffer0.Add (V3ToIntPoint(woffset + new Vector3(rectangleSize.x,0,rectangleSize.y)*0.5f));
buffer0.Add (V3ToIntPoint(woffset + new Vector3(-rectangleSize.x,0,rectangleSize.y)*0.5f));
}
buffer.Add(buffer0);
break;
case MeshType.Circle:
buffer0 = Pathfinding.Util.ListPool<Pathfinding.ClipperLib.IntPoint>.Claim(circleResolution);
if (useRotation) {
Matrix4x4 m = tr.localToWorldMatrix;//Matrix4x4.TRS (tr.position, tr.rotation, Vector3.one);
for (int i=0;i<circleResolution;i++) {
buffer0.Add (V3ToIntPoint(m.MultiplyPoint3x4(center + new Vector3(Mathf.Cos((i*2*Mathf.PI)/circleResolution),0,Mathf.Sin((i*2*Mathf.PI)/circleResolution))*circleRadius)));
}
} else {
woffset += center;
for (int i=0;i<circleResolution;i++) {
buffer0.Add (V3ToIntPoint(woffset + new Vector3(Mathf.Cos((i*2*Mathf.PI)/circleResolution),0,Mathf.Sin((i*2*Mathf.PI)/circleResolution))*circleRadius));
}
}
buffer.Add(buffer0);
break;
case MeshType.CustomMesh:
if (mesh != lastMesh || contours == null) {
CalculateMeshContour();
lastMesh = mesh;
}
if (contours != null) {
woffset += center;
bool reverse = Vector3.Dot ( tr.up, Vector3.up ) < 0;
for (int i=0;i<contours.Length;i++) {
Vector3[] contour = contours[i];
buffer0 = Pathfinding.Util.ListPool<Pathfinding.ClipperLib.IntPoint>.Claim(contour.Length);
if (useRotation) {
Matrix4x4 m = tr.localToWorldMatrix;//Matrix4x4.TRS (tr.position, tr.rotation, Vector3.one);
for (int x=0;x<contour.Length;x++) {
buffer0.Add(V3ToIntPoint(m.MultiplyPoint3x4(center + contour[x]*meshScale)));
}
} else {
for (int x=0;x<contour.Length;x++) {
buffer0.Add(V3ToIntPoint(woffset + contour[x]*meshScale));
}
}
if ( reverse ) buffer0.Reverse ();
buffer.Add (buffer0);
}
}
break;
}
}