游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1825|回复: 0

根据一条线的数据生成一条管道?

[复制链接]

2

主题

7

帖子

7

积分

新手上路

Rank: 1

积分
7
发表于 2006-2-25 15:34:00 | 显示全部楼层 |阅读模式
我才学习3d程序,问的问题很粗浅,大家不要笑话阿:
我现在有知道一系列的点构成的线,我要以这条线为轴心生成一条管线,在使用ms directx 的程序的教程5的时候,看到生成了一个圆柱体:代码如下:(相当于2个点的管道)
                public void OnCreateVertexBuffer(object sender, EventArgs e)
                {
                        VertexBuffer vb = (VertexBuffer)sender;
                        // Create a vertex buffer (100 customervertex)
                        CustomVertex.PositionNormalTextured[] verts = (CustomVertex.PositionNormalTextured[])vb.Lock(0,0); // Lock the buffer (which will return our structs)
            for (int i = 0; i < 50; i++)
            {
                // Fill up our structs
                float theta = (float)(2 * Math.PI * i) / 49;
                verts[2 * i].Position = new Vector3((float)Math.Sin(theta), -1, (float)Math.Cos(theta));
                verts[2 * i].Normal = new Vector3((float)Math.Sin(theta), 0, (float)Math.Cos(theta));
                verts[2 * i].Tu = ((float)i) / (50 - 1);
                verts[2 * i].Tv = 1.0f;


                verts[2 * i + 1].Position = new Vector3((float)Math.Sin(theta), 2, (float)Math.Cos(theta));
                verts[2 * i + 1].Normal = new Vector3((float)Math.Sin(theta), 0, (float)Math.Cos(theta));
                verts[2 * i + 1].Tu = ((float)i) / (100 - 1);
                verts[2 * i + 1].Tv = 0.0f;


                   //HandException(sTxt);

            }
         

            }
         
                        // Unlock (and copy) the data
                        vb.Unlock();
                }

然后我想在这些点加上一段(相当于3)个点的管道,就是不知道怎么改了阿?有没有人家教我?
另外我对asp.net比较熟悉,大家可以相互交流。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-23 17:40

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表