XNA模型重复
我想知道在 XNA 中是否可以无限次重复地面模型。例如,在此示例中 http://create.msdn.com/en-美国/教育/目录/样本/chasecamera?
I'm wondering is there anyway of repeating the ground model infinite times in XNA. For example in this sample http://create.msdn.com/en-US/education/catalog/sample/chasecamera ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
简单的答案是否定的。如果您尝试绘制无限数量的多边形,不仅会耗尽内存并导致程序崩溃,而且硬件将花费无限的时间来渲染场景。
为了解决这个问题,游戏开发者使用天空盒和无法到达的地形等技巧来让玩家认为世界是无限的。因此,如果您想要一个具有重复地面纹理的有限世界,只需在网格中多次绘制地面纹理,然后放置一个覆盖地面外边缘的天空盒即可。
如果你真的想要一个无限的世界,你可以做一个让天空盒和地面跟着你移动的技巧。因此,只需将地面和天空盒的速度设置为正在移动的精灵的速度即可。
The simple answer is no. If you try to draw an infinite number of polygons not only will your memory run out and your program crash, but the hardware would take an infinite amount of time to render the scene.
To get around this, game developers use tricks like skyboxes and unreachable terrain to make the player think the world is infinite. So if you want a finite world with a repeating ground texture, just draw the ground texture a bunch of times in a grid and put a skybox that covers the outer edges of the ground.
If you REALLY want an infinite looking world, you can do a trick where the skybox and ground move with you. So just set the velocities of the ground and the skybox to be the velocity of the sprite that is moving.
就这样!这是我的定制样品。您可以从具有不同纹理的矩阵索引重复模型
Like that ! It's my custom sample. You can repeat a model from a matrix index with different texture