WPF 或 .NET 4.0 中是否有网格构建帮助器类?
在 WPF 中构建网格的机制非常低级。例如,您必须提供顶点和索引。 WPF 或 .NET 4.0 框架中的任何位置是否有我可以使用的帮助程序?或者我必须求助于第三方库吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我为构建 Sphere 编写的一段较旧的 XNA 3.1 代码。我在渲染循环中应用了一个变换矩阵,它允许我拉伸和定向它。计算顶点相当简单......我发现计算索引更困难。不过,这应该会给你一个想法。其他基元(例如圆锥体、圆柱体、立方体...)的计算要简单得多。
m_iSegments 参数仅允许我定义要将球体划分为多少个切片...段越多,顶点越多,球体越平滑。
m_Appearance 参数是我对着色器的包装。
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.