刚接触directX开发,问个问题!

bshedu5 bshedu5 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

画一个四棱锥!!!


public void OnCreateVertexBuffer(object sender, EventArgs e)
{
//VertexBuffer 操作顶点缓冲区资源类
VertexBuffer vb = (VertexBuffer)sender;
CustomVertex.PositionColored[] verts = (CustomVertex.PositionColored[])vb.Lock(0, 0);

//四棱锥原始的5个点
Vector3 vertex1 = new Vector3(25, 0, 0);
Vector3 vertex2 = new Vector3(0, -25, 0);
Vector3 vertex3 = new Vector3(-25, 0, 0);
Vector3 vertex4 = new Vector3(0, 25, 0);
Vector3 vertex5 = new Vector3(0, 0, 25);

//四棱锥中包含个三角形,所以要构造个点来绘制

/*这下面是在做什么*/??
verts[0].Position = vertex1;
verts[1].Position = vertex2;
verts[2].Position = vertex5;
verts[3].Position = vertex2;
verts[4].Position = vertex3;
verts[5].Position = vertex5;
verts[6].Position = vertex3;
verts[7].Position = vertex4;
verts[8].Position = vertex5;
verts[9].Position = vertex4;
verts[10].Position = vertex1;
verts[11].Position = vertex5;
verts[12].Position = vertex2;
verts[13].Position = vertex1;
verts[14].Position = vertex3;
verts[15].Position = vertex3;
verts[16].Position = vertex1;
verts[17].Position = vertex4;



}
...全文

相关推荐

评论 7
收藏 已收藏
分享
返回顶部
bshedu5
游戏开发 8,324 成员 23,685 内容