Programmatically creating a WPF 3D cube
What is the simple开发者_如何学Cst way to programmatically create a GeometryModel3D cube in wpf?
The simplest method? It all depends on your point of view.
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
{
...
},
...
},
...
};
But others might consider a single call to XamlReader.Parse("...put your xaml here...")
as more simple.
It's a judgement call.
精彩评论