答案 0 :(得分:0)
根据您正在寻找的内容,有两种方法可以做到这一点。您可以将渲染栅格化器状态设置为显示线框,也可以使用VertexPositionColor
获取边缘列表并绘制一组GraphicsDevice.DrawIndexedPrimitives
。
Raster Sizer State
您可以将立方体绘制为透明,然后假设您正在使用BasicEffect
,则可以关闭所有着色并将颜色设置为白色。
然后,您可以在将新的rastersizer状态设置为FillMode.Wireframe
的情况下重绘多维数据集。这里有一些伪代码。
//Draw the Cube Transparent
DrawCubeTransparent();
//Now save the Rastersizer state for later
RasterizerState originalRasterizerState = GraphicsDevice.RasterizerState;
//Now set the RasterizerState too WireFrame
RasterizerState newRasterizerState = new RasterizerState();
newRasterizerState.FillMode = FillMode.WireFrame;
GraphicsDevice.RasterizerState = newRasterizerState;
//Now redraw the cube as wireframe with the shading off and colour set to white
DrawCubeWireFrame();
//Now reset the Rastersizer fill state
raphicsDevice.RasterizerState = originalRasterizerState;
<强> DrawIndexedPrimitives 强>
之前的方法可能并不理想,因为它会绘制所有三角形面,因此在你的立方体面上会有一条对角线。
另一种方法是找出你想要绘制的边,然后使用DrawIndexedPrimitives绘制一个包含所有边的顶点数组。
简单的谷歌搜索将为您提供大量使用它的示例。