简体   繁体   English

WPF C#中的地形3D

[英]Topographical 3D in WPF C#

This is a screen shot of a project that I did a few years ago: 这是我几年前做的一个项目的屏幕截图: 在此处输入图片说明

I did this with XNA. 我用XNA做到了。 I've done similar things with the Sunburn Engine and OpenGL. 我使用Sunburn Engine和OpenGL做过类似的事情。 There are really only two files: a large bitmap topographical map and a similar size height map 'underneath'. 实际上只有两个文件:一个大的位图地形图和一个“下面”的类似尺寸的高度图。

I'm wondering how I would do this in a WPF program. 我想知道如何在WPF程序中执行此操作。 Ideally, I would be able to rotate this in 3D in a window. 理想情况下,我将能够在窗口中以3D旋转它。 The only thing I've seen similar seems to use 3rd party plug-ins. 我所见过的唯一类似的东西似乎是使用3rd party插件。

Can anybody steer me in the right direction? 有人可以指引我正确的方向吗?

Thanks! 谢谢!

Sorry but your question wasn't worded very clearly, it sounded like you wanted to port from XNA to WPF 3D graphics. 抱歉,您的问题措辞不太清楚,听起来您想从XNA移植到WPF 3D图形。

Displaying XNA in a WPF app is fairly straightforward and is explained on Nick Gravelyn's MSDN article . 在WPF应用程序中显示XNA非常简单,有关详细信息,请参见Nick Gravelyn的MSDN文章 Sample code is also provided, so that should be enough to get you started. 还提供了示例代码,因此足以让您入门。

The main problem with Nick's technique is that it doesn't allow you to overlap XNA and WPF elements in the same window. Nick技术的主要问题在于,它不允许您在同一窗口中重叠XNA和WPF元素。 You can get around that by placing the WPF controls inside a Popup as described in Fredrik Hedblad's answer to this SO question . 您可以通过将WPF控件放在Popup 窗口中来解决该问题 ,如Fredrik Hedblad对这个SO问题的回答中所述。

Combine the two together and you get a WPF front end overlaying an XNA-rendered scene. 将两者结合在一起,您将获得一个WPF前端,该前端覆盖XNA渲染的场景。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM