本文整理汇总了C#中Mesh.UnifyNormals方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.UnifyNormals方法的具体用法?C# Mesh.UnifyNormals怎么用?C# Mesh.UnifyNormals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.UnifyNormals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRhinoMesh
public Mesh GetRhinoMesh()
{
var mesh = new Mesh();
mesh.Vertices.AddVertices(Vertices);
foreach (var face in Faces)
{
mesh.Faces.AddFace(new MeshFace(face[0], face[1], face[2]));
}
mesh.Normals.ComputeNormals();
mesh.FaceNormals.ComputeFaceNormals();
mesh.UnifyNormals();
mesh.Normals.ComputeNormals();
var meshes = mesh.SplitDisjointPieces();
mesh = new Mesh();
for (int i = 0; i < meshes.Count(); i++)
{
if (meshes[i].SolidOrientation() == -1)
meshes[i].Flip(true, true, true);
mesh.Append(meshes[i]);
}
Rhino.RhinoApp.WriteLine(mesh.SolidOrientation().ToString());
return mesh;
}
示例2: NormaliseMesh
/// <summary>
/// Fixes inconsistencies in the mesh face normals.
/// </summary>
public static void NormaliseMesh(ref Mesh mesh)
{
if (mesh.SolidOrientation() == -1)
{
mesh.Flip(true, true, true);
}
mesh.FaceNormals.ComputeFaceNormals();
mesh.UnifyNormals();
mesh.Normals.ComputeNormals();
}
示例3: Gauss
public Gauss(Mesh input_mesh)
{
mesh = input_mesh;
mesh.Compact();
mesh.UnifyNormals();
el = mesh.TopologyEdges;
vs = mesh.TopologyVertices;
ps = new List<VertexProperties>();
for (int i = 0; i < vs.Count; i++)
{
ps.Add(new VertexProperties
(mesh.Normals[vs.MeshVertexIndices(i)[0]]));
// outputs2.Add(new Vector3d());
}
}
示例4: LoadHeightMap
public Mesh LoadHeightMap(double uscale, double vscale, int u, int v, double heightscale, double texturescale, string HeightMapPath)
{
if (uscale < 0.001) uscale = 0.001;
if (vscale < 0.001) vscale = 0.001;
if (heightscale < 0.001) heightscale = 0.001;
if (uscale > 10000) uscale = 10000;
if (vscale > 10000) vscale = 10000;
if (heightscale > 10000) heightscale = 10000;
if (u < 4) u = 4;
if (v < 4) v = 4;
if (u > 4096) u = 4096;
if (v > 4096) v = 4096;
if (texturescale > 4096) texturescale = 4096;
if (texturescale < 0.001) texturescale = 0.001;
Mesh mesh = new Mesh();
try
{
Bitmap te2 = new Bitmap(HeightMapPath);
if (te2.Width < u || te2.Height < v)
{
u = te2.Width; v = te2.Height;
}
for (int j = 0; j < v; j++)
{
for (int i = 0; i < u; i++)
{
mesh.Vertices.Add(new Point3d(i * uscale, te2.GetPixel(i, j).GetBrightness() * heightscale, j * vscale));
mesh.TextureCoordinates.Add((double)i / (double)u * texturescale, (double)j / (double)v * texturescale);
if (i > 0 && j > 0)
{
mesh.Faces.AddFace(new MeshFace((j - 1) * u + i - 1, j * u + i - 1, j * u + i, (j - 1) * u + i));
}
}
}
mesh.Compact();
mesh.UnifyNormals();
return mesh;
}
catch{return null;}
}
示例5: Topo1
public Mesh Topo1(Mesh x)
{
Rhino.Geometry.Collections.MeshTopologyEdgeList el = x.TopologyEdges;
Rhino.Geometry.Collections.MeshTopologyVertexList vs = x.TopologyVertices;
List<Point3d> FaceC = new List<Point3d>();
for (int i = 0; i < x.Faces.Count; i++)
{
Point3d f = new Point3d();
if (x.Faces[i].IsQuad)
{
f += x.Vertices[x.Faces[i].A];
f += x.Vertices[x.Faces[i].B];
f += x.Vertices[x.Faces[i].C];
f += x.Vertices[x.Faces[i].D];
f /= 4;
}
else if (x.Faces[i].IsTriangle)
{
f += x.Vertices[x.Faces[i].A];
f += x.Vertices[x.Faces[i].B];
f += x.Vertices[x.Faces[i].C];
f /= 3;
}
FaceC.Add(f);
}
Mesh mesh = new Mesh();
for (int i = 0; i < el.Count; i++)
{
if (el.GetConnectedFaces(i).Length == 2)
{
int C = mesh.Vertices.Count;
mesh.Vertices.Add(vs[el.GetTopologyVertices(i).I]);
mesh.Vertices.Add(FaceC[el.GetConnectedFaces(i)[0]]);
mesh.Vertices.Add(vs[el.GetTopologyVertices(i).J]);
mesh.Vertices.Add(FaceC[el.GetConnectedFaces(i)[1]]);
mesh.Faces.AddFace(C, C + 1, C + 2, C + 3);
}
else if (el.GetConnectedFaces(i).Length == 1)
{
int C = mesh.Vertices.Count;
mesh.Vertices.Add(vs[el.GetTopologyVertices(i).I]);
mesh.Vertices.Add(FaceC[el.GetConnectedFaces(i)[0]]);
mesh.Vertices.Add(vs[el.GetTopologyVertices(i).J]);
mesh.Faces.AddFace(C, C + 1, C + 2);
}
}
mesh.UnifyNormals();
return mesh;
}
示例6: MeshClean
public void MeshClean(ref Mesh mesh, double tolerance)
{
try
{
List<int> mapping = new List<int>();
List<Point3d> ps = new List<Point3d>();
List<double> MapCount = new List<double>();
ps.Add(mesh.Vertices[0]); mapping.Add(0); MapCount.Add(1);
for (int j = 1; j < mesh.Vertices.Count; j++)
{
double min = double.MaxValue;
int sign = 0;
for (int i = 0; i < ps.Count; i++)
{
double tempt = ps[i].DistanceTo((Point3d)mesh.Vertices[j]);
if (tempt < min)
{
min = tempt; sign = i;
}
}
if (min < tolerance)
{
mapping.Add(sign);
MapCount[sign]++;
ps[sign] *= (MapCount[sign] - 1) / MapCount[sign];
Point3d tempp = (Point3d)(mesh.Vertices[j]); tempp *= (1 / MapCount[sign]);
ps[sign] += tempp;
}
else { mapping.Add(ps.Count); ps.Add(mesh.Vertices[j]); MapCount.Add(1); }
}
Mesh mesh2 = new Mesh();
for (int i = 0; i < ps.Count; i++)
{
mesh2.Vertices.Add(ps[i]);
}
for (int i = 0; i < mesh.Faces.Count; i++)
{
MeshFace f_temp = MeshFace.Unset;
bool FaceSign = false;
if (mesh.Faces[i].IsQuad)
{
int p1 = mapping[mesh.Faces[i].A];
int p2 = mapping[mesh.Faces[i].B];
int p3 = mapping[mesh.Faces[i].C];
int p4 = mapping[mesh.Faces[i].D];
if (noRepeat(p1, p2, p3, p4))
{
f_temp = new MeshFace(p1, p2, p3, p4); FaceSign = true;
}
}
else if (mesh.Faces[i].IsTriangle)
{
int p1 = mapping[mesh.Faces[i].A];
int p2 = mapping[mesh.Faces[i].B];
int p3 = mapping[mesh.Faces[i].C];
if (noRepeat(p1, p2, p3))
{
f_temp = new MeshFace(p1, p2, p3); FaceSign = true;
}
}
if (mesh2.Faces.Count > 0)
{
for (int j = 0; j < mesh2.Faces.Count; j++)
{
if (!noRepeat(mesh2.Faces[j], f_temp)) FaceSign = false;
}
}
if (FaceSign) mesh2.Faces.AddFace(f_temp);
}
mesh2.Compact();
mesh2.UnifyNormals();
mesh = mesh2;
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString());
}
}
示例7: MeshWindow
///// MeshCreation
public Mesh MeshWindow(Mesh mesh, double t)
{
Mesh output = new Mesh();
mesh.FaceNormals.ComputeFaceNormals();
for (int i = 0; i < mesh.Faces.Count; i++)
{
MeshFace mf = mesh.Faces[i];
if (mf.IsTriangle)
{
Point3d p1 = mesh.Vertices[mf.A];
Point3d p2 = mesh.Vertices[mf.B];
Point3d p3 = mesh.Vertices[mf.C];
Line l1 = new Line(p1, p2);
Line l2 = new Line(p2, p3);
Line l3 = new Line(p3, p1);
Vector3d v1 = Vector3d.CrossProduct(p2 - p1, mesh.FaceNormals[i]);
v1.Unitize(); v1 *= -t;
Vector3d v2 = Vector3d.CrossProduct(p3 - p2, mesh.FaceNormals[i]);
v2.Unitize(); v2 *= -t;
Vector3d v3 = Vector3d.CrossProduct(p1 - p3, mesh.FaceNormals[i]);
v3.Unitize(); v3 *= -t;
l1.Transform(Transform.Translation(v1));
l2.Transform(Transform.Translation(v2));
l3.Transform(Transform.Translation(v3));
double t1, t2, t3;
Rhino.Geometry.Intersect.Intersection.LineLine(l1, l2, out t1, out t2);
p2 = (l1.PointAt(t1) + l2.PointAt(t2)) / 2;
Rhino.Geometry.Intersect.Intersection.LineLine(l2, l3, out t2, out t3);
p3 = (l3.PointAt(t3) + l2.PointAt(t2)) / 2;
Rhino.Geometry.Intersect.Intersection.LineLine(l3, l1, out t3, out t1);
p1 = (l1.PointAt(t1) + l3.PointAt(t3)) / 2;
int index1 = output.Vertices.Count;
output.Vertices.Add(p1);
output.Vertices.Add(p2);
output.Vertices.Add(p3);
output.Faces.AddFace(index1, index1 + 1, index1 + 2);
}
if (mf.IsQuad)
{
Point3d p1 = mesh.Vertices[mesh.Faces[i].A];
Point3d p2 = mesh.Vertices[mesh.Faces[i].B];
Point3d p3 = mesh.Vertices[mesh.Faces[i].C];
Point3d p4 = mesh.Vertices[mesh.Faces[i].D];
Line l1 = new Line(p1, p2);
Line l2 = new Line(p2, p3);
Line l3 = new Line(p3, p4);
Line l4 = new Line(p4, p1);
Vector3d v1 = Vector3d.CrossProduct(p2 - p1, mesh.FaceNormals[i]);
v1.Unitize(); v1 *= -t;
Vector3d v2 = Vector3d.CrossProduct(p3 - p2, mesh.FaceNormals[i]);
v2.Unitize(); v2 *= -t;
Vector3d v3 = Vector3d.CrossProduct(p4 - p3, mesh.FaceNormals[i]);
v3.Unitize(); v3 *= -t;
Vector3d v4 = Vector3d.CrossProduct(p1 - p4, mesh.FaceNormals[i]);
v4.Unitize(); v4 *= -t;
l1.Transform(Transform.Translation(v1));
l2.Transform(Transform.Translation(v2));
l3.Transform(Transform.Translation(v3));
l4.Transform(Transform.Translation(v4));
double t1, t2, t3, t4;
Rhino.Geometry.Intersect.Intersection.LineLine(l1, l2, out t1, out t2);
p2 = (l1.PointAt(t1) + l2.PointAt(t2)) / 2;
Rhino.Geometry.Intersect.Intersection.LineLine(l2, l3, out t2, out t3);
p3 = (l3.PointAt(t3) + l2.PointAt(t2)) / 2;
Rhino.Geometry.Intersect.Intersection.LineLine(l3, l4, out t3, out t4);
p4 = (l4.PointAt(t4) + l3.PointAt(t3)) / 2;
Rhino.Geometry.Intersect.Intersection.LineLine(l4, l1, out t4, out t1);
p1 = (l1.PointAt(t1) + l4.PointAt(t4)) / 2;
int index1 = output.Vertices.Count;
output.Vertices.Add(p1);
output.Vertices.Add(p2);
output.Vertices.Add(p3);
output.Vertices.Add(p4);
output.Faces.AddFace(index1, index1 + 1, index1 + 2, index1 + 3);
}
}
output.UnifyNormals();
return output;
}
示例8: MeshOffset
public Mesh MeshOffset(Mesh meshOral, Vector3d v)
{
Mesh mesh = new Mesh();
meshOral.Compact();
for (int i = 0; i < meshOral.Vertices.Count; i++)
{
mesh.Vertices.Add(new Point3d(meshOral.Vertices[i]) + v);
}
for (int i = 0; i < meshOral.Faces.Count; i++)
{
mesh.Faces.AddFace(meshOral.Faces[i]);
}
mesh.UnifyNormals();
return mesh;
}
示例9: createNewFaces
private Mesh createNewFaces(Point3d pt, Mesh mesh)
{
List<Polyline> list2 = new List<Polyline>();
list2.AddRange(mesh.GetNakedEdges());
List<Line> list = new List<Line>();
int num3 = list2.Count - 1;
for (int i = 0; i <= num3; i++)
{
Polyline polyline = new Polyline();
list.AddRange(list2[i].GetSegments());
}
Mesh other = new Mesh();
int num4 = list.Count - 1;
for (int j = 0; j <= num4; j++)
{
Mesh mesh4 = new Mesh();
Line line = list[j];
mesh4.Vertices.Add(line.From);
mesh4.Vertices.Add(line.To);
mesh4.Vertices.Add(pt);
mesh4.Faces.AddFace(0, 1, 2);
other.Append(mesh4);
}
mesh.Append(other);
mesh.Vertices.CombineIdentical(true, true);
mesh.UnifyNormals();
return mesh;
}
示例10: ConvexHull
public Mesh ConvexHull(List<Point3d> list)
{
Mesh mesh = new Mesh();
if (list.Count > 3)
{
List<Point3d> list2 = new List<Point3d>();
list2.AddRange(list);
for (int i = 0; i < list.Count; i++)
{
bool flag = true;
int index = i;
if (mesh.Vertices.Count == 2)
{
flag = this.checkIfOnLine(mesh.Vertices[0], mesh.Vertices[1], list2[index]);
}
if (mesh.Vertices.Count == 3)
{
flag = checkIfOnPlane(mesh.Vertices[0], mesh.Vertices[1], mesh.Vertices[2], list2[index]);
}
if (flag)
{
mesh.Vertices.Add(list2[index]);
}
if (mesh.Vertices.Count == 4)
{
mesh.Faces.AddFace(0, 1, 2);
mesh.Faces.AddFace(1, 2, 3);
mesh.Faces.AddFace(2, 3, 0);
mesh.Faces.AddFace(3, 0, 1);
mesh.Vertices.CombineIdentical(true, true);
mesh.FaceNormals.ComputeFaceNormals();
mesh.UnifyNormals();
mesh.Normals.ComputeNormals();
break;
}
}
//Print(mesh.Vertices.Count.ToString());
if (mesh.Vertices.Count < 4) { return default(Mesh); }
if (list2.Count - 4 <= 0) { return mesh; }
//
for (int ii = 0; ii < list2.Count; ii++)
{
int num2 = ii;
Point3d point = new Point3d(list2[num2]);
if (!this.IsPtInMesh(point, mesh))
{
List<int> list3 = new List<int>();
list3 = this.seenFaces(point, mesh);
list3.Sort();
for (int i = list3.Count - 1; i >= 0; i += -1)
{
mesh.Faces.RemoveAt(list3[i]);
}
mesh = this.createNewFaces(point, mesh);
}
}
}
return mesh;
}
示例11: IsPtInMesh
private bool IsPtInMesh(Point3d point, Mesh mesh)
{
mesh.FaceNormals.ComputeFaceNormals();
mesh.UnifyNormals();
mesh.Normals.ComputeNormals();
BoundingBox boundingBox = mesh.GetBoundingBox(true);
if (!boundingBox.Contains(point))
{
return false;
}
Polyline points = new Polyline();
points.Add(point);
Vector3d vectord = new Vector3d(100.0, 100.0, 100.0);
points.Add(boundingBox.Max + vectord);
int[] faceIds = null;
Point3d[] pointdArray = Rhino.Geometry.Intersect.Intersection.MeshPolyline(mesh, new PolylineCurve(points), out faceIds);
if (pointdArray == null)
{
return false;
}
if ((pointdArray.Length % 2) == 0)
{
return false;
}
return true;
}
示例12: ObjToMesh
public Mesh ObjToMesh(string Objpath)
{
Mesh mesh = new Mesh();
StreamReader srd;
try
{
srd = File.OpenText(Objpath);
}
catch
{
return null;
}
try
{
while (srd.Peek() != -1)
{
string str = srd.ReadLine();
string[] chara = str.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
if (chara.Length > 2)
{
if (chara[0] == "v")
{
mesh.Vertices.Add(
Convert.ToSingle(chara[1]),
-Convert.ToSingle(chara[3]),
Convert.ToSingle(chara[2]));
}
else if (chara[0] == "vt")
{
mesh.TextureCoordinates.Add(
Convert.ToSingle(chara[1]),
Convert.ToSingle(chara[2]));
}
else if (chara[0] == "vn")
{
mesh.Normals.Add(
Convert.ToSingle(chara[1]),
-Convert.ToSingle(chara[3]),
Convert.ToSingle(chara[2]));
}
else if (chara[0] == "f")
{
if (chara.Length == 4)
{
int a = Convert.ToInt32(chara[1].Split('/')[0]) - 1;
int c = Convert.ToInt32(chara[2].Split('/')[0]) - 1;
int b = Convert.ToInt32(chara[3].Split('/')[0]) - 1;
mesh.Faces.AddFace(a, b, c);
}
if (chara.Length == 5)
{
int a = Convert.ToInt32(chara[1].Split('/')[0]) - 1;
int b = Convert.ToInt32(chara[2].Split('/')[0]) - 1;
int c = Convert.ToInt32(chara[3].Split('/')[0]) - 1;
int d = Convert.ToInt32(chara[4].Split('/')[0]) - 1;
mesh.Faces.AddFace(a, b, c, d);
}
}
}
}
srd.Close();
mesh.Compact();
mesh.UnifyNormals();
}
catch
{
return null;
}
return mesh;
}
示例13: P_mesh
//Create a Plankton Mesh from a Rhino Mesh
public P_mesh(Mesh M)
{
M.Vertices.CombineIdentical(true, true);
M.Vertices.CullUnused();
M.UnifyNormals();
M.Weld(Math.PI);
this.Faces = new List<P_face>();
this.HalfEdges = new List<P_halfedge>();
this.Vertices = new List<P_vertex>();
for (int i = 0; i < M.Vertices.Count; i++)
{
Vertices.Add(new P_vertex(M.TopologyVertices[i]));
}
for (int i = 0; i < M.Faces.Count; i++)
{Faces.Add(new P_face()); }
for (int i = 0; i < M.TopologyEdges.Count; i++)
{
P_halfedge HalfA = new P_halfedge();
HalfA.StartVertex = M.TopologyEdges.GetTopologyVertices(i).I;
if (Vertices[HalfA.StartVertex].OutgoingHalfEdge == -1)
{ Vertices[HalfA.StartVertex].OutgoingHalfEdge = HalfEdges.Count; }
P_halfedge HalfB = new P_halfedge();
HalfB.StartVertex = M.TopologyEdges.GetTopologyVertices(i).J;
if (Vertices[HalfB.StartVertex].OutgoingHalfEdge == -1)
{ Vertices[HalfB.StartVertex].OutgoingHalfEdge = HalfEdges.Count + 1; }
bool[] Match;
int[] ConnectedFaces = M.TopologyEdges.GetConnectedFaces(i, out Match);
//Note for Steve Baer : This Match bool doesn't seem to work on triangulated meshes - it often returns true
//for both faces, even for a properly oriented manifold mesh, which can't be right
//So - making our own check for matching:
//(I suspect the problem is related to C being the same as D for triangles, so best to
//deal with them separately just to make sure)
//loop through the vertices of the face until finding the one which is the same as the start of the edge
//iff the next vertex around the face is the end of the edge then it matches.
Match[0] = false;
if (Match.Length > 1)
{Match[1] = true;}
int VertA = M.TopologyVertices.TopologyVertexIndex(M.Faces[ConnectedFaces[0]].A);
int VertB = M.TopologyVertices.TopologyVertexIndex(M.Faces[ConnectedFaces[0]].B);
int VertC = M.TopologyVertices.TopologyVertexIndex(M.Faces[ConnectedFaces[0]].C);
int VertD = M.TopologyVertices.TopologyVertexIndex(M.Faces[ConnectedFaces[0]].D);
if ((VertA == M.TopologyEdges.GetTopologyVertices(i).I)
&& (VertB == M.TopologyEdges.GetTopologyVertices(i).J))
{ Match[0] = true;
}
if ((VertB == M.TopologyEdges.GetTopologyVertices(i).I)
&& (VertC == M.TopologyEdges.GetTopologyVertices(i).J))
{
Match[0] = true;
}
if ((VertC == M.TopologyEdges.GetTopologyVertices(i).I)
&& (VertD == M.TopologyEdges.GetTopologyVertices(i).J))
{
Match[0] = true;
}
if ((VertD == M.TopologyEdges.GetTopologyVertices(i).I)
&& (VertA == M.TopologyEdges.GetTopologyVertices(i).J))
{
Match[0] = true;
}
//I don't think these next 2 should ever be needed, but just in case:
if ((VertC == M.TopologyEdges.GetTopologyVertices(i).I)
&& (VertA == M.TopologyEdges.GetTopologyVertices(i).J))
{
Match[0] = true;
}
if ((VertB == M.TopologyEdges.GetTopologyVertices(i).I)
&& (VertD == M.TopologyEdges.GetTopologyVertices(i).J))
{
Match[0] = true;
}
if (Match[0] == true)
{
HalfA.AdjacentFace = ConnectedFaces[0];
if (Faces[HalfA.AdjacentFace].FirstHalfEdge == -1)
{ Faces[HalfA.AdjacentFace].FirstHalfEdge = HalfEdges.Count; }
if (ConnectedFaces.Length > 1)
{
HalfB.AdjacentFace = ConnectedFaces[1];
if (Faces[HalfB.AdjacentFace].FirstHalfEdge == -1)
{ Faces[HalfB.AdjacentFace].FirstHalfEdge = HalfEdges.Count + 1; }
}
else
{
//.........这里部分代码省略.........
示例14: MeshExtruteEdge
public Mesh MeshExtruteEdge(Mesh meshOral, Vector3d v)
{
Mesh mesh = new Mesh();
meshOral.UnifyNormals();
meshOral.Compact();
Rhino.Geometry.Collections.MeshTopologyEdgeList el = meshOral.TopologyEdges;
Rhino.Geometry.Collections.MeshTopologyVertexList vs = meshOral.TopologyVertices;
for (int i = 0; i < el.Count; i++)
{
if (el.GetConnectedFaces(i).Length == 1)
{
int p1 = el.GetTopologyVertices(i).I;
int p2 = el.GetTopologyVertices(i).J;
int VS = mesh.Vertices.Count;
mesh.Vertices.Add(vs[p1]);
mesh.Vertices.Add(vs[p2]);
mesh.Vertices.Add(new Point3d(vs[p2]) + v);
mesh.Vertices.Add(new Point3d(vs[p1]) + v);
mesh.Faces.AddFace(VS, VS + 1, VS + 2, VS + 3);
}
}
mesh.UnifyNormals();
return mesh;
}
示例15: MeshUVRoad
public Mesh MeshUVRoad(Polyline pl1, Polyline pl2, double texturescale)
{
Polyline pl3 = new Polyline();
List<double> domain3 = new List<double>();
double t = 0;
for (int i = 0; i < pl1.Count; i++)
{
Point3d p3 = (pl1[i] + pl2[i]) / 2;
if (i > 0) t += p3.DistanceTo(pl3[pl3.Count - 1]);
domain3.Add(t);
pl3.Add(p3);
}
Mesh mesh = new Mesh();
for (int i = 0; i < pl3.Count; i++)
{
mesh.Vertices.Add(pl1[i]);
mesh.Vertices.Add(pl2[i]);
double t1 = domain3[i] / pl3.Length;
// Print(t1.ToString());
mesh.TextureCoordinates.Add(t1 * texturescale, 0);
mesh.TextureCoordinates.Add(t1 * texturescale, 1);
if (i > 0)
{
mesh.Faces.AddFace((i - 1) * 2, i * 2, i * 2 + 1, (i - 1) * 2 + 1);
}
}
mesh.Compact();
mesh.UnifyNormals();
return mesh;
}