使用 XNA 渲染任意多边形
寻找一种简单的方法来渲染任意顶点列表(在二维平面上)...我猜我必须进行某种细分,并且必须处理凹/凸多边形。在这里不是寻找疯狂的可视化......只是想渲染一个平面形状。
当然其他人以前也遇到过这种需求吗?任何提示将不胜感激:-)
Looking for a simple way to render a list of arbitrary vertices (on a 2d plane) ... I'm guessing that I'll have to do some sort of tessellation, and will have to deal with concave/convex polygons. Not looking for a crazy visualization here ... just want to render a flat shape.
Surely others have encountered this need before? any tips would be appreciated :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你实际上是在进行三角测量。
尝试 Nick Gravelyn 的 Triangulator 库。上次我使用它时,存在一个错误,即某些多边形会从内到外进行三角测量。但是,如果您浏览一下错误跟踪器,我认为那里有一个修复程序(可能是这个)。
You're actually after triangulation.
Try Nick Gravelyn's Triangulator library. Last time I used it there was a bug in that some polygons would triangulate inside-out. But if you poke around the bug tracker I think there's a fix there (perhaps this one).
根据您需要的简单程度,您可以查看此基元示例< /a> 在 msdn 上。它是从 SpaceWar 示例中删除的,应该可以帮助您开始了解基本的原语。
Depending on how simple you need to go, you can check out this Primitives Sample on msdn. It's ripped out of the SpaceWar sample and should get you started with basic primitives.