本文整理汇总了C#中System.Windows.Media.Media3D.MeshGeometry3D.ToWireframe方法的典型用法代码示例。如果您正苦于以下问题:C# MeshGeometry3D.ToWireframe方法的具体用法?C# MeshGeometry3D.ToWireframe怎么用?C# MeshGeometry3D.ToWireframe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.MeshGeometry3D
的用法示例。
在下文中一共展示了MeshGeometry3D.ToWireframe方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMesh
//.........这里部分代码省略.........
point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_max.Z));
point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_min.Z));
point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_min.Z));
point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_max.Z));
//Right
point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_max.Z));
point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_min.Z));
point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_min.Z));
point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_max.Z));
//Bottom
point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_max.Z));
point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_max.Z));
point3DCollection.Add(new Point3D(m_max.X, m_min.Y, m_min.Z));
point3DCollection.Add(new Point3D(m_min.X, m_min.Y, m_min.Z));
//Top
point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_max.Z));
point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_max.Z));
point3DCollection.Add(new Point3D(m_max.X, m_max.Y, m_min.Z));
point3DCollection.Add(new Point3D(m_min.X, m_max.Y, m_min.Z));
Vector3DCollection normals = new Vector3DCollection();
normals.Add(new Vector3D(0, 0, 1));
normals.Add(new Vector3D(0, 0, 1));
normals.Add(new Vector3D(0, 0, 1));
normals.Add(new Vector3D(0, 0, 1));
normals.Add(new Vector3D(0, 0, -1));
normals.Add(new Vector3D(0, 0, -1));
normals.Add(new Vector3D(0, 0, -1));
normals.Add(new Vector3D(0, 0, -1));
normals.Add(new Vector3D(-1, 0, 0));
normals.Add(new Vector3D(-1, 0, 0));
normals.Add(new Vector3D(-1, 0, 0));
normals.Add(new Vector3D(-1, 0, 0));
normals.Add(new Vector3D(1, 0, 0));
normals.Add(new Vector3D(1, 0, 0));
normals.Add(new Vector3D(1, 0, 0));
normals.Add(new Vector3D(1, 0, 0));
normals.Add(new Vector3D(0, -1, 0));
normals.Add(new Vector3D(0, -1, 0));
normals.Add(new Vector3D(0, -1, 0));
normals.Add(new Vector3D(0, -1, 0));
normals.Add(new Vector3D(0, 1, 0));
normals.Add(new Vector3D(0, 1, 0));
normals.Add(new Vector3D(0, 1, 0));
normals.Add(new Vector3D(0, 1, 0));
Int32Collection triangles = new Int32Collection();
//for (int i = 1; i < 6; i += 2)
//{
// triangles.Add(0 + (i * 4));
// triangles.Add(1 + (i * 4));
// triangles.Add(3 + (i * 4));
// triangles.Add(1 + (i * 4));
// triangles.Add(2 + (i * 4));
// triangles.Add(3 + (i * 4));
//}
//for (int i = 0; i < 6; i += 2)
//{
// triangles.Add(3 + (i * 4));
// triangles.Add(1 + (i * 4));
// triangles.Add(0 + (i * 4));
// triangles.Add(3 + (i * 4));
// triangles.Add(2 + (i * 4));
// triangles.Add(1 + (i * 4));
//}
for (int i = 0; i < 6; i++)
{
triangles.Add(0 + (i * 4));
triangles.Add(1 + (i * 4));
triangles.Add(0 + (i * 4));
triangles.Add(1 + (i * 4));
triangles.Add(2 + (i * 4));
triangles.Add(1 + (i * 4));
triangles.Add(2 + (i * 4));
triangles.Add(3 + (i * 4));
triangles.Add(2 + (i * 4));
triangles.Add(3 + (i * 4));
triangles.Add(0 + (i * 4));
triangles.Add(3 + (i * 4));
}
MeshGeometry3D meshGeometry3D = new MeshGeometry3D
{
Positions = point3DCollection,
Normals = normals,
TriangleIndices = triangles
};
m_geometryModel3D = new GeometryModel3D();
GeometryModel3D.Geometry = meshGeometry3D.ToWireframe(0.1);
GeometryModel3D.Material = new DiffuseMaterial(new SolidColorBrush(m_color));
}