XNA 4.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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我试图回忆以前在哪里见过纹理圆柱体,然后我在 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