Ну, я создаю майнкрафт, похожий на ландшафт, который, как и майнкрафт, разделяется на регионы. Моя проблема просто в том, что некоторые лица не отображаются, а верхняя и правая часть областей 6x6 не отображаются.
Мне было интересно, может ли кто-нибудь проверить мой код, чтобы увидеть, что я делаю неправильно, вот функция:
public void BuildFaceVertices(Vector3 pos, BlockFaceDirection blockFaceDirection)
{
Vector3 topLeftFront = new Vector3(0f, 1f, 0f) + pos;
Vector3 bottomLeftFront = new Vector3(0f, 0f, 0f) + pos;
Vector3 topRightFront = new Vector3(1f, 1f, 0f) + pos;
Vector3 bottomRightFront = new Vector3(1f, 0f, 0f) + pos;
Vector3 topLeftBack = new Vector3(0f, 1f, -1f) + pos;
Vector3 topRightBack = new Vector3(1f, 1f, -1f) + pos;
Vector3 bottomLeftBack = new Vector3(0f, 0f, -1f) + pos;
Vector3 bottomRightBack = new Vector3(1f, 0f, -1f) + pos;
Vector2 topLeft = new Vector2(0.0f, 0.0f);
Vector2 topRight = new Vector2(1.0f, 0.0f);
Vector2 bottomLeft = new Vector2(0.0f, 1.0f);
Vector2 bottomRight = new Vector2(1.0f, 1.0f);
switch (blockFaceDirection)
{
case BlockFaceDirection.ZIncreasing:
SolidVertices.Add(new VertexPositionTexture(topRightFront, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomRightFront, bottomRight));
SolidVertices.Add(new VertexPositionTexture(bottomLeftFront, bottomLeft));
SolidVertices.Add(new VertexPositionTexture(topRightFront, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomLeftFront, bottomLeft));
SolidVertices.Add(new VertexPositionTexture(topLeftFront, topLeft));
break;
case BlockFaceDirection.ZDecreasing:
SolidVertices.Add(new VertexPositionTexture(topRightBack, topLeft));
SolidVertices.Add(new VertexPositionTexture(topLeftBack, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomRightBack, bottomLeft));
SolidVertices.Add(new VertexPositionTexture(topLeftBack, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomLeftBack, bottomRight));
SolidVertices.Add(new VertexPositionTexture(bottomRightBack, bottomLeft));
break;
case BlockFaceDirection.YIncreasing:
SolidVertices.Add(new VertexPositionTexture(topRightBack, topRight));
SolidVertices.Add(new VertexPositionTexture(topRightFront, bottomRight));
SolidVertices.Add(new VertexPositionTexture(topLeftFront, bottomLeft));
SolidVertices.Add(new VertexPositionTexture(topRightBack, topRight));
SolidVertices.Add(new VertexPositionTexture(topLeftFront, bottomLeft));
SolidVertices.Add(new VertexPositionTexture(topLeftBack, topLeft));
break;
case BlockFaceDirection.YDecreasing:
SolidVertices.Add(new VertexPositionTexture(bottomLeftFront, topLeft));
SolidVertices.Add(new VertexPositionTexture(bottomRightFront, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomLeftBack, bottomLeft));
SolidVertices.Add(new VertexPositionTexture(bottomRightFront, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomRightBack, bottomRight));
SolidVertices.Add(new VertexPositionTexture(bottomLeftBack, bottomLeft));
break;
case BlockFaceDirection.XIncreasing:
SolidVertices.Add(new VertexPositionTexture(topRightBack, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomRightFront, bottomLeft));
SolidVertices.Add(new VertexPositionTexture(topRightFront, topLeft));
SolidVertices.Add(new VertexPositionTexture(topRightBack, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomRightBack, bottomRight));
SolidVertices.Add(new VertexPositionTexture(bottomRightFront, bottomLeft));
break;
case BlockFaceDirection.XDecreasing:
SolidVertices.Add(new VertexPositionTexture(topLeftBack, topLeft));
SolidVertices.Add(new VertexPositionTexture(topLeftFront, topRight));
SolidVertices.Add(new VertexPositionTexture(bottomLeftFront, bottomRight));
SolidVertices.Add(new VertexPositionTexture(topLeftBack, topLeft));
SolidVertices.Add(new VertexPositionTexture(bottomLeftFront, bottomRight));
SolidVertices.Add(new VertexPositionTexture(bottomLeftBack, bottomLeft));
break;
}
}'
Этот код показывает: s1100.photobucket.com / album / g420 / darestium / первое изображение изображает лица, которые не рисуются, а последнее - стороны сторон не рисуется.
Заранее спасибо, Darestium