해당 이미지에 사용 된 기술은 레이 캐스팅 2d입니다. 그것은 wolfenstein 3d에서 처음 사용되었으며 2D에서 가짜 3D를 구현합니다. 이 당신이 원하는 것은 아니지만
여기 당신은 tutotial http://lodev.org/cgtutor/
을 찾을 수 있습니다.
원하는 것을 얻기위한 가장 좋은 방법은 두 개의 삼각형을 정의하고 그 기본 도형과 함께 GraphicsDevice.DrawUserPrimitives를 사용하는 것입니다.
// Init Triangles with four points A,B,C and D
VertexPOsitionTexture[] Vertex = new VertexPositionTexture[6];
Vertex[0].Position = (A.X,A.Y,0);
Vertex[1].Position = (B.X,B.Y,0);
Vertex[2].Position = (C.X,C.Y,0);
Vertex[3].Position = (C.X,C.Y,0);
Vertex[4].Position = (B.X,B.Y,0);
Vertex[5].Position = (D.X,D.Y,0);
Vertex[0].Texture= (0,0);
Vertex[1].Texture= (1,0);
Vertex[2].Texture= (0,1);
Vertex[3].Texture= (0,1);
Vertex[4].Texture= (1,0);
Vertex[5].Texture= (1,1);
// Init Effect from http://blogs.msdn.com/b/shawnhar/archive/2010/04/05/spritebatch-and-custom-shaders-in-xna-game-studio-4-0.aspx
Matrix projection = Matrix.CreateOrthographicOffCenter(0, viewport.Width, viewport.Height, 0, 0, 1);
Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);
BasicEffect effect = new BasicEffect();
effect.Texture = your texture;
effect.TextureEnabled = true;
effect.World = Matrix.Identity;
effect.View = Matrix.Identity;
effect.Projection = halfPixelOffset * projection;
// Draw Triangles
effect.Apply():
GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>(vertex, TriangleList, ...,...);
이 코드는 의사 코드로 이해해야하며 테스트되지는 않았지만 수행 할 관련 작업을 보여줍니다.
[this] (http://forums.create.msdn.com/forums/t/37143.aspx) – dowhilefor
dowhilefor을 살펴 보았습니다. 그 내용을 살펴 봤지만, 정확히 내가 필요한 것은 아닙니다 ... 또한 일반적인 해결책을 제시하지 못합니다. 그러나 어쨌든 고마워. – NewProger