まあ、私はちょうどそれのためにマインクラフトの地形のものを作成しています. 私が抱えている問題は、特定の角度で見ると、実際には他の顔の後ろにある顔が前に描かれ、そこにある実際の顔が表示されないことです。Minecraft のように、地形を領域に分割し、頂点バッファーが構築されると、「外側」の面のみが表示されます。また、何らかの理由で一番上のブロックと左のブロックが描画されていません。これらすべての問題に加えて、顔が重なっているように見える (顔の半分しか見えない)
これがどのように見えるかです(他の面を修正する必要があるため、上面のみを描いていることに注意してください):http://s1100.photobucket.com/albums/g420/darestium/?action=view¤t=minecraftliketerrain.png
また、次の方法ですべての領域を一度に描画しています (自分で作成できるようになるまで、reimer のエフェクト ファイルを使用しています :):
public void Draw(Player player, World world)
{
effect.CurrentTechnique = effect.Techniques["TexturedNoShading"];
effect.Parameters["xWorld"].SetValue(Matrix.Identity);
effect.Parameters["xProjection"].SetValue(player.Camera.ProjectionMatrix);
effect.Parameters["xView"].SetValue(player.Camera.ViewMatrix);
effect.Parameters["xCamPos"].SetValue(player.Camera.Position);
effect.Parameters["xTexture"].SetValue(world.TextureAlias.SheetTexture);
effect.Parameters["xCamUp"].SetValue(player.Camera.UpDownRotation);
for (int x = 0; x < world.regions.GetLength(0); x++)
{
for (int y = 0; y < world.regions.GetLength(1); y++)
{
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
Region region = world.regions[x, y];
if (player.Camera.BoundingFrustum.Contains(region.BoundingBox) != ContainmentType.Disjoint)
{
device.SetVertexBuffer(region.SolidVertexBuffer);
//device.Indices = region.SolidIndices;
device.DrawPrimitives(PrimitiveType.TriangleList, 0, region.VertexCount);
//device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, region.VertexCount, 0, region.SolidIndices.IndexCount / 3);
}
}
}
}
}
助けていただければ幸いです:)