The mechanisms for building a mesh in WPF are quite low-level. For example you have to supply the vertexes and the indexes. Are there helpers in the WPF or anywhere in the .NET 4.0 framework I can use? Or do I have to resort to third party libraries?
Share
Here’s an older chunk of XNA 3.1 code I wrote to build a Sphere. I apply a transformation matrix in my rendering loop that allows me to stretch and orient it. Computing the vertices is fairly straightforward… computing the indices are what I find more difficult. This should hopefully give you an idea, though. The other primitives (e.g. cone, cylinder, cube…) are much simpler to compute.
The m_iSegments paremeter just allows me to define how many slices I want to divide the sphere into… the more segments, the more vertices, the smoother the sphere.
The m_Appearance parameter is my wrapper for the shader.