XNA 4.0 绘制圆柱模型内部

发布于 2024-11-05 04:19:31 字数 980 浏览 0 评论 0原文

我正在制作一个简单的 XNA 游戏,并且我一直在尝试制作我的世界的周围环境。 Atm 我有一个平坦的地形,可以在上面玩。我想放置一个大圆柱体,周围有纹理。所以从地形上我将能够看到圆柱体内部的纹理。我尝试过更改剔除设置,但它不起作用或者我做错了。关于我的绘制方法应该如何有什么建议吗?我需要一个专门制作的模型来从内部展示吗? 任何代码或指向教程都会有所帮助(我已经尝试了很多)。 谢谢。

我上次尝试的示例。

private void DrawBackground(Model model)
         {

             RasterizerState stat = new RasterizerState();
             stat.CullMode = CullMode.None; 


             foreach (ModelMesh mesh in model.Meshes)
             {
                 foreach (BasicEffect effect in mesh.Effects)
                 {
                     effect.EnableDefaultLighting();
                     effect.PreferPerPixelLighting = true;
                     effect.World = Matrix.Identity;

                     // Use the matrices provided by the game camera
                     effect.View = gameCamera.ViewMatrix;
                     effect.Projection = gameCamera.ProjectionMatrix;
                 }
                 mesh.Draw();
             }

im making a simple XNA game and i have stuck trying to make the surrounding of my world. Atm i have a flat terrain on which im playing . I want to put around a big cylinder with a texture around it . SO from the terrain i will be able to see the texture on the inside of the cylinder.I have tried changing Culling settings but it eather didnt work or i did it wrong . Any suggestions on how my draw method should be ? Do i need a model specially made to be displayed from inside ?
Any code or point to tutorial will help (i have tried a lot already).
Thanks.

A sample of my last attempt.

private void DrawBackground(Model model)
         {

             RasterizerState stat = new RasterizerState();
             stat.CullMode = CullMode.None; 


             foreach (ModelMesh mesh in model.Meshes)
             {
                 foreach (BasicEffect effect in mesh.Effects)
                 {
                     effect.EnableDefaultLighting();
                     effect.PreferPerPixelLighting = true;
                     effect.World = Matrix.Identity;

                     // Use the matrices provided by the game camera
                     effect.View = gameCamera.ViewMatrix;
                     effect.Projection = gameCamera.ProjectionMatrix;
                 }
                 mesh.Draw();
             }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无人问我粥可暖 2024-11-12 04:19:31

我试图回忆以前在哪里见过纹理圆柱体,然后我在 MSDN 网站 http://create 上偶然发现了它.msdn.com

着色器系列 - 2

I was trying to remember where I had seen a textured cylinder before, and then I stumbled across it on the MSDN site http://create.msdn.com.

Shader series - 2

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文