2016-06-01 7 views

答えて

0

あなたが探しているものに応じて、これには2つの方法があります。レンダリングラスタライザの状態をワイヤフレームを表示するように設定するか、またはエッジのリストを取得してVertexPositionColorのセットをGraphicsDevice.DrawIndexedPrimitivesを使用して描画することができます。

ラスターサイザー州

あなたは透明キューブを描くことができ、その後、あなたがBasicEffectを使用していると仮定すると、あなたはシェーディングのすべてをオフにして、白に色を設定することができます。

次に、新しいラスタライザ状態を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を使用してすべてのエッジを含むVerticesの配列を描画することです。

シンプルなgoogle検索では、これを使用する際にたくさんの例があります。

関連する問題