나는 Monogame 3.5
을 사용하고 있으며 큐브의 간단한 모델을 가지고 있습니다. 나는 그것을 그리기 위해 BasicEffect
을 사용한다. 나는 그것이 투명하기를 원한다. 나는 effect.Alpha = 0.5f
을 사용한다. 사진에 모든 가장자리를 표시 할 수 있습니까?어떻게 모노 게임에서 모든 가장자리를 보여줄 수 있습니까?
0
A
답변
0
이 당신을 위해 무엇을 찾고 있는지에 따라 두 가지 방법이있다. 렌더링 래스터 화 프로그램의 상태를 와이어 프레임을 표시하도록 설정하거나 가장자리의 목록을 가져오고 VertexPositionColor
세트를 그릴 수 있습니다. GraphicsDevice.DrawIndexedPrimitives
을 사용하십시오.
래스터 크기 조절기 국가는
당신은 당신이 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를 사용하여 모든 가장자리를 포함하는 Vertices 배열을 그립니다.
간단한 google 검색은 이것을 사용하는 데 많은 예제를 제공합니다.