本文整理汇总了C#中Mesh.ComputeEdges方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.ComputeEdges方法的具体用法?C# Mesh.ComputeEdges怎么用?C# Mesh.ComputeEdges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mesh
的用法示例。
在下文中一共展示了Mesh.ComputeEdges方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMesh
/// <summary>
/// constructs a mesh from the passed array of 3d points
/// points must be in column-major format
/// </summary>
/// <param name="verts">a grid of 3d points to mesh</param>
/// <param name="rows">the number of rows in the grid</param>
/// <returns>a ColorPlain mesh object colored by layer</returns>
public static Mesh GetMesh(Point3D[] verts, int rows)
{
int cols = verts.Length / rows;
Mesh mesh = new Mesh(meshNatureType.ColorSmooth);
mesh.Vertices = verts;
mesh.Triangles = new SmoothTriangle[(rows - 1) * (cols - 1) * 2];
int count = 0;
for (int j = 0; j < (rows - 1); j++)
{
for (int i = 0; i < (cols - 1); i++)
{
mesh.Triangles[count++] = new SmoothTriangle(i + j * cols,
i + j * cols + 1,
i + (j + 1) * cols + 1);
mesh.Triangles[count++] = new SmoothTriangle(i + j * cols,
i + (j + 1) * cols + 1,
i + (j + 1) * cols);
}
}
mesh.RegenMode = regenType.RegenAndCompile;
mesh.ComputeEdges();
//mesh.ComputeNormals();
mesh.NormalAveragingMode = meshNormalAveragingType.AveragedByAngle;
return mesh;
}
示例2: UpdateMesh
public static void UpdateMesh(Mesh target, Mesh source)
{
target.Vertices = source.Vertices;
target.Triangles = source.Triangles.ToArray();
//int count = 0;
//for (int j = 0; j < (rows - 1); j++)
//{
// for (int i = 0; i < (cols - 1); i++)
// {
// mesh.Triangles[count++] = new IndexTriangle(i + j * cols,
// i + j * cols + 1,
// i + (j + 1) * cols + 1);
// mesh.Triangles[count++] = new IndexTriangle(i + j * cols,
// i + (j + 1) * cols + 1,
// i + (j + 1) * cols);
// }
//}
target.RegenMode = regenType.RegenAndCompile;
target.ComputeEdges();
//mesh.ComputeNormals();
target.NormalAveragingMode = meshNormalAveragingType.AveragedByAngle;
}