编程方式创建一个WPF 3D魔方魔方、创建一个、方式、WPF

2023-09-09 21:17:56 作者:志在四方

什么是最简单的方式为编程创建GeometryModel3D立方体在WPF?

What is the simplest way to programatically create a GeometryModel3D cube in wpf?

推荐答案

在简单的方法?这一切都取决于你的观点。

The simplest method? It all depends on your point of view.

我说这种事情是pretty的简单:

I'd say this kind of thing is pretty "simple":

return new GeometryModel3D
{
  Material = ...,
  Geometry = new Geometry
  {
    Points = new Point3DCollection
    {
      new Point3D(0,0,0),
      ...
    },
    TriangleIndices = new Int32Collection
    {
      ...
    },
    ...
  },
  ...
};

但其他人可能会考虑到 XamlReader.Parse一个呼叫(......把你的XAML这里...)更简单。

这是一个主观判断。