那麼,我正在創造一個Minecraft地形的東西只是爲了它。我面臨的問題是,如果你從某個角度看,一些實際上在別人背後的面孔被繪製在他們面前,因此不會顯示出真實的面部。就像我的世界一樣,我將地形分成不同的區域,當建立頂點緩衝區時,只顯示「外」面。這也是由於某種原因,不是畫出頂部或左邊的圖塊。除了所有這些問題,面部似乎都是重疊的(即只有一半的面部可以看到)後面的頂點正在盈方 - XNA
下面是它的樣子(注意:我只繪製頂面,因爲我必須修復其他面):http://s1100.photobucket.com/albums/g420/darestium/?action=view¤t=minecraftliketerrain.png
我也畫所有地區一氣呵成以下方法(我使用默的效果文件,直到我可以寫我自己的:):
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);
}
}
}
}
}
幫助將不勝感激謝謝:)
你的'RasterizerState'設置了什麼? –